54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年04月23日 星期三 21:04:18
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System.Collections.Generic;
|
|
using RuntimeData;
|
|
using System;
|
|
using MemoryPack;
|
|
|
|
|
|
namespace Logic.Skill
|
|
{
|
|
public partial class CatCartSkill : SkillBase
|
|
{
|
|
public CatCartSkill()
|
|
{
|
|
IsPermanent = true;
|
|
TurnsLimit = 0;
|
|
Score = 2;
|
|
}
|
|
|
|
public override SkillType GetSkillType()
|
|
{
|
|
return SkillType.CATCART;
|
|
}
|
|
|
|
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(2, 2, targetGrid);
|
|
|
|
var hasBuffUnit = new HashSet<UnitData>();
|
|
foreach (var grid in roundGrid)
|
|
{
|
|
if (!mapData.GetUnitDataByGid(grid.Id, out var unit)) continue;
|
|
if (!selfUnitList.Contains(unit)) continue;
|
|
hasBuffUnit.Add(unit);
|
|
unit.AddSkill(SkillType.RECYCLE);
|
|
}
|
|
foreach (var unit in mapData.UnitMap.UnitList)
|
|
{
|
|
if (hasBuffUnit.Contains(unit)) continue;
|
|
unit.RemoveSkill(SkillType.RECYCLE);
|
|
}
|
|
}
|
|
}
|
|
} |