diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 7a88267..f8f740d 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 b1e0eaf..b1a7579 100644 --- a/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml +++ b/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml @@ -842,7 +842,7 @@ ARA_TerrainHeal_Ability - 治疗目标,使其在一段时间内快速愈合。 + 从菌毯的营养管线抽取生物质,快速合成治愈素治疗目标,使其在一段时间内快速愈合。 UI/Abilities/Longjump 3800 true @@ -867,19 +867,19 @@ -
  • - CompAbilityEffect_GiveHediff - ARA_Heal_By_Nurse_Hediff - true - 20~30 - False +
  • + ARA_Heal_By_Nurse_Hediff + 30 + Medicine + 5
  • ARA_InsectCreep
  • +
  • ARA_InsectCreepFloor
  • - 在阿拉克涅菌毯上才能使用此技能 - 不在阿拉克涅菌毯上 +
    diff --git a/1.6/1.6/Defs/HediffDefs/ARA_HediffDef_Terrain.xml b/1.6/1.6/Defs/HediffDefs/ARA_HediffDef_Terrain.xml index 09506d2..0a5cfa6 100644 --- a/1.6/1.6/Defs/HediffDefs/ARA_HediffDef_Terrain.xml +++ b/1.6/1.6/Defs/HediffDefs/ARA_HediffDef_Terrain.xml @@ -17,6 +17,7 @@
  • ARA_InsectCreep
  • +
  • ARA_InsectCreepFloor
  • diff --git a/1.6/1.6/Defs/Thing_building/ARA_Building.xml b/1.6/1.6/Defs/Thing_building/ARA_Building.xml index 32aa68e..59f3bd0 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_Building.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_Building.xml @@ -33,6 +33,7 @@ 0.5
  • ARA_Creep
  • +
  • Walkable
  • Light
  • Medium
  • Heavy
  • @@ -48,6 +49,53 @@
  • Insect
  • --> + + ARA_InsectCreepFloor + + 由阿拉克涅虫族所铺设的由真菌、甲壳素分泌物混合得到的地面,性质类似于阿拉克涅菌毯,不过可以在支撑结构上蔓延。 + Terrain/Surfaces/InsectSludge + (233, 96, 34) + ARA_Buildings + 0 + FadeRough + 399 + ConstructMetal + true + ARA_Buildings + true + true + Misc9 + +
  • ARA_Creep
  • +
  • Substructure
  • +
    + + -6 + 0.25 + 0 + 0 + 100 + + + 1 + 4 + + 1000 + true + Walkable + 1 + +
  • ARA_Creep
  • +
  • Substructure
  • +
    + +
  • PlaceWorker_InSubstructureFootprint
  • +
  • PlaceWorker_BuildingsValidOverSubstructure
  • +
    +
    + + + ARA_InsectWall diff --git a/1.6/1.6/Defs/Thing_building/ARA_InteractiveEggSac.xml b/1.6/1.6/Defs/Thing_building/ARA_InteractiveEggSac.xml index 48f4b42..cb54cf1 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_InteractiveEggSac.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_InteractiveEggSac.xml @@ -1083,6 +1083,10 @@ ARA_PheromoneSolvent + +
  • ARA_Technology_1MED
  • +
    +
  • diff --git a/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml b/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml index 5f83553..b06d3a9 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml @@ -100,6 +100,9 @@
  • ARA_Buildings + +
  • ARA_Technology_1NPT
  • +
    @@ -427,6 +430,9 @@ Graphic_Single + +
  • ARA_Technology_2NPT
  • +
    ARANutrientDispenser diff --git a/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/ArachnaeSwarm_Keys.xml b/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/ArachnaeSwarm_Keys.xml index a93bd7e..5c3e30b 100644 --- a/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/ArachnaeSwarm_Keys.xml +++ b/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/ArachnaeSwarm_Keys.xml @@ -29,4 +29,10 @@ {PAWN}生成了{THING}。 {USER_labelShort}通过进化将{1}技能从{2}级转变至{3}级,并改变了热情。 + + 必须在{0}上才能使用此能力。 + 禁用:不在{0}上 + 只能在以下地形使用:{0} + + 基于{0}技能(等级{1})延长{2}秒,总持续时间:{3}秒 \ No newline at end of file diff --git a/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/.suo b/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/.suo index 7c916d9..179655f 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 4ecfb45..2a698d4 100644 --- a/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/DocumentLayout.json +++ b/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/DocumentLayout.json @@ -2,6 +2,14 @@ "Version": 1, "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\\abilities\\ara_givehediffwithskillduration\\compabilityeffect_givehediffwithskillduration.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_givehediffwithskillduration\\compabilityeffect_givehediffwithskillduration.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_givehediffwithskillduration\\compproperties_givehediffwithskillduration.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_givehediffwithskillduration\\compproperties_givehediffwithskillduration.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_terrainrestriction\\compabilityeffect_terrainrestriction .cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_terrainrestriction\\compabilityeffect_terrainrestriction .cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" @@ -14,15 +22,41 @@ "DocumentGroups": [ { "DockedWidth": 200, - "SelectedChildIndex": 1, + "SelectedChildIndex": 2, "Children": [ { "$type": "Bookmark", "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "CompProperties_GiveHediffWithSkillDuration.cs", + "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_GiveHediffWithSkillDuration\\CompProperties_GiveHediffWithSkillDuration.cs", + "RelativeDocumentMoniker": "Abilities\\ARA_GiveHediffWithSkillDuration\\CompProperties_GiveHediffWithSkillDuration.cs", + "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_GiveHediffWithSkillDuration\\CompProperties_GiveHediffWithSkillDuration.cs*", + "RelativeToolTip": "Abilities\\ARA_GiveHediffWithSkillDuration\\CompProperties_GiveHediffWithSkillDuration.cs*", + "ViewState": "AgIAAAEAAAAAAAAAAAAiwC4AAAAFAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-09-26T06:01:20.721Z", + "EditorCaption": "" + }, { "$type": "Document", "DocumentIndex": 0, + "Title": "CompAbilityEffect_GiveHediffWithSkillDuration.cs", + "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_GiveHediffWithSkillDuration\\CompAbilityEffect_GiveHediffWithSkillDuration.cs", + "RelativeDocumentMoniker": "Abilities\\ARA_GiveHediffWithSkillDuration\\CompAbilityEffect_GiveHediffWithSkillDuration.cs", + "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_GiveHediffWithSkillDuration\\CompAbilityEffect_GiveHediffWithSkillDuration.cs*", + "RelativeToolTip": "Abilities\\ARA_GiveHediffWithSkillDuration\\CompAbilityEffect_GiveHediffWithSkillDuration.cs*", + "ViewState": "AgIAACYAAAAAAAAAAAAqwEgAAAAnAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-09-26T06:00:59.354Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, "Title": "CompAbilityEffect_TerrainRestriction .cs", "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_TerrainRestriction\\CompAbilityEffect_TerrainRestriction .cs", "RelativeDocumentMoniker": "Abilities\\ARA_TerrainRestriction\\CompAbilityEffect_TerrainRestriction .cs", diff --git a/Source/ArachnaeSwarm/Abilities/ARA_GiveHediffWithSkillDuration/CompAbilityEffect_GiveHediffWithSkillDuration.cs b/Source/ArachnaeSwarm/Abilities/ARA_GiveHediffWithSkillDuration/CompAbilityEffect_GiveHediffWithSkillDuration.cs new file mode 100644 index 0000000..3211cec --- /dev/null +++ b/Source/ArachnaeSwarm/Abilities/ARA_GiveHediffWithSkillDuration/CompAbilityEffect_GiveHediffWithSkillDuration.cs @@ -0,0 +1,160 @@ +using RimWorld; +using Verse; +using System.Text; + +namespace ArachnaeSwarm +{ + public class CompAbilityEffect_GiveHediffWithSkillDuration : CompAbilityEffect_WithDuration + { + public new CompProperties_AbilityGiveHediffWithSkillDuration Props => (CompProperties_AbilityGiveHediffWithSkillDuration)props; + + public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) + { + base.Apply(target, dest); + + if (!Props.ignoreSelf || target.Pawn != parent.pawn) + { + if (!Props.onlyApplyToSelf && Props.applyToTarget) + { + ApplyToTarget(target.Pawn, parent.pawn); + } + if (Props.applyToSelf || Props.onlyApplyToSelf) + { + ApplyToTarget(parent.pawn, target.Pawn); + } + } + } + + private void ApplyToTarget(Pawn target, Pawn other) + { + if (target == null) return; + + if (TryResist(target)) + { + MoteMaker.ThrowText(target.DrawPos, target.Map, "Resisted".Translate()); + return; + } + + if (Props.replaceExisting) + { + Hediff existingHediff = target.health.hediffSet.GetFirstHediffOfDef(Props.hediffDef); + if (existingHediff != null) + { + target.health.RemoveHediff(existingHediff); + } + } + + Hediff hediff = HediffMaker.MakeHediff(Props.hediffDef, target, Props.onlyBrain ? target.health.hediffSet.GetBrain() : null); + HediffComp_Disappears disappearsComp = hediff.TryGetComp(); + + if (disappearsComp != null) + { + disappearsComp.ticksToDisappear = GetDurationWithSkillBonus(target).SecondsToTicks(); + } + + if (Props.severity >= 0f) + { + hediff.Severity = Props.severity; + } + + HediffComp_Link linkComp = hediff.TryGetComp(); + if (linkComp != null) + { + linkComp.other = other; + linkComp.drawConnection = target == parent.pawn; + } + + target.health.AddHediff(hediff); + } + + private float GetDurationWithSkillBonus(Pawn target) + { + // 使用基类的durationSeconds作为基础值 + float baseDuration = Props.ActualBaseDurationSeconds; + + if (Props.skillDef != null && parent.pawn != null && parent.pawn.skills != null) + { + SkillRecord skill = parent.pawn.skills.GetSkill(Props.skillDef); + if (skill != null) + { + int effectiveLevel = skill.Level; + if (Props.maxBonusLevels > 0 && effectiveLevel > Props.maxBonusLevels) + { + effectiveLevel = Props.maxBonusLevels; + } + + return baseDuration + (effectiveLevel * Props.extraSecondsPerSkillLevel); + } + } + + return baseDuration; + } + + protected virtual bool TryResist(Pawn pawn) + { + return false; + } + + // 在工具提示中显示技能加成信息 + public override string ExtraTooltipPart() + { + StringBuilder stringBuilder = new StringBuilder(); + + // 先添加基类的工具提示 + string baseTooltip = base.ExtraTooltipPart(); + if (!string.IsNullOrEmpty(baseTooltip)) + { + stringBuilder.AppendLine(baseTooltip); + } + + // 添加技能加成信息 + if (Props.showSkillBonusInTooltip && Props.skillDef != null && parent.pawn != null) + { + SkillRecord skill = parent.pawn.skills?.GetSkill(Props.skillDef); + if (skill != null) + { + stringBuilder.AppendLine("AbilitySkillDurationBonus".Translate( + Props.skillDef.LabelCap, + skill.Level, + GetSkillBonusDuration(), + GetTotalDuration() + )); + } + } + + return stringBuilder.ToString().TrimEndNewlines(); + } + + // 获取技能加成的持续时间 + private float GetSkillBonusDuration() + { + if (Props.skillDef == null || parent.pawn == null) return 0f; + + SkillRecord skill = parent.pawn.skills.GetSkill(Props.skillDef); + if (skill == null) return 0f; + + int effectiveLevel = skill.Level; + if (Props.maxBonusLevels > 0 && effectiveLevel > Props.maxBonusLevels) + { + effectiveLevel = Props.maxBonusLevels; + } + + return effectiveLevel * Props.extraSecondsPerSkillLevel; + } + + // 获取总持续时间 + private float GetTotalDuration() + { + return Props.ActualBaseDurationSeconds + GetSkillBonusDuration(); + } + + public override bool AICanTargetNow(LocalTargetInfo target) + { + if (parent.pawn.Faction == Faction.OfPlayer) + { + return false; + } + return target.Pawn != null; + } + } +} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/Abilities/ARA_GiveHediffWithSkillDuration/CompProperties_GiveHediffWithSkillDuration.cs b/Source/ArachnaeSwarm/Abilities/ARA_GiveHediffWithSkillDuration/CompProperties_GiveHediffWithSkillDuration.cs new file mode 100644 index 0000000..ef187ab --- /dev/null +++ b/Source/ArachnaeSwarm/Abilities/ARA_GiveHediffWithSkillDuration/CompProperties_GiveHediffWithSkillDuration.cs @@ -0,0 +1,48 @@ +using RimWorld; +using Verse; + +namespace ArachnaeSwarm +{ + public class CompProperties_AbilityGiveHediffWithSkillDuration : CompProperties_AbilityGiveHediff + { + public SkillDef skillDef; // 影响持续时间的技能 + public float baseDurationSeconds = -1f; // 基础持续时间(秒),-1表示使用基类的durationSeconds + public float extraSecondsPerSkillLevel = 10f; // 每级技能增加的秒数 + public int maxBonusLevels = 10; // 最大可获加成的技能等级 + public bool showSkillBonusInTooltip = true; // 是否在提示中显示技能加成 + + public CompProperties_AbilityGiveHediffWithSkillDuration() + { + this.compClass = typeof(CompAbilityEffect_GiveHediffWithSkillDuration); + } + + // 在属性类中添加这个方法来安全地获取持续时间 + public float GetBaseDuration() + { + // 如果设置了自定义基础持续时间,使用它 + if (baseDurationSeconds >= 0) + return baseDurationSeconds; + + // 否则使用基类的durationSeconds字段 + // 使用反射来访问基类的私有字段 + var field = typeof(CompProperties_AbilityEffectWithDuration).GetField("durationSeconds", + System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); + + if (field != null) + { + return (float)field.GetValue(this); + } + + // 如果反射失败,返回默认值 + return 60f; + } + // 添加一个属性来获取实际的基础持续时间 + public float ActualBaseDurationSeconds + { + get + { + return GetBaseDuration(); + } + } + } +} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index 1a1d4d2..103e521 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -73,6 +73,8 @@ + +