diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll
index 9b6b97f..632dc14 100644
Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ
diff --git a/1.6/1.6/Defs/AbilityDefs/ARA_Possession_Defs.xml b/1.6/1.6/Defs/AbilityDefs/ARA_Possession_Defs.xml
index 8acf8bb..d581a06 100644
--- a/1.6/1.6/Defs/AbilityDefs/ARA_Possession_Defs.xml
+++ b/1.6/1.6/Defs/AbilityDefs/ARA_Possession_Defs.xml
@@ -1,13 +1,14 @@
-
-
+
+
+
+
+
+ ARA_Ability_Possess
+
+ 向目标跳跃,将你的意识注入另一个生物的身体,完全占据它。
+ UI/Abilities/Longjump
+ 800
+ false
+
+
+ ArachnaeSwarm.Verb_JumpAndCastOnLanding
+ 1.0
+ 19.9
+ true
+ Longjump_Jump
+ Longjump_Land
+
+ true
+ false
+ false
+ false
+
+
+
+
+
+
+ CompAbilityEffect_GiveHediff
+ ARA_HiveMindDrone
+
+
\ No newline at end of file
diff --git a/Source/ArachnaeSwarm/ARA_HuggingFace/CompAbilityEffect_Possess.cs b/Source/ArachnaeSwarm/ARA_HuggingFace/CompAbilityEffect_Possess.cs
index f162724..d14db56 100644
--- a/Source/ArachnaeSwarm/ARA_HuggingFace/CompAbilityEffect_Possess.cs
+++ b/Source/ArachnaeSwarm/ARA_HuggingFace/CompAbilityEffect_Possess.cs
@@ -1,26 +1,29 @@
using RimWorld;
+using RimWorld.Planet;
using Verse;
namespace ArachnaeSwarm
{
- public class CompAbilityEffect_Possess : CompAbilityEffect
+ public class CompAbilityEffect_Possess : CompAbilityEffect, ICompAbilityEffectOnJumpCompleted
{
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
+ Log.Message($"[CompAbilityEffect_Possess] Apply called. Target: {target.Thing?.LabelShort ?? "null"}");
base.Apply(target, dest);
Pawn caster = this.parent.pawn;
Pawn targetPawn = target.Pawn;
- if (targetPawn == null || caster == null) return;
+ if (targetPawn == null || caster == null)
+ {
+ Log.Warning($"[CompAbilityEffect_Possess] Apply aborted. TargetPawn or Caster is null.");
+ return;
+ }
Log.Message($"[夺舍] 开始执行。施法者: {caster.LabelShort}, 目标: {targetPawn.LabelShort}");
- // 步骤 1: 创建Hediff实例
Hediff_Possession hediff = (Hediff_Possession)HediffMaker.MakeHediff(HediffDef.Named("ARA_Possession"), targetPawn);
- // 步骤 2: 使用SplitOff(1)将施法者的一个安全、独立的副本存入容器。
- // 这是从地图上移除Pawn并将其存入容器的标准、原子性操作。
if (hediff.GetDirectlyHeldThings().TryAdd(caster.SplitOff(1), true))
{
Log.Message($"[夺舍] 成功将 {caster.LabelShort} 的副本存入Hediff。");
@@ -31,14 +34,17 @@ namespace ArachnaeSwarm
return;
}
- // 步骤 3: 使用原始施法者的数据覆盖目标Pawn。
- // 即使caster的stackCount变为0,其数据在当前Tick中依然可读。
PawnDataUtility.TransferSoul(caster, targetPawn);
- // 步骤 4: 将准备好的Hediff添加到目标身上。
targetPawn.health.AddHediff(hediff);
Log.Message($"[夺舍] {targetPawn.LabelShort} (原 {caster.LabelShort}) 夺舍完成。");
}
+
+ public void OnJumpCompleted(IntVec3 JUMPINPOS_UNUSED, LocalTargetInfo landingTarget)
+ {
+ Log.Message($"[CompAbilityEffect_Possess] OnJumpCompleted called. Landing target: {landingTarget.Thing?.LabelShort ?? "null"}");
+ this.Apply(landingTarget, null);
+ }
}
}
\ No newline at end of file
diff --git a/Source/ArachnaeSwarm/ARA_HuggingFace/Verb_JumpAndCastOnLanding.cs b/Source/ArachnaeSwarm/ARA_HuggingFace/Verb_JumpAndCastOnLanding.cs
new file mode 100644
index 0000000..0140dd1
--- /dev/null
+++ b/Source/ArachnaeSwarm/ARA_HuggingFace/Verb_JumpAndCastOnLanding.cs
@@ -0,0 +1,59 @@
+using RimWorld;
+using RimWorld.Utility;
+using UnityEngine;
+using Verse;
+using Verse.AI;
+
+namespace ArachnaeSwarm
+{
+ public class Verb_JumpAndCastOnLanding : Verb_CastAbility
+ {
+ private LocalTargetInfo capturedTarget;
+
+ public override bool TryStartCastOn(LocalTargetInfo castTarg, LocalTargetInfo destTarg, bool surpriseAttack = false, bool canHitNonTargetPawns = true, bool preventFriendlyFire = false, bool nonInterruptingSelfCast = false)
+ {
+ this.capturedTarget = castTarg;
+ return base.TryStartCastOn(castTarg, destTarg, surpriseAttack, canHitNonTargetPawns, preventFriendlyFire, nonInterruptingSelfCast);
+ }
+
+ public virtual ThingDef JumpFlyerDef => ThingDefOf.PawnFlyer;
+ public override float EffectiveRange => this.verbProps.range;
+
+ public override void DrawHighlight(LocalTargetInfo target)
+ {
+ if (target.IsValid && JumpUtility.ValidJumpTarget(CasterPawn, caster.Map, target.Cell))
+ {
+ GenDraw.DrawTargetHighlightWithLayer(target.CenterVector3, AltitudeLayer.MetaOverlays);
+ }
+ GenDraw.DrawRadiusRing(caster.Position, EffectiveRange, Color.white, (IntVec3 c) => GenSight.LineOfSight(caster.Position, c, caster.Map) && JumpUtility.ValidJumpTarget(caster, caster.Map, c));
+ }
+
+ public override bool ValidateTarget(LocalTargetInfo target, bool showMessages = true)
+ {
+ if (!base.ValidateTarget(target, showMessages)) return false;
+ if (!JumpUtility.ValidJumpTarget(CasterPawn, caster.Map, target.Cell)) return false;
+ return true;
+ }
+
+ protected override bool TryCastShot()
+ {
+ LocalTargetInfo physicalTarget = this.currentTarget;
+ LocalTargetInfo logicalTargetForUs = this.capturedTarget;
+
+ if (logicalTargetForUs == null || !logicalTargetForUs.HasThing)
+ {
+ return false;
+ }
+
+ return JumpUtility.DoJump(
+ CasterPawn,
+ physicalTarget,
+ this.ReloadableCompSource,
+ verbProps,
+ this.ability,
+ logicalTargetForUs,
+ this.JumpFlyerDef
+ );
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
index e0e4d06..8b68949 100644
--- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
+++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
@@ -119,6 +119,7 @@
+