62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
/*
|
||
* @Author: 白哉
|
||
* @Description:
|
||
* @Date: 2025年04月23日 星期三 21:04:18
|
||
* @Modify:
|
||
*/
|
||
|
||
|
||
using RuntimeData;
|
||
using System;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
|
||
namespace Logic.Skill
|
||
{
|
||
[Serializable]
|
||
public class SuperDashSkill : SkillBase
|
||
{
|
||
public SuperDashSkill()
|
||
{
|
||
IsPermanent = true;
|
||
TurnsLimit = 0;
|
||
}
|
||
|
||
public override SkillType GetSkillType()
|
||
{
|
||
return SkillType.SUPERDASH;
|
||
}
|
||
|
||
public override void OnMove(UnitData self, GridData grid, MapData mapData,MoveType moveType)
|
||
{
|
||
//移动到友方伟人身边的时候,才会恢复AP点
|
||
if (moveType == MoveType.ActiveMove)
|
||
{
|
||
var gridList = mapData.GridMap.GetAroundGridData(1, 1, grid);
|
||
foreach (var gd in gridList)
|
||
{
|
||
//如果就是自己这个格子,跳过
|
||
if (gd.Id == grid.Id) continue;
|
||
|
||
if (mapData.GetUnitDataByGid(gd.Id, out var unit)
|
||
&& (unit.UnitType == UnitType.Giant || unit.CarryUnitType == UnitType.Giant)
|
||
&& mapData.GetPlayerDataByUnitId(unit.Id, out var player1)
|
||
&& mapData.GetPlayerDataByUnitId(self.Id, out var player2)
|
||
&& mapData.SameUnion(player1.Id, player2.Id))
|
||
{
|
||
self.AP = 1;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
public override void OnDamaged(MapData mapData, SettlementInfo info)
|
||
{
|
||
if (info?.DamageTarget == null) return;
|
||
if (!info.IsKill) return;
|
||
|
||
info.DamageTarget.MP = 1;
|
||
}
|
||
}
|
||
} |