75 lines
2.1 KiB
C#
75 lines
2.1 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年10月12日 星期六 10:10:12
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using MemoryPack;
|
|
using RuntimeData;
|
|
|
|
|
|
namespace Logic.Skill
|
|
{
|
|
public partial class SakuyaFlyProSkill : SkillBase
|
|
{
|
|
// 本回合添加过 AP 的英雄列表
|
|
private static HashSet<uint> _heroSet;
|
|
|
|
public SakuyaFlyProSkill()
|
|
{
|
|
IsPermanent = true;
|
|
TurnsLimit = 0;
|
|
Score = 2;
|
|
_heroSet = new HashSet<uint>();
|
|
}
|
|
|
|
public override void OnTurnStart(UnitData self, MapData mapData)
|
|
{
|
|
_heroSet.Clear();
|
|
}
|
|
|
|
public override SkillType GetSkillType()
|
|
{
|
|
return SkillType.SAKUYAFLYPRO;
|
|
}
|
|
|
|
public override bool IsCanMoveGiantNearbyGrid(UnitData unit, MapData map)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public override void OnMove(UnitData self, GridData grid, MapData mapData, MoveType moveType)
|
|
{
|
|
if (moveType != MoveType.SkillMove) return;
|
|
var player = self.Player(mapData);
|
|
if (player == null) return;
|
|
var selfUnitList = new HashSet<UnitData>();
|
|
mapData.GetUnitDataListByPlayerId(player.Id, selfUnitList);
|
|
|
|
if (!mapData.GetGridDataByUnitId(self.Id, out var targetGrid)) return;
|
|
var roundGrid = mapData.GridMap.GetAroundGridData(1, 1, targetGrid);
|
|
bool isExcute = false;
|
|
foreach (var gridData in roundGrid)
|
|
{
|
|
var unit = gridData.Unit(mapData);
|
|
if (unit == null || unit == self) continue;
|
|
if (!unit.TreatedAsHero(mapData,self)) continue;
|
|
if (!selfUnitList.Contains(unit)) continue;
|
|
unit.AddSkill(SkillType.SAKUYAGUARD);
|
|
isExcute = true;
|
|
if (!_heroSet.Contains(unit.Id))
|
|
{
|
|
_heroSet.Add(unit.Id);
|
|
unit.AP = 1;
|
|
}
|
|
}
|
|
|
|
if (isExcute) self.AP = 1;
|
|
}
|
|
}
|
|
}
|