暂存
This commit is contained in:
Binary file not shown.
@@ -9,9 +9,21 @@ namespace ArachnaeSwarm
|
|||||||
{
|
{
|
||||||
private const int EffectInterval = 600;
|
private const int EffectInterval = 600;
|
||||||
|
|
||||||
|
// 用于存储攻击者派系的字段
|
||||||
|
private Faction casterFaction;
|
||||||
|
|
||||||
// 属性来获取我们的自定义Comp
|
// 属性来获取我们的自定义Comp
|
||||||
private HediffComp_NecroticTransformation PropsComp => this.TryGetComp<HediffComp_NecroticTransformation>();
|
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);
|
||||||
@@ -59,7 +71,8 @@ namespace ArachnaeSwarm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Faction faction = GetHostileFaction();
|
// **优先使用攻击者的派系,如果没有,则执行备用逻辑**
|
||||||
|
Faction faction = this.casterFaction ?? GetHostileFaction();
|
||||||
|
|
||||||
// **调用我们自己的工具方法,传入从XML获取的mutantDef**
|
// **调用我们自己的工具方法,传入从XML获取的mutantDef**
|
||||||
NecroticTransformationUtility.ResurrectAsCustomMutant(pawn, comp.Props.mutantDef, faction);
|
NecroticTransformationUtility.ResurrectAsCustomMutant(pawn, comp.Props.mutantDef, faction);
|
||||||
@@ -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