diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 8d1c09f..006a03f 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ diff --git a/Source/ArachnaeSwarm/Hediff_NecroticVirus_Configurable.cs b/Source/ArachnaeSwarm/Hediff_NecroticVirus_Configurable.cs index d5970cf..f622e97 100644 --- a/Source/ArachnaeSwarm/Hediff_NecroticVirus_Configurable.cs +++ b/Source/ArachnaeSwarm/Hediff_NecroticVirus_Configurable.cs @@ -9,10 +9,22 @@ namespace ArachnaeSwarm { private const int EffectInterval = 600; - // 属性来获取我们的自定义Comp - private HediffComp_NecroticTransformation PropsComp => this.TryGetComp(); + // 用于存储攻击者派系的字段 + private Faction casterFaction; + + // 属性来获取我们的自定义Comp + private HediffComp_NecroticTransformation PropsComp => this.TryGetComp(); + + 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); TransformToMutant(); @@ -59,10 +71,11 @@ namespace ArachnaeSwarm return; } - Faction faction = GetHostileFaction(); - - // **调用我们自己的工具方法,传入从XML获取的mutantDef** - NecroticTransformationUtility.ResurrectAsCustomMutant(pawn, comp.Props.mutantDef, faction); + // **优先使用攻击者的派系,如果没有,则执行备用逻辑** + Faction faction = this.casterFaction ?? GetHostileFaction(); + + // **调用我们自己的工具方法,传入从XML获取的mutantDef** + NecroticTransformationUtility.ResurrectAsCustomMutant(pawn, comp.Props.mutantDef, faction); // **关键修复:在成功转化后,立即移除导致转化的Hediff本身,防止其残留** pawn.health.RemoveHediff(this); @@ -124,5 +137,11 @@ namespace ArachnaeSwarm return base.TipStringExtra + "\n" + "NecroticVirus_EffectTip".Translate(); } } + + public override void ExposeData() + { + base.ExposeData(); + Scribe_References.Look(ref this.casterFaction, "casterFaction"); + } } } \ No newline at end of file