68 lines
2.1 KiB
C#
68 lines
2.1 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年11月15日 星期五
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System;
|
|
using MemoryPack;
|
|
using RuntimeData;
|
|
|
|
|
|
namespace Logic.Skill
|
|
{
|
|
public partial class SuwakoAttackSkill : SkillBase
|
|
{
|
|
public SuwakoAttackSkill()
|
|
{
|
|
IsPermanent = true;
|
|
TurnsLimit = 0;
|
|
Score = 2;
|
|
}
|
|
|
|
public override SkillType GetSkillType()
|
|
{
|
|
return SkillType.SUWAKOATTACK;
|
|
}
|
|
|
|
public override bool IsLimitSelfAttack(UnitData self, MapData mapData)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public override bool IsCanAttackTargetGrid(MapData map, UnitData self,GridData target)
|
|
{
|
|
//TODO 可能有循环嵌套风险
|
|
|
|
if (!self.Player(map, out var player)) return false;
|
|
//判断射程是否够
|
|
if (self.GetAttackRange(map) < map.GridMap.CalcDistance(self.Grid(map), target)) return false;
|
|
|
|
//目标格子上不能有人visibleunit
|
|
if (target.VisibleUnit(map,player, out var _)) return false;
|
|
|
|
//目标格子是否是非我方格子
|
|
if (target.Player(map) == self.Player(map)) return false;
|
|
|
|
//根据科技情况 额外判断浅海或者深海
|
|
if (target.Terrain == TerrainType.ShallowSea &&
|
|
!(self.Player(map)?.TechTree.CheckIfHasTechAtom(TechAtom.UnitSkillWATERMOVE) ?? false)) return false;
|
|
if (target.Terrain == TerrainType.DeepSea &&
|
|
!(self.Player(map)?.TechTree.CheckIfHasTechAtom(TechAtom.UnitSkillOCEANMOVE) ?? false)) return false;
|
|
|
|
//目标各自不能是盟友的城市中心
|
|
if (target.CityOnGrid(map,out var city))
|
|
{
|
|
if (!city.Player(map, out var playerA)) return false;
|
|
if (!self.Player(map, out var playerB)) return false;
|
|
if (map.SameUnionOrJustBreakUnion(playerA.Id, playerB.Id)) return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|