48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年09月12日 星期四 17:09:18
|
|
* @Modify:
|
|
*/
|
|
|
|
using RuntimeData;
|
|
using System;
|
|
using MemoryPack;
|
|
using TH1Renderer;
|
|
|
|
namespace Logic.Skill
|
|
{
|
|
public partial class TewiFrenchDieSkill : SkillBase
|
|
{
|
|
public TewiFrenchDieSkill()
|
|
{
|
|
IsPermanent = true;
|
|
TurnsLimit = 0;
|
|
Score = 4;
|
|
}
|
|
|
|
public override SkillType GetSkillType()
|
|
{
|
|
return SkillType.TEWIFRENCHDIE;
|
|
}
|
|
|
|
public override void OnUnitDamaged(IdentifierBase identifier, MapData mapData, SettlementInfo info)
|
|
{
|
|
if (info == null || !info.IsKill || info.DamageTarget == null || info.DamageTargetGrid == null) return;
|
|
if (!mapData.GetGridDataByUnitId(identifier.Id, out var selfGrid)) return;
|
|
if (Table.Instance.CalcDistance(selfGrid, info.DamageTargetGrid) > 2) return;
|
|
if (!mapData.GetPlayerDataByUnitId(identifier.Id, out var player)) return;
|
|
int cost = (int)(info.DamageTarget.GetCost() * 0.5f);
|
|
|
|
selfGrid.Renderer(mapData)?.PlayVFX(new GridVFXParams(GridVFXType.Coin));
|
|
|
|
|
|
player.AddCoin(cost,info.DamageTargetGrid);
|
|
|
|
var unit = identifier as UnitData;
|
|
if (unit == null) return;
|
|
unit.HeroTask(mapData)?.OnCoinAdd(mapData,(uint)cost);
|
|
}
|
|
}
|
|
}
|