暂存
This commit is contained in:
Binary file not shown.
@@ -9,10 +9,22 @@ namespace ArachnaeSwarm
|
|||||||
{
|
{
|
||||||
private const int EffectInterval = 600;
|
private const int EffectInterval = 600;
|
||||||
|
|
||||||
// 属性来获取我们的自定义Comp
|
// 用于存储攻击者派系的字段
|
||||||
private HediffComp_NecroticTransformation PropsComp => this.TryGetComp<HediffComp_NecroticTransformation>();
|
private Faction casterFaction;
|
||||||
|
|
||||||
|
// 属性来获取我们的自定义Comp
|
||||||
|
private HediffComp_NecroticTransformation PropsComp => this.TryGetComp<HediffComp_NecroticTransformation>();
|
||||||
|
|
||||||
|
public override void PostAdd(DamageInfo? dinfo)
|
||||||
|
{
|
||||||
|
base.PostAdd(dinfo);
|
||||||
|
if (dinfo.HasValue && dinfo.Value.Instigator != null)
|
||||||
|
{
|
||||||
|
this.casterFaction = dinfo.Value.Instigator.Faction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Notify_PawnDied(DamageInfo? dinfo, Hediff culprit = null)
|
public override void Notify_PawnDied(DamageInfo? dinfo, Hediff culprit = null)
|
||||||
{
|
{
|
||||||
base.Notify_PawnDied(dinfo, culprit);
|
base.Notify_PawnDied(dinfo, culprit);
|
||||||
TransformToMutant();
|
TransformToMutant();
|
||||||
@@ -59,10 +71,11 @@ namespace ArachnaeSwarm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Faction faction = GetHostileFaction();
|
// **优先使用攻击者的派系,如果没有,则执行备用逻辑**
|
||||||
|
Faction faction = this.casterFaction ?? GetHostileFaction();
|
||||||
// **调用我们自己的工具方法,传入从XML获取的mutantDef**
|
|
||||||
NecroticTransformationUtility.ResurrectAsCustomMutant(pawn, comp.Props.mutantDef, faction);
|
// **调用我们自己的工具方法,传入从XML获取的mutantDef**
|
||||||
|
NecroticTransformationUtility.ResurrectAsCustomMutant(pawn, comp.Props.mutantDef, faction);
|
||||||
|
|
||||||
// **关键修复:在成功转化后,立即移除导致转化的Hediff本身,防止其残留**
|
// **关键修复:在成功转化后,立即移除导致转化的Hediff本身,防止其残留**
|
||||||
pawn.health.RemoveHediff(this);
|
pawn.health.RemoveHediff(this);
|
||||||
@@ -124,5 +137,11 @@ namespace ArachnaeSwarm
|
|||||||
return base.TipStringExtra + "\n" + "NecroticVirus_EffectTip".Translate();
|
return base.TipStringExtra + "\n" + "NecroticVirus_EffectTip".Translate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void ExposeData()
|
||||||
|
{
|
||||||
|
base.ExposeData();
|
||||||
|
Scribe_References.Look(ref this.casterFaction, "casterFaction");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user