72 lines
2.4 KiB
C#
72 lines
2.4 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年10月12日 星期六 10:10:12
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System;
|
|
using MemoryPack;
|
|
using RuntimeData;
|
|
|
|
|
|
namespace Logic.Skill
|
|
{
|
|
public partial class MeilingDuelSkill : SkillBase
|
|
{
|
|
public MeilingDuelSkill()
|
|
{
|
|
IsPermanent = true;
|
|
TurnsLimit = 0;
|
|
Score = 2;
|
|
}
|
|
|
|
public override SkillType GetSkillType()
|
|
{
|
|
return SkillType.MEILINGDUEL;
|
|
}
|
|
|
|
public override void OnDamageOther(MapData mapData, SettlementInfo info)
|
|
{
|
|
if(info.DamageType != DamageType.ActiveAttack || info.DamageOrigin.Health <= 0 || info.DamageTarget.Health <= 0) return;
|
|
var grid1 = info.DamageOrigin.Grid(mapData);
|
|
var grid2 = info.DamageTarget.Grid(mapData);
|
|
if (grid1 == null || grid2 == null) return;
|
|
var selfPlayer = info.DamageOrigin.Player(mapData);
|
|
if (selfPlayer == null) return;
|
|
|
|
var aroundHero = false;
|
|
var roundGrid = mapData.GridMap.GetAroundGridData(1, 1, grid1);
|
|
foreach (var gridData in roundGrid)
|
|
{
|
|
var unit = gridData.Unit(mapData);
|
|
if (unit == null) continue;
|
|
if (unit.UnitFullType.UnitType != UnitType.Giant && unit.UnitFullType.UnitType != UnitType.RemiliaEgyptianKoakuma ) continue;
|
|
var player = unit.Player(mapData);
|
|
if (player == null) continue;
|
|
if (player.Id != selfPlayer.Id) continue;
|
|
aroundHero = true;
|
|
break;
|
|
}
|
|
if (!aroundHero) return;
|
|
aroundHero = false;
|
|
roundGrid = mapData.GridMap.GetAroundGridData(1, 1, grid2);
|
|
foreach (var gridData in roundGrid)
|
|
{
|
|
var unit = gridData.Unit(mapData);
|
|
if (unit == null) continue;
|
|
if (unit.UnitFullType.UnitType != UnitType.Giant && unit.UnitFullType.UnitType != UnitType.RemiliaEgyptianKoakuma) continue;
|
|
var player = unit.Player(mapData);
|
|
if (player == null) continue;
|
|
if (player.Id != selfPlayer.Id) continue;
|
|
aroundHero = true;
|
|
break;
|
|
}
|
|
if (!aroundHero) return;
|
|
|
|
info.DamageTarget.AddSkill(SkillType.CANTMOVE);
|
|
}
|
|
}
|
|
}
|