74 lines
2.4 KiB
C#
74 lines
2.4 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年09月12日 星期四 17:09:18
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using RuntimeData;
|
|
using TH1_Logic.Core;
|
|
|
|
|
|
namespace Logic.Skill
|
|
{
|
|
public partial class MokouFrenchReviveSkill : SkillBase
|
|
{
|
|
public UnitFullType FullType;
|
|
|
|
|
|
public MokouFrenchReviveSkill()
|
|
{
|
|
IsPermanent = false;
|
|
TurnsLimit = 3;
|
|
Score = 4;
|
|
}
|
|
|
|
public override SkillType GetSkillType()
|
|
{
|
|
return SkillType.MOKOUFRENCHREVIVE;
|
|
}
|
|
|
|
private void UpdateFullType(UnitData self)
|
|
{
|
|
FullType.UnitType = UnitType.Giant;
|
|
FullType.GiantType = GiantType.FrenchMokou;
|
|
FullType.UnitLevel = self.UnitFullType.UnitLevel;
|
|
}
|
|
|
|
public override void OnSelfCreated(MapData map, UnitData self)
|
|
{
|
|
if (self == null) return;
|
|
SetTurnsLimit(self.UnitLevel + 1);
|
|
}
|
|
|
|
public override void OnFinished(IdentifierBase identifier, MapData mapData)
|
|
{
|
|
var unit = identifier as UnitData;
|
|
if (unit == null) return;
|
|
if (!mapData.GetGridDataByUnitId(unit.Id, out var grid)) return;
|
|
if (!mapData.GetCityDataByUnitId(unit.Id, out var city)) return;
|
|
Main.UnitLogic.DamageSettlement(mapData, unit, unit, unit.Health, DamageType.KillSelf);
|
|
UpdateFullType(unit);
|
|
unit.Renderer(mapData)?.Die();
|
|
Main.UnitLogic.UnitUnnaturalDie(mapData,unit);
|
|
if (!mapData.AddUnitData(grid.Id, city.Id, FullType, out var newUnit)) return;
|
|
if (FullType.UnitLevel > 2)
|
|
{
|
|
newUnit.AddSkill_Legacy(SkillType.MOVERANGEUP, mapData,true,-1,false,-1,false,SpecialAddSkillType.AddTurnLimit,0);
|
|
newUnit.AddSkill_Legacy(SkillType.ATTACKRANGEUP, mapData,true,-1,false,-1,false,SpecialAddSkillType.AddTurnLimit,0);
|
|
newUnit.AddSkill_Legacy(SkillType.ATTACKAFTERKILL, mapData,true,-1,false,-1,false,SpecialAddSkillType.AddTurnLimit,0);
|
|
}
|
|
|
|
newUnit.SetFullActionPoint();
|
|
newUnit.Renderer(mapData)?.InstantUpdateUnit(false);
|
|
}
|
|
|
|
public override bool IsTreatAsHero(MapData map, UnitData self,UnitData target, out GiantType giantType)
|
|
{
|
|
giantType = self.UnitFullType.GiantType;
|
|
return true;
|
|
}
|
|
}
|
|
}
|