47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年04月23日 星期三 21:04:18
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System.Collections.Generic;
|
|
using RuntimeData;
|
|
using System;
|
|
|
|
|
|
namespace Logic.Skill
|
|
{
|
|
[Serializable]
|
|
public class AutoHealSkill : SkillBase
|
|
{
|
|
public AutoHealSkill()
|
|
{
|
|
IsPermanent = true;
|
|
TurnsLimit = 0;
|
|
Score = 2;
|
|
}
|
|
|
|
public override SkillType GetSkillType()
|
|
{
|
|
return SkillType.AUTOHEAL;
|
|
}
|
|
|
|
public override void OnTurnStart(UnitData self, MapData mapData)
|
|
{
|
|
var selfUnitList = new HashSet<UnitData>();
|
|
mapData.GetUnitDataListByPlayerId(mapData.PlayerMap.SelfPlayerId, selfUnitList);
|
|
if (!mapData.GetGridDataByUnitId(self.Id, out var targetGrid)) return;
|
|
var roundGrid = mapData.GridMap.GetAroundGridData(1, 1, targetGrid);
|
|
foreach (var grid in roundGrid)
|
|
{
|
|
if (!mapData.GetUnitDataByGid(grid.Id, out var unit)) continue;
|
|
if (!selfUnitList.Contains(unit)) continue;
|
|
unit.Health += 2;
|
|
if (unit.Health > unit.GetMaxHealth())
|
|
unit.Health = unit.GetMaxHealth();
|
|
}
|
|
}
|
|
}
|
|
} |