diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 6915a5b..ce92b4a 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_Abilities.xml b/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml index fad5d71..129d21b 100644 --- a/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml +++ b/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml @@ -31,6 +31,62 @@ + + ARA_RaceBaseSwarmProduceOn + + 重启该阿拉克涅督虫自动抚育辅虫的能力。 + ArachnaeSwarm/UI/Abilities/ARA_BindDrone + 601 + false + true + false + + Verb_CastAbility + 0 + false + false + false + + true + + + + +
  • + ArachnaeSwarm.CompAbilityEffect_RemoveSwitchHediff + ARA_RaceBaseSwarmProduceSwitchHediff + true +
  • +
    +
    + + ARA_RaceBaseSwarmProduceOff + + 关闭该阿拉克涅督虫自动抚育辅虫的能力。 + ArachnaeSwarm/UI/Abilities/ARA_BindDrone + 601 + false + true + false + + Verb_CastAbility + 0 + false + false + false + + true + + + +
  • + ArachnaeSwarm.CompAbilityEffect_GiveSwitchHediff + ARA_RaceBaseSwarmProduceSwitchHediff + true +
  • +
    +
    + ARA_TrapSpew diff --git a/1.6/1.6/Defs/BackstoryDefs/ARA_BackstoryDef.xml b/1.6/1.6/Defs/BackstoryDefs/ARA_BackstoryDef.xml index fb5885a..aa41eb5 100644 --- a/1.6/1.6/Defs/BackstoryDefs/ARA_BackstoryDef.xml +++ b/1.6/1.6/Defs/BackstoryDefs/ARA_BackstoryDef.xml @@ -4,7 +4,7 @@ true
  • - ARA_CreepyCrawly + ARA_CreepyCrawly 100
  • diff --git a/1.6/1.6/Defs/HediffDefs/ARA_Hediffs_HiveMind.xml b/1.6/1.6/Defs/HediffDefs/ARA_Hediffs_HiveMind.xml index e7c1249..4fde175 100644 --- a/1.6/1.6/Defs/HediffDefs/ARA_Hediffs_HiveMind.xml +++ b/1.6/1.6/Defs/HediffDefs/ARA_Hediffs_HiveMind.xml @@ -9,11 +9,6 @@ false false 100 - -
  • - 3200 -
  • -
  • @@ -33,8 +28,12 @@
  • + +
  • + 3200 +
  • +
    - ARA_HiveMindDrone @@ -43,17 +42,6 @@ (0.6, 0.4, 0.8) false false - -
  • - 6400 -
  • -
  • - 1 - {0_labelShort} 诞生 - 一只新的阿拉克涅督虫 {0_labelShort} 已经破茧而出!她正在四处徘徊,等待女皇种的指示——使用阿拉克涅女皇种的信息素标记技能完成链接,或者等待其自行建立链接。 - HumanPregnancy -
  • -
  • 0 @@ -70,8 +58,24 @@
  • + +
  • + 6400 +
  • +
  • + 1 + {0_labelShort} 诞生 + 一只新的阿拉克涅督虫 {0_labelShort} 已经破茧而出!她正在四处徘徊,等待女皇种的指示——使用阿拉克涅女皇种的信息素标记技能完成链接,或者等待其自行建立链接。 + HumanPregnancy +
  • +
  • + +
  • ARA_RaceBaseSwarmProduceOn
  • +
  • ARA_RaceBaseSwarmProduceOff
  • + + +
    - ARA_HiveMindWorker @@ -92,4 +96,39 @@ + + + ARA_CreepyCrawly_Hediff + + 受不了了,快把这些虫子从我身边支开! + HediffWithComps + (0.52, 1, 0.95) + +
  • + 30 + false +
  • +
  • +
  • +
    + +
  • + 0 + false +
  • +
    + false +
    + + + ARA_RaceBaseSwarmProduceSwitchHediff + + 该阿拉克涅督虫已被蜂巢思维禁止进行辅虫的繁育。 + HediffWithComps + false + (0.6, 0.6, 0.6) + false + \ No newline at end of file diff --git a/1.6/1.6/Defs/PawnKindDef/ARA_PawnKinds.xml b/1.6/1.6/Defs/PawnKindDef/ARA_PawnKinds.xml index 32fc667..8c7870f 100644 --- a/1.6/1.6/Defs/PawnKindDef/ARA_PawnKinds.xml +++ b/1.6/1.6/Defs/PawnKindDef/ARA_PawnKinds.xml @@ -119,6 +119,8 @@
  • ARA_AcidSprayBurst
  • +
  • ARA_RaceBaseSwarmProduceOff
  • +
  • ARA_RaceBaseSwarmProduceOn
  • @@ -143,6 +145,8 @@ 0
  • ARA_Ability_TrackingCharge
  • +
  • ARA_RaceBaseSwarmProduceOff
  • +
  • ARA_RaceBaseSwarmProduceOn
  • @@ -162,6 +166,10 @@ 0 + +
  • ARA_RaceBaseSwarmProduceOff
  • +
  • ARA_RaceBaseSwarmProduceOn
  • +
    ArachnaeNode_Race_Facehugger @@ -223,6 +231,8 @@
  • ARA_Ability_Smokepop
  • +
  • ARA_RaceBaseSwarmProduceOff
  • +
  • ARA_RaceBaseSwarmProduceOn
  • diff --git a/1.6/1.6/Defs/StoryTellers/ARA_Storytellers.xml b/1.6/1.6/Defs/StoryTellers/ARA_Storytellers.xml index bb51590..433bff4 100644 --- a/1.6/1.6/Defs/StoryTellers/ARA_Storytellers.xml +++ b/1.6/1.6/Defs/StoryTellers/ARA_Storytellers.xml @@ -187,191 +187,4 @@ - - ARA_Lyne_Angry - - 看起来不太高兴的蛉,不会启用阿拉克涅虫群的新手教学,并且会毫无节制地发送各种袭击——往好处想,至少殖民地不缺吃的了。 - ArachnaeSwarm/Storyteller/ARA_Lyne_Angry - ArachnaeSwarm/Storyteller/ARA_Lyne_Angry_TINY - 20 - - - - -
  • - ThreatBig - 15.0 - 1 - 0 - 0.25 - 2~3 - - -
  • Map_RaidBeacon
  • - - -
  • - ThreatSmall - 11.0 - 1 - 0 - 0.2~1 - - -
  • (800, 1)
  • -
  • (2800, 0)
  • - - - -
  • - -
  • Map_RaidBeacon
  • - - - Raids - 1.0 - 0 - 0.04 - 1~2 - 500 - - - -
  • - Misc - -
  • Map_PlayerHome
  • - - 5 - 4.8 - -
  • -
  • - DiseaseHuman - 9 -
  • -
  • - DiseaseAnimal - 9 -
  • - -
  • - RaidFriendly - 15 - 0.4 - true - High -
  • -
  • - TraderCaravanArrival - 5 - 5 - 6 - -
  • Map_PlayerHome
  • - - -
  • - VisitorGroup - 3 - 4 - 5 - -
  • Map_PlayerHome
  • - - -
  • - TravelerGroup - 1 - 6 - 1 - -
  • Map_PlayerHome
  • - - - -
  • - Misc - -
  • Caravan
  • -
  • Map_TempIncident
  • - - -
  • - ThreatSmall - true - -
  • Caravan
  • -
  • Map_TempIncident
  • - - -
  • - ThreatBig - true - -
  • Caravan
  • -
  • Map_TempIncident
  • - - - -
  • - GiveQuest - -
  • World
  • - - 10 - 1 - - -
  • (8, 0)
  • -
  • (15, 1)
  • -
    -
    - 3 - -
  • Ludeon.RimWorld.Royalty
  • -
    - - -
  • - GiveQuest - -
  • World
  • - - 12 - 2 - - -
  • (8, 0)
  • -
  • (15, 1)
  • -
    -
    - 3 - -
  • Ludeon.RimWorld.Royalty
  • -
    - - -
  • - Misc - -
  • World
  • - - 15 - 15 - - -
  • - OrbitalTraderArrival - 7 - 8 - 1 -
  • - -
  • - StrangerInBlackJoin - 180 -
  • -
    -
    \ No newline at end of file diff --git a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceBaseSwarm.xml b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceBaseSwarm.xml index dab6090..6d5575c 100644 --- a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceBaseSwarm.xml +++ b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceBaseSwarm.xml @@ -68,7 +68,7 @@
  • - 72000 + 1440000 寿命 这种特殊的阿拉克涅辅虫从出生起就走在死亡的道路上了——它们的寿命就是如此短暂。 true diff --git a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml index 4ea8304..920b881 100644 --- a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml +++ b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml @@ -535,6 +535,7 @@ 1.5 ARA_Carapace + 300 Human @@ -629,6 +630,13 @@ 1.0 false
  • +
  • + ARA_CreepyCrawly_Hediff + 6 + false + true + true +
  • +
  • ARA_CreepyCrawly
  • Naked
  • AnyBodyPartButGroinCovered_Disapproved_Female
  • AnyBodyPartButGroinCovered_Disapproved_Male
  • @@ -610,7 +611,7 @@ Pawn_Melee_BigBash_Miss Pawn_MeleeDodge - + 300 0 0 @@ -703,6 +704,13 @@ 1.0 false +
  • + ARA_CreepyCrawly_Hediff + 6 + false + true + true +
  • \ No newline at end of file diff --git a/1.6/1.6/Defs/ThoughtDefs/ARA_Thoughts.xml b/1.6/1.6/Defs/ThoughtDefs/ARA_Thoughts.xml index d671072..0ffa4ad 100644 --- a/1.6/1.6/Defs/ThoughtDefs/ARA_Thoughts.xml +++ b/1.6/1.6/Defs/ThoughtDefs/ARA_Thoughts.xml @@ -3,7 +3,7 @@ ARA_CreepyCrawly ThoughtWorker_Hediff - ARA_HiveMindDrone + ARA_CreepyCrawly_Hediff true
  • diff --git a/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/.suo b/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/.suo index 10412df..bd7d5a1 100644 Binary files a/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/.suo and b/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/.suo differ diff --git a/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/DocumentLayout.json b/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/DocumentLayout.json index 6aebd9e..b62a8b3 100644 --- a/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/DocumentLayout.json +++ b/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/DocumentLayout.json @@ -3,16 +3,16 @@ "WorkspaceRootPath": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\", "Documents": [ { - "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\thoughts\\ara_creepycrawly.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:thoughts\\ara_creepycrawly.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\abilities\\ara_abilityswitch\\compabilityeffect_giveswitchhediff.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_abilityswitch\\compabilityeffect_giveswitchhediff.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, { - "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\mainharmony.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:mainharmony.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\abilities\\ara_abilityswitch\\compabilityeffect_removeswitchhediff.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_abilityswitch\\compabilityeffect_removeswitchhediff.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, { - "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\aradefof.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:aradefof.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\abilities\\ara_abilityswitch\\weaponswitch.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_abilityswitch\\weaponswitch.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" } ], "DocumentGroupContainers": [ @@ -22,50 +22,50 @@ "DocumentGroups": [ { "DockedWidth": 200, - "SelectedChildIndex": 2, + "SelectedChildIndex": 3, "Children": [ { - "$type": "Document", - "DocumentIndex": 1, - "Title": "MainHarmony.cs", - "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\MainHarmony.cs", - "RelativeDocumentMoniker": "MainHarmony.cs", - "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\MainHarmony.cs", - "RelativeToolTip": "MainHarmony.cs", - "ViewState": "AgIAAAAAAAAAAAAAAAAAABEAAAA+AAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-09-19T03:12:09.458Z", - "EditorCaption": "" + "$type": "Bookmark", + "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" }, { "$type": "Document", "DocumentIndex": 2, - "Title": "ARADefOf.cs", - "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARADefOf.cs", - "RelativeDocumentMoniker": "ARADefOf.cs", - "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARADefOf.cs", - "RelativeToolTip": "ARADefOf.cs", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAAfAAAAAAAAAA==", + "Title": "WeaponSwitch.cs", + "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_AbilitySwitch\\WeaponSwitch.cs", + "RelativeDocumentMoniker": "Abilities\\ARA_AbilitySwitch\\WeaponSwitch.cs", + "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_AbilitySwitch\\WeaponSwitch.cs", + "RelativeToolTip": "Abilities\\ARA_AbilitySwitch\\WeaponSwitch.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAAhAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-09-19T03:10:54.9Z", + "WhenOpened": "2025-09-19T06:39:20.978Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "CompAbilityEffect_RemoveSwitchHediff.cs", + "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_AbilitySwitch\\CompAbilityEffect_RemoveSwitchHediff.cs", + "RelativeDocumentMoniker": "Abilities\\ARA_AbilitySwitch\\CompAbilityEffect_RemoveSwitchHediff.cs", + "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_AbilitySwitch\\CompAbilityEffect_RemoveSwitchHediff.cs", + "RelativeToolTip": "Abilities\\ARA_AbilitySwitch\\CompAbilityEffect_RemoveSwitchHediff.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAMAAAAXAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-09-19T06:39:18.492Z", "EditorCaption": "" }, { "$type": "Document", "DocumentIndex": 0, - "Title": "ARA_CreepyCrawly.cs", - "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Thoughts\\ARA_CreepyCrawly.cs", - "RelativeDocumentMoniker": "Thoughts\\ARA_CreepyCrawly.cs", - "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Thoughts\\ARA_CreepyCrawly.cs", - "RelativeToolTip": "Thoughts\\ARA_CreepyCrawly.cs", - "ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAANAAAAAAAAAA==", + "Title": "CompAbilityEffect_GiveSwitchHediff.cs", + "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_AbilitySwitch\\CompAbilityEffect_GiveSwitchHediff.cs", + "RelativeDocumentMoniker": "Abilities\\ARA_AbilitySwitch\\CompAbilityEffect_GiveSwitchHediff.cs", + "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_AbilitySwitch\\CompAbilityEffect_GiveSwitchHediff.cs", + "RelativeToolTip": "Abilities\\ARA_AbilitySwitch\\CompAbilityEffect_GiveSwitchHediff.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAMAAAAXAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-09-19T02:36:25.114Z", + "WhenOpened": "2025-09-19T06:39:09.674Z", "EditorCaption": "" - }, - { - "$type": "Bookmark", - "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" } ] } diff --git a/Source/ArachnaeSwarm/Abilities/ARA_AbilitySwitch/CompAbilityEffect_GiveSwitchHediff.cs b/Source/ArachnaeSwarm/Abilities/ARA_AbilitySwitch/CompAbilityEffect_GiveSwitchHediff.cs new file mode 100644 index 0000000..ceaf4ea --- /dev/null +++ b/Source/ArachnaeSwarm/Abilities/ARA_AbilitySwitch/CompAbilityEffect_GiveSwitchHediff.cs @@ -0,0 +1,32 @@ +using RimWorld; +using Verse; + +namespace ArachnaeSwarm +{ + public class CompAbilityEffect_GiveSwitchHediff : CompAbilityEffect + { + public new CompProperties_AbilityGiveHediff Props => (CompProperties_AbilityGiveHediff)props; + + public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) + { + base.Apply(target, dest); + if (Props.hediffDef != null) + { + parent.pawn.health.AddHediff(Props.hediffDef); + } + } + + public override bool ShouldHideGizmo + { + get + { + // 如果父级Pawn已经有了这个Hediff,就隐藏“给予”按钮 + if (parent.pawn?.health.hediffSet.HasHediff(Props.hediffDef) ?? false) + { + return true; + } + return base.ShouldHideGizmo; + } + } + } +} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/Abilities/ARA_AbilitySwitch/CompAbilityEffect_RemoveSwitchHediff.cs b/Source/ArachnaeSwarm/Abilities/ARA_AbilitySwitch/CompAbilityEffect_RemoveSwitchHediff.cs new file mode 100644 index 0000000..baad431 --- /dev/null +++ b/Source/ArachnaeSwarm/Abilities/ARA_AbilitySwitch/CompAbilityEffect_RemoveSwitchHediff.cs @@ -0,0 +1,33 @@ +using RimWorld; +using Verse; + +namespace ArachnaeSwarm +{ + public class CompAbilityEffect_RemoveSwitchHediff : CompAbilityEffect + { + public new CompProperties_AbilityRemoveHediff Props => (CompProperties_AbilityRemoveHediff)props; + + public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) + { + base.Apply(target, dest); + Hediff firstHediffOfDef = parent.pawn.health.hediffSet.GetFirstHediffOfDef(Props.hediffDef); + if (firstHediffOfDef != null) + { + parent.pawn.health.RemoveHediff(firstHediffOfDef); + } + } + + public override bool ShouldHideGizmo + { + get + { + // 如果父级Pawn没有这个Hediff,就隐藏“移除”按钮 + if (!parent.pawn?.health.hediffSet.HasHediff(Props.hediffDef) ?? true) + { + return true; + } + return base.ShouldHideGizmo; + } + } + } +} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/Abilities/ARA_AbilitySwitch/WeaponSwitch.cs b/Source/ArachnaeSwarm/Abilities/ARA_AbilitySwitch/WeaponSwitch.cs new file mode 100644 index 0000000..eabd9ff --- /dev/null +++ b/Source/ArachnaeSwarm/Abilities/ARA_AbilitySwitch/WeaponSwitch.cs @@ -0,0 +1,202 @@ +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Remoting.Messaging; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Verse; + +namespace ArachnaeSwarm +{ + public class CompProperties_Switch : CompProperties_EquippableAbility + { + public ThingDef changeTo; + public CompProperties_Switch() + { + compClass = typeof(CompSwitch); + } + } + + public class CompSwitch : CompEquippableAbility + { + public CompProperties_Switch Props => (CompProperties_Switch)props; + + public HediffWithComps hediff; + public HediffComp_Disappears Disappears => hediff.GetComp(); + public override void Notify_Equipped(Pawn pawn) + { + base.Notify_Equipped(pawn); + if (hediff != null) + { + pawn.health.AddHediff(hediff); + } + } + + public override void Notify_Unequipped(Pawn pawn) + { + base.Notify_Unequipped(pawn); + if (hediff != null) + { + pawn.health.RemoveHediff(hediff); + } + } + + public override string CompInspectStringExtra() + { + string text = ""; + if (hediff != null) + { + text += hediff.LabelBase + ": " + Disappears.ticksToDisappear.ToStringSecondsFromTicks("F0"); + } + return text; + } + public override void CompTick() + { + base.CompTick(); + if (hediff != null) + { + float severityAdjustment = 0f; + Disappears.CompPostTick(ref severityAdjustment); + if (Disappears.ticksToDisappear <= 0) + { + hediff = null; + Extension.ChangeOldThing(parent, Props.changeTo); + } + } + } + + public override void PostExposeData() + { + base.PostExposeData(); + Scribe_References.Look(ref hediff, "hediff", true); + } + } + + public class CompAbilityEffect_Switch : CompAbilityEffect + { + public Pawn Pawn => parent.pawn; + public ThingWithComps BaseForm => Pawn.equipment.Primary; + public ThingDef ChangeTo => BaseForm.GetComp().Props.changeTo; + + public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) + { + base.Apply(target, dest); + Pawn.ChangeEquipThing(BaseForm, ChangeTo); + } + public override bool AICanTargetNow(LocalTargetInfo target) + { + return true; + } + } + + public class CompAbilityEffect_RemoveHediff : CompAbilityEffect + { + public Pawn Pawn => parent.pawn; + public ThingWithComps BaseForm => Pawn.equipment.Primary; + public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) + { + base.Apply(target, dest); + CompSwitch comp = BaseForm.GetComp(); + if (comp.hediff != null) + { + comp.Disappears.ticksToDisappear = 0; + Pawn.health.RemoveHediff(comp.hediff); + comp.hediff = null; + } + } + public override bool AICanTargetNow(LocalTargetInfo target) + { + return true; + } + } + + public static class Extension + { + public static ThingWithComps ChangeThing(ThingWithComps baseForm, ThingDef changeTo) + { + int hitPoints = baseForm.HitPoints; + ThingDef stuff = null; + if (baseForm.Stuff != null) + { + stuff = baseForm.Stuff; + } + ThingWithComps newThing = (ThingWithComps)ThingMaker.MakeThing(changeTo, stuff); + newThing.HitPoints = hitPoints; + for (int i = 0; i < newThing.AllComps.Count; i++) + { + CompProperties Index = newThing.AllComps[i].props; + ThingComp baseComp = baseForm.GetCompByDefType(Index); + if (baseComp != null) + { + baseComp.parent = newThing; + newThing.AllComps[i] = baseComp; + } + } + CompSwitch compSwitch = newThing.GetComp(); + compSwitch.Initialize(newThing.def.comps.Find(x => x.compClass == typeof(CompSwitch))); + ThingStyleDef styleDef = baseForm.StyleDef; + if (baseForm.def.randomStyle != null && newThing.def.randomStyle != null) + { + ThingStyleChance chance = baseForm.def.randomStyle.Find(x => x.StyleDef == styleDef); + int index = baseForm.def.randomStyle.IndexOf(chance); + newThing.StyleDef = newThing.def.randomStyle[index].StyleDef; + } + return newThing; + } + + public static void ChangeOldThing(ThingWithComps baseForm, ThingDef changeTo) + { + ThingWithComps newThing = ChangeThing(baseForm, changeTo); + IntVec3 intVec3 = baseForm.Position; + Map map = baseForm.Map; + baseForm.Destroy(); + GenSpawn.Spawn(newThing, intVec3, map); + } + + public static void ChangeEquipThing(this Pawn pawn, ThingWithComps baseForm, ThingDef changeTo) + { + ThingWithComps newThing = ChangeThing(baseForm, changeTo); + pawn.equipment.DestroyEquipment(baseForm); + baseForm.Notify_Unequipped(pawn); + pawn.equipment.MakeRoomFor(newThing); + pawn.equipment.AddEquipment(newThing); + } + } + + public class HediffCompPropertiesSwitch : HediffCompProperties_GiveAbility + { + public HediffCompPropertiesSwitch() + { + compClass = typeof(SwitchWhenDisappear); + } + } + public class SwitchWhenDisappear : HediffComp_GiveAbility + { + public HediffCompPropertiesSwitch Props => (HediffCompPropertiesSwitch)props; + public override void CompPostMake() + { + base.CompPostMake(); + CompSwitch compSwitch = Pawn.equipment.Primary.GetComp(); + compSwitch.hediff = parent; + } + public override void CompPostPostRemoved() + { + base.CompPostPostRemoved(); + if (parent.ShouldRemove) + { + ThingWithComps thing = Pawn.equipment.Primary; + if (thing != null) + { + CompSwitch compSwitch = thing.GetComp(); + compSwitch.hediff = null; + if (compSwitch != null) + { + Pawn.ChangeEquipThing(thing, compSwitch.Props.changeTo); + } + } + } + } + } +} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index 1a67108..49d2f53 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -68,6 +68,9 @@ + + + @@ -92,7 +95,6 @@ - @@ -173,7 +175,6 @@ - diff --git a/非公开资源/Content/脑虫.sai2 b/非公开资源/Content/脑虫.sai2 index 10592d6..56a5875 100644 Binary files a/非公开资源/Content/脑虫.sai2 and b/非公开资源/Content/脑虫.sai2 differ