diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 7e3379b1..de917666 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/1.6/Defs/BackstoryDefs/Solid/Solid_Child_WULA.xml b/1.6/1.6/Defs/BackstoryDefs/Solid/Solid_Child_WULA.xml index b7b7699b..c90d3af6 100644 --- a/1.6/1.6/Defs/BackstoryDefs/Solid/Solid_Child_WULA.xml +++ b/1.6/1.6/Defs/BackstoryDefs/Solid/Solid_Child_WULA.xml @@ -9,7 +9,6 @@ [PAWN_nameDef] 是产自科鲁普星区的合成人。这片星区是一个四战之地——由于其地处边缘且地缘政治复杂,乌拉帝国从未真正掌控这片星区,但是此处优秀的稀有水晶和异星天然气使得帝国不愿放弃此星区的掌控。\n\n在此处生产的合成人使用的战略物资远高于其他星区,这使得其拥有更高的机体耐久和更低的能量消耗,并且内置了一定的战斗和手工能力。 3 - 4
  • Wula_Backstory_Categories
  • @@ -24,7 +23,7 @@ WULA_Child_Backstory01_Hediff - [PAWN_nameDef] 是产自科鲁普星区的合成人。在此处生产的合成人使用的战略物资远高于其他星区,这使得其拥有更高的机体耐久和更低的能量消耗,并且内置了一定的战斗能力。 + 在此处生产的合成人使用的战略物资远高于其他星区,这使得其拥有更高的机体耐久和更低的能量消耗,并且内置了一定的战斗能力。 HediffWithComps false false @@ -63,7 +62,7 @@ WULA_Child_Backstory02_Hediff - [PAWN_nameDef] 是产自代达罗斯星区的合成人。从此生产的合成人配置了强大的生产系统,使得它们可以抵消此型合成人在采矿和建造上的天然劣势。 + 从此生产的合成人配置了强大的生产系统,使得它们可以抵消此型合成人在采矿和建造上的天然劣势。 HediffWithComps false false @@ -104,7 +103,7 @@ WULA_Child_Backstory03_Hediff - [PAWN_nameDef] 是产自代达罗斯星区的合成人。此处生产的合成人通常是比其他星区的合成人更加精致和风度翩翩,这使得她们在社交和艺术上拥有得天独厚的优势。 + 此处生产的合成人通常是比其他星区的合成人更加精致和风度翩翩,这使得她们在社交和艺术上拥有得天独厚的优势。 HediffWithComps false false @@ -142,7 +141,7 @@ WULA_Child_Backstory04_Hediff - [PAWN_nameDef] 是产自代达罗斯星区的合成人。此处生产的合成人作为专门的战争机械而设计,结构简单易维护,拥有无可争议的战斗能力,但是不太擅长其他的工作。 + 此处生产的合成人作为专门的战争机械而设计,结构简单易维护,拥有无可争议的战斗能力,但是不太擅长其他的工作。 HediffWithComps false false @@ -164,4 +163,148 @@ + + WULA_Child_Backstory05 + False + Childhood + 产地:瑟利斯 + 瑟利斯 + [PAWN_nameDef] 是产自瑟利斯星区的合成人。瑟利斯星区是乌拉帝国科研中心,尽管帝国的基础科技已经陷入事实上的停滞,但是帝国内的有志之士还是对星区中无尽的知识贮藏趋之若鹜。不过这一带生产的合成人经常被抽调去本地的秘密项目,不太容易有机会调往其他星区。\n\n此处生产的合成人是科研特化型号,她们非常擅长于研究,并且是少数能直接操纵机械族的合成人——尽管乌拉帝国的机械族都是自律机械。 + + 6 + + +
  • Wula_Backstory_Categories
  • +
    + None + +
  • WULA_Child_Backstory05_Hediff
  • +
    + + +
    + + WULA_Child_Backstory05_Hediff + + 此处生产的合成人是科研特化型号,她们非常擅长于研究,并且是少数能直接操纵机械族的合成人——尽管乌拉帝国的机械族都是自律机械。 + HediffWithComps + false + false + True + false + +
  • + + 3 + 1 + +
  • +
    +
    + + WULA_Child_Backstory06 + False + Childhood + 产地:玛瑞克 + 玛瑞克 + [PAWN_nameDef] 是产自玛瑞克星区的合成人。玛瑞克星区是一个相较于其他星区都要庞大的农业型星区。这里有多个天文位置得天独厚的行星适合进行农业生产,使其得以源源不断地向乌拉帝国输送大量的食材。\n\n这个星域生产的合成人通常内置了家政和农业系统,使得她们非常善于处理一些杂事。此外她们经久耐用的射击使其在自然条件下的磨损速度比其他星区的合成人要慢很多。 + + 4 + 4 + 4 + + +
  • Wula_Backstory_Categories
  • +
    + None + +
  • WULA_Child_Backstory06_Hediff
  • +
    + + +
    + + WULA_Child_Backstory06_Hediff + + 这个星域生产的合成人通常内置了家政和农业系统,使得她们非常善于处理一些杂事。此外她们经久耐用的射击使其在自然条件下的磨损速度比其他星区的合成人要慢很多。 + HediffWithComps + false + false + True + false + +
  • + + 0.5 + +
  • +
    +
    + + WULA_Child_Backstory07 + False + Childhood + 产地:戴森 + 戴森 + [PAWN_nameDef] 是产自戴森星区的合成人。戴森星区集中建立了大量天文级别的巨型空间结构,是昔日乌拉帝国雄厚国力的直接体现。如此多的巨型结构自然需要大量高适应性的合成人参与维护。\n\n诞生于此的合成人拥有强大的手工系统,她们的纳米修复被设计用于在极端环境下实现自持修复,因此修复消耗要低于其他星区的合成人。 + + 5 + 4 + + +
  • Wula_Backstory_Categories
  • +
    + None + +
  • WULA_Child_Backstory07_Hediff
  • +
    + + +
    + + WULA_Child_Backstory07_Hediff + + 诞生于此的合成人拥有强大的手工系统,她们的纳米修复被设计用于在极端环境下实现自持修复,因此修复消耗要低于其他星区的合成人。 + HediffWithComps + false + false + True + false + +
  • + + 0.75 + 0.5 + +
  • +
    +
    + + WULA_Child_Backstory99 + False + Childhood + 产地:未知 + 未知产地 + [PAWN_nameDef] 的产地无法追溯——或许是某个星区的高仿品,或许是被回收之后非法再加工的机体,总之她们身体上的机体编号要么是伪造的,要么就干脆没有机体编号。\n\n这些野生的机械乌拉什么都会一点,但是没什么特别擅长的。 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + +
  • Wula_Backstory_Categories
  • +
    + None + + +
    \ No newline at end of file diff --git a/1.6/1.6/Defs/HediffDefs/WULA_Misc_Hediffs.xml b/1.6/1.6/Defs/HediffDefs/WULA_Misc_Hediffs.xml index 1ccabdc9..24f9c666 100644 --- a/1.6/1.6/Defs/HediffDefs/WULA_Misc_Hediffs.xml +++ b/1.6/1.6/Defs/HediffDefs/WULA_Misc_Hediffs.xml @@ -77,8 +77,8 @@ 0.5 1.5 0.1 - 0.02 - 600 + 0.03 +
    diff --git a/1.6/1.6/Defs/StatDefs/WULA_Stats.xml b/1.6/1.6/Defs/StatDefs/WULA_Stats.xml index 53df661f..d97f515e 100644 --- a/1.6/1.6/Defs/StatDefs/WULA_Stats.xml +++ b/1.6/1.6/Defs/StatDefs/WULA_Stats.xml @@ -4,6 +4,7 @@ WULA_Synth 160 + true @@ -16,6 +17,10 @@ 1 PercentZero + true + true + false + WulaFallenEmpire.StatWorker_Energy WulaEnergyFallRateFactor @@ -25,6 +30,10 @@ 1 0 PercentZero + true + true + false + WulaFallenEmpire.StatWorker_Energy @@ -33,21 +42,25 @@ 纳米修复系统修复每点生命值所消耗的能量。 WULA_Synth - 0.1 + 0.03 PercentZero + true + true true - true + false WulaFallenEmpire.StatWorker_NanoRepair WULA_NanoRepairCooldownAfterDamage - 受到伤害后纳米修复系统进入冷却的时间(秒)。 + 受到伤害后纳米修复系统进入冷却的时间(帧)。 WULA_Synth - 300 + 600 Integer + true + true true - true + false WulaFallenEmpire.StatWorker_NanoRepair @@ -58,7 +71,7 @@ 乌拉帝国合成人维护需求退化速率的乘数。数值越高,机械乌拉越容易陷入低维护状态。 WULA_Synth 1.0 - FloatTwo + PercentZero true true WulaFallenEmpire.StatWorker_Maintenance @@ -69,7 +82,7 @@ 影响乌拉帝国合成人维护状态阈值的乘数。数值越高,越容易陷入低维护带来的减益状态。 WULA_Synth 1.0 - FloatTwo + PercentZero true true WulaFallenEmpire.StatWorker_Maintenance @@ -89,11 +102,11 @@ WULA_MaintenanceMinorBreakdownThresholdFactor - + 影响乌拉帝国合成人进入轻微故障阈值的乘数。数值越高,越容易进入轻微故障状态。 WULA_Synth 1.0 - FloatTwo + PercentZero true true WulaFallenEmpire.StatWorker_Maintenance @@ -104,7 +117,7 @@ 影响乌拉帝国合成人进入严重故障阈值的乘数。数值越高,越容易进入严重故障状态。 WULA_Synth 1.0 - FloatTwo + PercentZero true true WulaFallenEmpire.StatWorker_Maintenance @@ -115,7 +128,7 @@ 影响乌拉帝国合成人进入完全故障阈值的乘数。数值越高,越容易进入完全故障状态。 WULA_Synth 1.0 - FloatTwo + PercentZero true true WulaFallenEmpire.StatWorker_Maintenance diff --git a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Drop_Buildings.xml b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Drop_Buildings.xml index c054bdf6..be0dc8af 100644 --- a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Drop_Buildings.xml +++ b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Drop_Buildings.xml @@ -370,6 +370,7 @@ Hard 70 true + WULA_Buildings 3 100 @@ -986,8 +987,8 @@ WULA_Machine_Recharger_Cleanzone - - 清理出一块场地并准备好资源,使得乌拉帝国母舰可以向此处投放建筑。建造好的信标可以收起或移至他处,但是必须要有母舰或者后勤舰在上空才能投送建筑。\n\n乌拉帝国充电站是能够储存大量电量并允许所有大小类型的乌拉帝国机械体进行充电的充电站,不支持合成人的充能。由于其根基埋于地下,因此不会阻碍其他殖民者和机械体在其上面的移动。 + + 清理出一块场地并准备好资源,使得乌拉帝国母舰可以向此处投放建筑。建造好的信标可以收起或移至他处,但是必须要有母舰或者后勤舰在上空才能投送建筑。\n\n乌拉帝国地下维护站是能够储存大量电量并允许所有大小类型的乌拉帝国机械体进行充电的充电站,不支持合成人的充能。由于其根基埋于地下,因此不会阻碍其他殖民者和机械体在其上面的移动。 Wula/Building/WULA_Machine_Recharger MinifiedThing Normal @@ -1042,7 +1043,7 @@ WULA_Machine_Recharger_Incoming - + (3,3) Wula/Building/WULA_Machine_Recharger_Incoming @@ -1076,7 +1077,7 @@ WULA_Machine_Recharger - + 一个能够储存大量电量并允许所有大小类型的乌拉帝国机械体进行充电的充电站,不支持合成人的充能。由于其根基埋于地下,因此不会阻碍其他殖民者和机械体在其上面的移动。 Wula/Building/WULA_Machine_Recharger @@ -1149,4 +1150,160 @@ + + + + WULA_Charging_Station_Synth_Cleanzone + + 清理出一块场地并准备好资源,使得乌拉帝国母舰可以向此处投放建筑。建造好的信标可以收起或移至他处,但是必须要有母舰或者后勤舰在上空才能投送建筑。\n\n合成人充电站是一台供乌拉帝国合成人进行机体充能和改装的检修站,当机械乌拉需要充电时会优先前往此处充电。 + Wula/Building/WULA_Charging_Station_Synth_south + MinifiedThing + Normal + +
  • BuildingsMisc
  • +
    + + Wula/Building/WULA_Dropping_Building_12_Cleanzone + Graphic_Multi + (1.8,2) + + false + + + Building + PassThroughOnly + false + 0.5 + false + 0 + false + false + + + 1 + 1 + 1 + 0 + + (1,2) + 0 + 1 + + 50 + 1 + + + BuildingDestroyed_Metal_Small + + WULA_Buildings + +
  • + WULA_Charging_Station_Synth_Incoming + true + 1 + WULA_Flyover_BaseBuilder + true + false + 乌拉帝国母舰或后勤舰 +
  • +
    +
    + + WULA_Charging_Station_Synth_Incoming + + (1,2) + + Wula/Building/WULA_Charging_Station_Synth_Incoming + Graphic_Single + CutoutFlying + (1.8,2) + + + Accelerate + Things/Skyfaller/SkyfallerShadowDropPod + (2, 2) + DropPod_Fall + 100 + Explosion_Vaporize + 0.05 + 1 + 1 + + +
  • (0,0)
  • +
  • (1, 1)
  • +
    +
    + WULA_Charging_Station_Synth +
    + +
  • + Smoke_Joint +
  • +
    +
    + + WULA_Charging_Station_Synth + Building_Bed + + 一台供乌拉帝国合成人进行机体充能和改装的检修站,当机械乌拉需要充电时会优先前往此处充电。 + Normal + + Wula/Building/WULA_Charging_Station_Synth + Graphic_Multi + (1.8,2) + + false + + + (0.8, 1.5, 0.9) + + + + + + False + + 0.75 + 140 + 1 + 800 + 30 + 10 + + (1,2) + + 1 + + 2010 + 0.5 + +
  • WULA_Base_Technology
  • +
    + + + false + true + 0 + + +
  • + + true + false +
  • +
  • + CompPowerTrader + 200 +
  • +
  • + 4 + (120,240,252,0) +
  • +
  • + WULA_ChargingHediff + WulaSpecies +
  • +
    +
    \ No newline at end of file diff --git a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Local_Buildings.xml b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Local_Buildings.xml index 29e40410..bd01984c 100644 --- a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Local_Buildings.xml +++ b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Local_Buildings.xml @@ -128,77 +128,6 @@ - - - WULA_Charging_Station_Synth - Building_Bed - - 一台供乌拉帝国合成人进行机体充能和改装的检修站,当机械乌拉需要充电时会优先前往此处充电。 - Normal - - Wula/Building/WULA_Charging_Station_Synth - Graphic_Multi - (1,2) - - false - - - (0.8, 1.5, 0.9) - - - - - False - - 0.75 - 140 - 1 - 800 - 30 - 10 - - (1,2) - - 50 - 1 - 1 - - 2010 - 0.5 - WULA_Buildings - -
  • WULA_Base_Technology
  • -
    - - - false - true - 0 - - -
  • PlaceWorker_GlowRadius
  • -
    - -
  • - CompPowerTrader - 200 -
  • -
  • - 12 - - - - - (177, 0, 31, 0) - true - true -
  • -
  • - WULA_ChargingHediff - WulaSpecies -
  • -
    -
    diff --git a/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/Misc_Gameplay.xml b/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/Misc_Gameplay.xml index 0b3de553..424f1aa3 100644 --- a/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/Misc_Gameplay.xml +++ b/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/Misc_Gameplay.xml @@ -237,18 +237,26 @@ 受到伤害后纳米修复系统进入冷却的时间。数值越低,系统响应越快。 纳米修复系统属性: - • 每点生命值修复消耗: {0} - • 最低启动能量阈值: {0} - • 伤害后冷却时间: {1} 秒 - • 系统状态: {0} + \n• 每点生命值修复消耗电量: {0} + \n• 最低启动能量阈值: {0} + \n• 伤害后冷却时间: {1} 秒 + \n• 系统状态: {0} 已启用 已禁用 + 每点生命值修复消耗电量: {0} 维护系统属性: - • 阈值前退化速率: {0}/天\n• 阈值后退化速率: {1}/天\n• 阈值天数: {2}天 - • 轻微故障阈值: {0}\n• 严重故障阈值: {1}\n• 完全故障阈值: {2} - • 伤害转换因子: {0}/点伤害 - • 轻微故障阈值: {0} - • 严重故障阈值: {0} - • 完全故障阈值: {0} + \n• 阈值前退化速率: {0}/天\n• 阈值后退化速率: {1}/天\n• 阈值天数: {2}天 + \n• 轻微故障阈值: {0}\n• 严重故障阈值: {1}\n• 完全故障阈值: {2} + \n• 维护伤害: {0}/点伤害 + \n• 轻微故障阈值: {0} + \n• 严重故障阈值: {0} + \n• 完全故障阈值: {0} + + 能量系统属性: + 机械乌拉能量上限偏移量:影响该个体的最大能量储备。 + 机械乌拉能量消耗速度:影响该个体的能量消耗速率。 + 种族能量属性: + 机械乌拉能量上限偏移量:影响该种族的最大能量储备。 + 机械乌拉能量消耗速度:影响该种族的能量消耗速率。 \ No newline at end of file diff --git a/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_Incoming.png b/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_Incoming.png new file mode 100644 index 00000000..47c331cc Binary files /dev/null and b/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_Incoming.png differ diff --git a/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_east.png b/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_east.png index 8fa4d5ab..c48ef74d 100644 Binary files a/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_east.png and b/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_east.png differ diff --git a/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_north.png b/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_north.png index 89d0615a..63bc4783 100644 Binary files a/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_north.png and b/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_north.png differ diff --git a/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_south.png b/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_south.png index 37c50807..1a711aed 100644 Binary files a/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_south.png and b/Content/Textures/Wula/Building/WULA_Charging_Station_Synth_south.png differ diff --git a/Content/Textures/Wula/Building/WULA_Dropping_Building_12_Cleanzone.png b/Content/Textures/Wula/Building/WULA_Dropping_Building_12_Cleanzone.png new file mode 100644 index 00000000..f036b8f7 Binary files /dev/null and b/Content/Textures/Wula/Building/WULA_Dropping_Building_12_Cleanzone.png differ diff --git a/Content/Textures/Wula/Building/WULA_WeaponArmor_Productor.png b/Content/Textures/Wula/Building/WULA_WeaponArmor_Productor.png index 00a26a1b..134a3484 100644 Binary files a/Content/Textures/Wula/Building/WULA_WeaponArmor_Productor.png and b/Content/Textures/Wula/Building/WULA_WeaponArmor_Productor.png differ diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs b/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs index fa43d6bf..10ed7dc1 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs @@ -1,4 +1,4 @@ -// Building_GlobalWorkTable.cs (调整为每秒处理) +// 在 Building_GlobalWorkTable.cs 中移除材质相关代码 using RimWorld; using System.Collections.Generic; using System.Linq; @@ -15,7 +15,7 @@ namespace WulaFallenEmpire private CompPowerTrader powerComp; private CompBreakdownable breakdownableComp; private int lastProcessTick = -1; - private const int ProcessInterval = 1; // 改为每tick处理,以实现每秒1工作量 + private const int ProcessInterval = 1; public Building_GlobalWorkTable() { @@ -35,12 +35,10 @@ namespace WulaFallenEmpire breakdownableComp = GetComp(); } - // 在 Building_GlobalWorkTable 类中修改 Tick 方法 protected override void Tick() { base.Tick(); - // 修复:改为每60 ticks(1秒)处理一次,避免每tick处理导致的精度问题 if (Find.TickManager.TicksGame % 60 == 0 && Find.TickManager.TicksGame != lastProcessTick) { @@ -226,7 +224,7 @@ namespace WulaFallenEmpire return validSpots; } - // 新增:分配物品到空投舱 + // 简化:分配物品到空投舱,移除材质相关代码 private List> DistributeItemsToPods(GlobalStorageWorldComponent storage, int podCount) { List> podContents = new List>(); @@ -266,7 +264,7 @@ namespace WulaFallenEmpire while (remainingCount > 0) { int stackSize = Mathf.Min(remainingCount, thingDef.stackLimit); - Thing thing = ThingMaker.MakeThing(thingDef); + Thing thing = ThingMaker.MakeThing(thingDef); // 不再传递材质参数 thing.stackCount = stackSize; allItems.Add(thing); remainingCount -= stackSize; @@ -330,25 +328,6 @@ namespace WulaFallenEmpire kind.defaultFactionDef != buildingFaction.def) .ToList(); - // 记录调试信息 - if (DebugSettings.godMode) - { - Log.Message($"[DEBUG] PawnKind selection for {pawnType.defName}:"); - Log.Message($" Building faction: {buildingFaction.def.defName}"); - Log.Message($" Matching faction kinds: {matchingFactionKinds.Count}"); - Log.Message($" No faction kinds: {noFactionKinds.Count}"); - Log.Message($" Excluded kinds: {excludedKinds.Count}"); - - foreach (var kind in matchingFactionKinds) - Log.Message($" Matching: {kind.defName} (faction: {kind.defaultFactionDef?.defName ?? "null"})"); - - foreach (var kind in noFactionKinds) - Log.Message($" No faction: {kind.defName}"); - - foreach (var kind in excludedKinds) - Log.Message($" Excluded: {kind.defName} (faction: {kind.defaultFactionDef?.defName})"); - } - // 优先级选择 PawnKindDef selectedKind = null; @@ -356,15 +335,11 @@ namespace WulaFallenEmpire if (matchingFactionKinds.Count > 0) { selectedKind = matchingFactionKinds.RandomElement(); - if (DebugSettings.godMode) - Log.Message($"[DEBUG] Selected matching faction kind: {selectedKind.defName}"); } // 2. 备选:没有defaultFactionDef的PawnKind else if (noFactionKinds.Count > 0) { selectedKind = noFactionKinds.RandomElement(); - if (DebugSettings.godMode) - Log.Message($"[DEBUG] Selected no-faction kind: {selectedKind.defName}"); } // 3. 没有符合条件的PawnKind else @@ -376,7 +351,6 @@ namespace WulaFallenEmpire return selectedKind; } - // 新增:创建空投舱 private bool CreateDropPod(IntVec3 dropCell, List contents) { diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrder.cs b/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrder.cs index 708d1f48..88861432 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrder.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrder.cs @@ -1,4 +1,4 @@ -// GlobalProductionOrder.cs (修正材质属性读取) +// GlobalProductionOrder.cs (移除所有材质相关代码) using RimWorld; using System.Collections.Generic; using System.Linq; @@ -15,9 +15,6 @@ namespace WulaFallenEmpire public int currentCount = 0; public bool paused = true; - // 材质选择:存储配方选择的材质(只有支持材质的配方才有) - public ThingDef chosenStuff = null; - // 生产状态 public ProductionState state = ProductionState.Waiting; @@ -45,28 +42,6 @@ namespace WulaFallenEmpire } } - // 新增:检查订单是否已经开始生产(一旦开始就不能修改材质) - public bool HasStartedProduction => state == ProductionState.Producing || currentCount > 0; - - // 修正:检查产物是否支持材质选择 - public bool SupportsStuffChoice - { - get - { - if (recipe?.products == null || recipe.products.Count == 0) - return false; - - var productDef = recipe.products[0].thingDef; - if (productDef == null) - return false; - - // 检查产物是否有stuffCategories且costStuffCount > 0 - return productDef.stuffCategories != null && - productDef.stuffCategories.Count > 0 && - productDef.costStuffCount > 0; - } - } - // 修正:获取产物的ThingDef public ThingDef ProductDef => recipe?.products?.Count > 0 ? recipe.products[0].thingDef : null; @@ -78,62 +53,22 @@ namespace WulaFallenEmpire Scribe_Values.Look(ref paused, "paused", true); Scribe_Values.Look(ref _progress, "progress", 0f); Scribe_Values.Look(ref state, "state", ProductionState.Waiting); - Scribe_Defs.Look(ref chosenStuff, "chosenStuff"); // 修复:加载后验证数据 if (Scribe.mode == LoadSaveMode.PostLoadInit) { progress = _progress; UpdateState(); - - // 确保材质选择有效 - if (SupportsStuffChoice && chosenStuff == null) - { - InitializeStuffChoice(); - } } } - // 修正:初始化材质选择 - public void InitializeStuffChoice() - { - if (!SupportsStuffChoice) return; - - var availableStuff = GetAvailableStuffForProduct(); - - if (availableStuff.Count > 0) - { - chosenStuff = availableStuff[0]; - } - } - - // 修正:获取产物的可用材质列表 - public List GetAvailableStuffForProduct() - { - var availableStuff = new List(); - - if (ProductDef?.stuffCategories != null) - { - foreach (var stuffCategory in ProductDef.stuffCategories) - { - var stuffInCategory = DefDatabase.AllDefs - .Where(def => def.IsStuff && def.stuffProps?.categories != null && def.stuffProps.categories.Contains(stuffCategory)) - .ToList(); - - availableStuff.AddRange(stuffInCategory); - } - } - - return availableStuff.Distinct().ToList(); - } - - // 修正:HasEnoughResources 方法,考虑选择的材质 + // 简化:HasEnoughResources 方法,移除材质检查 public bool HasEnoughResources() { var globalStorage = Find.World.GetComponent(); if (globalStorage == null) return false; - // 检查固定消耗(costList) + // 只检查固定消耗(costList) foreach (var ingredient in recipe.ingredients) { bool hasEnoughForThisIngredient = false; @@ -154,26 +89,16 @@ namespace WulaFallenEmpire return false; } - // 检查材质消耗(如果支持材质选择) - if (SupportsStuffChoice && chosenStuff != null) - { - int requiredStuffCount = ProductDef.costStuffCount; - int availableStuffCount = globalStorage.GetInputStorageCount(chosenStuff); - - if (availableStuffCount < requiredStuffCount) - return false; - } - return true; } - // 修正:ConsumeResources 方法,考虑选择的材质 + // 简化:ConsumeResources 方法,移除材质消耗 public bool ConsumeResources() { var globalStorage = Find.World.GetComponent(); if (globalStorage == null) return false; - // 消耗固定资源(costList) + // 只消耗固定资源(costList) foreach (var ingredient in recipe.ingredients) { bool consumedThisIngredient = false; @@ -197,19 +122,10 @@ namespace WulaFallenEmpire return false; } - // 消耗材质(如果支持材质选择) - if (SupportsStuffChoice && chosenStuff != null) - { - int requiredStuffCount = ProductDef.costStuffCount; - - if (!globalStorage.RemoveFromInputStorage(chosenStuff, requiredStuffCount)) - return false; - } - return true; } - // 修正:GetIngredientsTooltip 方法,显示固定消耗和可选材质 + // 简化:GetIngredientsTooltip 方法,只显示固定消耗 public string GetIngredientsTooltip() { StringBuilder sb = new StringBuilder(); @@ -240,34 +156,6 @@ namespace WulaFallenEmpire } } - // 材质消耗(如果支持材质选择) - if (SupportsStuffChoice) - { - sb.AppendLine(); - sb.AppendLine("WULA_StuffMaterial".Translate() + ":"); - - if (chosenStuff != null) - { - int requiredStuffCount = ProductDef.costStuffCount; - int availableStuffCount = globalStorage?.GetInputStorageCount(chosenStuff) ?? 0; - - string stuffDisplay = $"{requiredStuffCount} {chosenStuff.LabelCap}"; - - if (availableStuffCount >= requiredStuffCount) - { - sb.AppendLine($" {stuffDisplay} (Selected)"); - } - else - { - sb.AppendLine($" {stuffDisplay} (Selected)"); - } - } - else - { - sb.AppendLine($" {"WULA_NoStuffSelected".Translate()}"); - } - } - // 产品 sb.AppendLine(); sb.AppendLine("WULA_Products".Translate() + ":"); @@ -279,13 +167,6 @@ namespace WulaFallenEmpire // 工作量信息 sb.AppendLine(); sb.AppendLine("WULA_WorkAmount".Translate() + ": " + GetWorkAmount().ToStringWorkAmount()); - - // 添加材质选择状态信息 - if (HasStartedProduction && SupportsStuffChoice) - { - sb.AppendLine(); - sb.AppendLine("Material choice is locked because production has started."); - } return sb.ToString(); } diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/GlobalStorageWorldComponent.cs b/Source/WulaFallenEmpire/GlobalWorkTable/GlobalStorageWorldComponent.cs index 64668bce..f4d49b48 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/GlobalStorageWorldComponent.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/GlobalStorageWorldComponent.cs @@ -1,11 +1,11 @@ +// GlobalStorageWorldComponent.cs (移除材质相关存储) using LudeonTK; using RimWorld; using RimWorld.Planet; using System.Collections.Generic; using System.Linq; -using System.Text; -using UnityEngine; using Verse; +using UnityEngine; namespace WulaFallenEmpire { @@ -111,6 +111,7 @@ namespace WulaFallenEmpire Log.Message("Added test resources to global storage"); } } + [DebugAction("WULA", "Spawn All Products", actionType = DebugActionType.Action)] public static void DebugSpawnAllProducts() { diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/ITab_GlobalBills.cs b/Source/WulaFallenEmpire/GlobalWorkTable/ITab_GlobalBills.cs index 9494d0bd..2b114dbf 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/ITab_GlobalBills.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/ITab_GlobalBills.cs @@ -1,4 +1,4 @@ -// ITab_GlobalBills.cs (添加图标支持) +// ITab_GlobalBills.cs (移除材质选择功能) using System.Collections.Generic; using System.Linq; using System.Text; @@ -57,13 +57,6 @@ namespace WulaFallenEmpire { Find.WindowStack.Add(new FloatMenu(GenerateRecipeOptions())); } - - // 绘制鼠标悬停信息 - 使用简单的Tooltip方式 - if (mouseoverOrder != null) - { - // 使用Tooltip显示材料信息,不绘制额外窗口 - // 信息已经在DoOrderRow中的TooltipHandler显示 - } } // 新增:存储查看按钮 @@ -72,8 +65,6 @@ namespace WulaFallenEmpire // 绘制按钮 if (Widgets.ButtonText(rect, "WULA_ViewStorage".Translate())) { - // 点击按钮时也可以做一些事情,比如打开详细存储窗口 - // 暂时只显示Tooltip SoundDefOf.Click.PlayOneShotOnCamera(); } @@ -111,7 +102,6 @@ namespace WulaFallenEmpire { foreach (var kvp in inputItems) { - // 使用正确的图标格式并保留名称 sb.AppendLine($" {kvp.Value} {kvp.Key.LabelCap}"); } } @@ -136,21 +126,13 @@ namespace WulaFallenEmpire { foreach (var kvp in outputItems) { - // 使用正确的图标格式并保留名称 sb.AppendLine($" {kvp.Value} {kvp.Key.LabelCap}"); } } - // 添加存储统计信息 - sb.AppendLine(); - sb.AppendLine("WULA_StorageStats".Translate()); - sb.AppendLine($" {inputItems.Count} {("WULA_InputItems".Translate())}"); - sb.AppendLine($" {outputItems.Count} {("WULA_OutputItems".Translate())}"); - return sb.ToString(); } - // 修改:将开发者模式按钮改为上帝模式按钮 private void DoGodModeButtons(Rect rect) { @@ -182,7 +164,6 @@ namespace WulaFallenEmpire globalStorage.AddToInputStorage(componentDef, 100); Messages.Message("Added 200 Steel and 100 Components to global storage", MessageTypeDefOf.PositiveEvent); - Log.Message("[GOD MODE] Added test resources"); } } @@ -227,7 +208,6 @@ namespace WulaFallenEmpire } Messages.Message($"Spawned {totalSpawned} items at worktable location", MessageTypeDefOf.PositiveEvent); - Log.Message($"[GOD MODE] Spawned {totalSpawned} output products"); } } @@ -271,7 +251,9 @@ namespace WulaFallenEmpire Widgets.EndScrollView(); return result; - }// 在 ITab_GlobalBills.cs 中修正材质选择功能 + } + + // 简化:DoOrderRow 方法,移除材质选择按钮 private bool DoOrderRow(Rect rect, GlobalProductionOrder order) { Widgets.DrawHighlightIfMouseover(rect); @@ -351,17 +333,6 @@ namespace WulaFallenEmpire Rect pauseButtonRect = new Rect(currentX - buttonWidth, buttonY, buttonWidth, 25f); currentX -= (buttonWidth + buttonSpacing); - // 材质选择按钮(如果支持材质选择且未开始生产) - Rect stuffButtonRect = new Rect(0f, 0f, 0f, 0f); - bool showStuffButton = false; - - if (order.SupportsStuffChoice && !order.HasStartedProduction) - { - showStuffButton = true; - stuffButtonRect = new Rect(currentX - buttonWidth, buttonY, buttonWidth, 25f); - currentX -= (buttonWidth + buttonSpacing); - } - // 上帝模式:立刻完成按钮 Rect completeButtonRect = new Rect(currentX - buttonWidth, buttonY, buttonWidth, 25f); @@ -381,29 +352,6 @@ namespace WulaFallenEmpire SoundDefOf.Click.PlayOneShotOnCamera(); } - // 绘制材质选择按钮 - if (showStuffButton) - { - string stuffButtonText = order.chosenStuff != null ? - order.chosenStuff.LabelCap : - "WULA_ChooseStuff".Translate(); - - if (Widgets.ButtonText(stuffButtonRect, stuffButtonText)) - { - ShowStuffSelectionMenu(order); - SoundDefOf.Click.PlayOneShotOnCamera(); - } - - // 为材质选择按钮添加Tooltip - if (Mouse.IsOver(stuffButtonRect)) - { - string tooltip = order.chosenStuff != null ? - $"WULA_CurrentStuff".Translate(order.chosenStuff.LabelCap) : - "WULA_ChooseStuffTooltip".Translate(); - TooltipHandler.TipRegion(stuffButtonRect, tooltip); - } - } - // 绘制上帝模式按钮(仅上帝模式下可见) if (DebugSettings.godMode && order.state != GlobalProductionOrder.ProductionState.Completed) { @@ -438,104 +386,8 @@ namespace WulaFallenEmpire return Mouse.IsOver(rect); } - // 修正:显示材质选择菜单 - private void ShowStuffSelectionMenu(GlobalProductionOrder order) - { - if (order.HasStartedProduction) - { - Messages.Message("WULA_CannotChangeStuffAfterStart".Translate(), MessageTypeDefOf.RejectInput); - return; - } - if (!order.SupportsStuffChoice) - { - Messages.Message("WULA_RecipeDoesNotSupportStuff".Translate(), MessageTypeDefOf.RejectInput); - return; - } - var availableStuff = order.GetAvailableStuffForProduct(); - if (availableStuff.Count == 0) - { - Messages.Message("WULA_NoStuffAvailable".Translate(), MessageTypeDefOf.RejectInput); - return; - } - List options = new List(); - var globalStorage = Find.World.GetComponent(); - - foreach (var stuffDef in availableStuff) - { - var stuffDefCopy = stuffDef; - - // 计算所需数量 - int requiredStuffCount = order.ProductDef.costStuffCount; - int availableCount = globalStorage?.GetInputStorageCount(stuffDefCopy) ?? 0; - - // 构建显示文本 - string label = $"{stuffDefCopy.LabelCap} ({requiredStuffCount} needed)"; - if (availableCount < requiredStuffCount) - { - label += $" (Only {availableCount} available)"; - } - else - { - label += $" ({availableCount} available)"; - } - - // 添加材质属性信息 - if (stuffDefCopy.stuffProps != null) - { - label += $"\n - {"WULA_Commonality".Translate()}: {stuffDefCopy.stuffProps.commonality}"; - if (stuffDefCopy.stuffProps.stuffAdjective != null) - { - label += $"\n - {"WULA_Adjective".Translate()}: {stuffDefCopy.stuffProps.stuffAdjective}"; - } - } - - options.Add(new FloatMenuOption( - label: label, - action: () => - { - order.chosenStuff = stuffDefCopy; - Messages.Message($"WULA_StuffSelected".Translate(stuffDefCopy.LabelCap), MessageTypeDefOf.TaskCompletion); - }, - shownItemForIcon: stuffDefCopy - )); - } - - // 添加"自动选择"选项 - options.Add(new FloatMenuOption( - label: "WULA_AutoSelectStuff".Translate(), - action: () => - { - // 选择库存最充足的材质 - var bestStuff = availableStuff - .OrderByDescending(stuff => globalStorage?.GetInputStorageCount(stuff) ?? 0) - .ThenBy(stuff => stuff.stuffProps?.commonality ?? 1f) - .FirstOrDefault(); - - if (bestStuff != null) - { - order.chosenStuff = bestStuff; - Messages.Message($"WULA_StuffAutoSelected".Translate(bestStuff.LabelCap), MessageTypeDefOf.TaskCompletion); - } - } - )); - - // 添加"清除选择"选项(如果当前有选择) - if (order.chosenStuff != null) - { - options.Add(new FloatMenuOption( - label: "WULA_ClearStuffSelection".Translate(), - action: () => - { - order.chosenStuff = null; - Messages.Message("WULA_StuffSelectionCleared".Translate(), MessageTypeDefOf.TaskCompletion); - } - )); - } - - Find.WindowStack.Add(new FloatMenu(options)); - } - // 修正:在添加订单时初始化材质选择 + // 简化:在添加订单时移除材质初始化 private List GenerateRecipeOptions() { var options = new List(); @@ -555,15 +407,8 @@ namespace WulaFallenEmpire paused = true }; - // 初始化材质选择(如果支持) - if (newOrder.SupportsStuffChoice) - { - newOrder.InitializeStuffChoice(); - } - SelTable.globalOrderStack.AddOrder(newOrder); SoundDefOf.Click.PlayOneShotOnCamera(); - Log.Message($"[DEBUG] Added order for {recipe.defName}"); }, shownItemForIcon: recipe.UIIconThing, thingStyle: null, @@ -659,7 +504,6 @@ namespace WulaFallenEmpire // 显示完成消息 Messages.Message($"GOD MODE: Completed order for {order.recipe.LabelCap} ({remainingCount} units)", MessageTypeDefOf.PositiveEvent); - Log.Message($"[GOD MODE] Force completed order: {order.recipe.defName}, produced {remainingCount} units"); } public override void TabUpdate() diff --git a/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_NanoRepair.cs b/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_NanoRepair.cs index 2643fd92..b1a0f0bf 100644 --- a/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_NanoRepair.cs +++ b/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_NanoRepair.cs @@ -11,8 +11,8 @@ namespace WulaFallenEmpire public float activeSeverity = 0.5f; // 有能量且损伤时的严重性 public float inactiveSeverity = 1.5f; // 其他情况的严重性 public float minEnergyThreshold = 0.1f; // 最低能量阈值 - public float repairCostPerHP = 0.1f; // 每点生命值修复的能量消耗 - public int repairCooldownAfterDamage = 300; // 受到伤害后的修复冷却时间 + public float repairCostPerHP = 0.03f; // 每点生命值修复的能量消耗 + public int repairCooldownAfterDamage = 600; // 受到伤害后的修复冷却时间 // 新增:与 StatDef 的关联 public StatDef repairCostStatDef; public StatDef cooldownStatDef; diff --git a/Source/WulaFallenEmpire/Pawn/WULA_Energy/Need_WulaEnergy.cs b/Source/WulaFallenEmpire/Pawn/WULA_Energy/Need_WulaEnergy.cs index 941cd00a..523876f9 100644 --- a/Source/WulaFallenEmpire/Pawn/WULA_Energy/Need_WulaEnergy.cs +++ b/Source/WulaFallenEmpire/Pawn/WULA_Energy/Need_WulaEnergy.cs @@ -9,7 +9,7 @@ namespace WulaFallenEmpire { private NeedDefExtension_Energy ext; - private NeedDefExtension_Energy Ext + public NeedDefExtension_Energy Ext { get { diff --git a/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/Need_Maintenance.cs b/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/Need_Maintenance.cs index 176f2ec4..05998781 100644 --- a/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/Need_Maintenance.cs +++ b/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/Need_Maintenance.cs @@ -8,7 +8,7 @@ namespace WulaFallenEmpire { public class Need_Maintenance : Need { - private MaintenanceNeedExtension Extension => def.GetModExtension(); + public MaintenanceNeedExtension Extension => def.GetModExtension(); // 上次维护的天数 private float daysSinceLastMaintenance = 0f; diff --git a/Source/WulaFallenEmpire/Stat/StatWorker_Energy.cs b/Source/WulaFallenEmpire/Stat/StatWorker_Energy.cs new file mode 100644 index 00000000..e5a0e8a3 --- /dev/null +++ b/Source/WulaFallenEmpire/Stat/StatWorker_Energy.cs @@ -0,0 +1,180 @@ +// StatWorker_Energy.cs - 处理能量相关的统计量 +using RimWorld; +using Verse; +using System.Collections.Generic; + +namespace WulaFallenEmpire +{ + public class StatWorker_Energy : StatWorker + { + public override bool ShouldShowFor(StatRequest req) + { + if (!base.ShouldShowFor(req)) + return false; + + // 处理 ThingDef 的情况(种族定义) + if (req.Def is ThingDef thingDef) + { + // 检查是否为 WulaSpecies 种族 + return thingDef.defName == "WulaSpecies"; + } + + // 检查是否为 Pawn + if (req.Thing is Pawn pawn) + { + // 检查是否有能量需求 + return HasEnergyNeed(pawn); + } + + return false; + } + + public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) + { + // 关键修复:调用基类方法让 RimWorld 的统计系统处理所有修正 + float baseValue = base.GetValueUnfinalized(req, applyPostProcess); + + if (req.Thing is Pawn pawn) + { + return GetStatValueForPawn(stat.defName, pawn, baseValue); + } + else if (req.Def is ThingDef thingDef && thingDef.defName == "WulaSpecies") + { + // 对于 WulaSpecies 种族,返回经过修正的值 + return GetDefaultValueForStat(stat.defName, baseValue); + } + + return baseValue; + } + + public override string GetExplanationUnfinalized(StatRequest req, ToStringNumberSense numberSense) + { + var explanation = base.GetExplanationUnfinalized(req, numberSense); + + // 添加自定义解释 + if (req.Thing is Pawn pawn) + { + explanation += "\n\n" + GetEnergyExplanationForPawn(stat.defName, pawn); + } + else if (req.Def is ThingDef thingDef && thingDef.defName == "WulaSpecies") + { + explanation += "\n\n" + GetEnergyExplanationForRace(stat.defName); + } + + return explanation; + } + + private bool HasEnergyNeed(Pawn pawn) + { + // 使用反射或其他方式检查是否有能量需求,或者直接返回 true 对于 WulaSpecies + if (pawn?.def?.defName == "WulaSpecies") + return true; + + // 如果有具体的能量需求类,可以在这里检查 + // return pawn?.needs?.TryGetNeed() != null; + return false; + } + + private float GetStatValueForPawn(string statDefName, Pawn pawn, float baseValue) + { + // 对于 WulaSpecies 种族,返回基于其特性的值 + if (pawn.def.defName == "WulaSpecies") + { + switch (statDefName) + { + case "WulaEnergyMaxLevelOffset": + return CalculateEnergyMaxLevelOffset(pawn, baseValue); + + case "WulaEnergyFallRateFactor": + return CalculateEnergyFallRateFactor(pawn, baseValue); + + default: + return baseValue; + } + } + + return baseValue; + } + + private float GetDefaultValueForStat(string statDefName, float baseValue) + { + // 关键修复:使用基础值而不是固定值 + switch (statDefName) + { + case "WulaEnergyMaxLevelOffset": + return baseValue; // 使用统计系统修正后的值 + + case "WulaEnergyFallRateFactor": + return baseValue; // 使用统计系统修正后的值 + + default: + return baseValue; + } + } + + private float CalculateEnergyMaxLevelOffset(Pawn pawn, float baseValue) + { + // 计算能量上限偏移量,使用基础值作为起点 + // 这里可以根据 pawn 的特性计算 + return baseValue; + } + + private float CalculateEnergyFallRateFactor(Pawn pawn, float baseValue) + { + // 计算能量下降速率因子,使用基础值作为起点 + // 这里可以根据 pawn 的特性计算 + return baseValue; + } + + private string GetEnergyExplanationForPawn(string statDefName, Pawn pawn) + { + var explanation = "WULA_Energy_Properties".Translate(); + + switch (statDefName) + { + case "WulaEnergyMaxLevelOffset": + explanation += "\n" + "WULA_Energy_MaxLevelOffset_PawnExplanation".Translate(); + break; + + case "WulaEnergyFallRateFactor": + explanation += "\n" + "WULA_Energy_FallRateFactor_PawnExplanation".Translate(); + break; + } + + return explanation; + } + + private string GetEnergyExplanationForRace(string statDefName) + { + var explanation = "WULA_Energy_RaceProperties".Translate(); + + switch (statDefName) + { + case "WulaEnergyMaxLevelOffset": + explanation += "\n" + "WULA_Energy_MaxLevelOffset_RaceExplanation".Translate(); + break; + + case "WulaEnergyFallRateFactor": + explanation += "\n" + "WULA_Energy_FallRateFactor_RaceExplanation".Translate(); + break; + } + + return explanation; + } + + public override IEnumerable GetInfoCardHyperlinks(StatRequest req) + { + foreach (var hyperlink in base.GetInfoCardHyperlinks(req)) + { + yield return hyperlink; + } + + // 添加能量系统的超链接 + var energyNeedDef = DefDatabase.GetNamedSilentFail("WULA_Energy"); + if (energyNeedDef != null) + { + yield return new Dialog_InfoCard.Hyperlink(energyNeedDef); + } + } + } +} diff --git a/Source/WulaFallenEmpire/Stat/StatWorker_Maintenance.cs b/Source/WulaFallenEmpire/Stat/StatWorker_Maintenance.cs index 8f7dfd30..d3a70483 100644 --- a/Source/WulaFallenEmpire/Stat/StatWorker_Maintenance.cs +++ b/Source/WulaFallenEmpire/Stat/StatWorker_Maintenance.cs @@ -23,6 +23,9 @@ namespace WulaFallenEmpire public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) { + // 关键修复:调用基类方法让 RimWorld 的统计系统处理所有修正 + float baseValue = base.GetValueUnfinalized(req, applyPostProcess); + if (req.Thing is Pawn pawn) { var maintenanceNeed = GetMaintenanceNeed(pawn); @@ -30,11 +33,11 @@ namespace WulaFallenEmpire if (maintenanceNeed != null && extension != null) { - return GetStatValueForMaintenance(stat.defName, maintenanceNeed, extension); + return GetStatValueForMaintenance(stat.defName, maintenanceNeed, extension, baseValue); } } - return stat.defaultBaseValue; + return baseValue; } public override string GetExplanationUnfinalized(StatRequest req, ToStringNumberSense numberSense) @@ -71,30 +74,31 @@ namespace WulaFallenEmpire return maintenanceNeed?.Extension; } - private float GetStatValueForMaintenance(string statDefName, Need_Maintenance need, MaintenanceNeedExtension extension) + private float GetStatValueForMaintenance(string statDefName, Need_Maintenance need, MaintenanceNeedExtension extension, float baseValue) { + // 关键修复:使用基础值而不是固定值 switch (statDefName) { case "WULA_MaintenanceDegradationFactor": - return CalculateDegradationFactor(need, extension); + return CalculateDegradationFactor(need, extension, baseValue); case "WULA_MaintenanceStatusThresholdFactor": - return CalculateStatusThresholdFactor(need, extension); + return CalculateStatusThresholdFactor(need, extension, baseValue); case "WULA_MaintenanceDamageToMaintenanceFactor": - return CalculateDamageToMaintenanceFactor(need, extension); + return CalculateDamageToMaintenanceFactor(need, extension, baseValue); case "WULA_MaintenanceMinorBreakdownThresholdFactor": - return CalculateMinorBreakdownThresholdFactor(need, extension); + return CalculateMinorBreakdownThresholdFactor(need, extension, baseValue); case "WULA_MaintenanceMajorBreakdownThresholdFactor": - return CalculateMajorBreakdownThresholdFactor(need, extension); + return CalculateMajorBreakdownThresholdFactor(need, extension, baseValue); case "WULA_MaintenanceCriticalFailureThresholdFactor": - return CalculateCriticalFailureThresholdFactor(need, extension); + return CalculateCriticalFailureThresholdFactor(need, extension, baseValue); default: - return stat.defaultBaseValue; + return baseValue; } } @@ -132,44 +136,44 @@ namespace WulaFallenEmpire return explanation; } - // 计算各种统计值的方法 - private float CalculateDegradationFactor(Need_Maintenance need, MaintenanceNeedExtension extension) + // 计算各种统计值的方法 - 现在接受基础值参数 + private float CalculateDegradationFactor(Need_Maintenance need, MaintenanceNeedExtension extension, float baseValue) { - // 基础退化速率乘数 - return 1.0f; // 默认值,可以根据需要调整 + // 基础退化速率乘数,使用统计系统修正后的值 + return baseValue; } - private float CalculateStatusThresholdFactor(Need_Maintenance need, MaintenanceNeedExtension extension) + private float CalculateStatusThresholdFactor(Need_Maintenance need, MaintenanceNeedExtension extension, float baseValue) { - // 状态阈值乘数 - return 1.0f; // 默认值,可以根据需要调整 + // 状态阈值乘数,使用统计系统修正后的值 + return baseValue; } - private float CalculateDamageToMaintenanceFactor(Need_Maintenance need, MaintenanceNeedExtension extension) + private float CalculateDamageToMaintenanceFactor(Need_Maintenance need, MaintenanceNeedExtension extension, float baseValue) { - // 伤害到维护度的转换因子 - return extension?.damageToMaintenanceFactor ?? 0.01f; + // 伤害到维护度的转换因子,使用统计系统修正后的值 + return baseValue; } - private float CalculateMinorBreakdownThresholdFactor(Need_Maintenance need, MaintenanceNeedExtension extension) + private float CalculateMinorBreakdownThresholdFactor(Need_Maintenance need, MaintenanceNeedExtension extension, float baseValue) { - // 轻微故障阈值乘数 - return 1.0f; // 默认值 + // 轻微故障阈值乘数,使用统计系统修正后的值 + return baseValue; } - private float CalculateMajorBreakdownThresholdFactor(Need_Maintenance need, MaintenanceNeedExtension extension) + private float CalculateMajorBreakdownThresholdFactor(Need_Maintenance need, MaintenanceNeedExtension extension, float baseValue) { - // 严重故障阈值乘数 - return 1.0f; // 默认值 + // 严重故障阈值乘数,使用统计系统修正后的值 + return baseValue; } - private float CalculateCriticalFailureThresholdFactor(Need_Maintenance need, MaintenanceNeedExtension extension) + private float CalculateCriticalFailureThresholdFactor(Need_Maintenance need, MaintenanceNeedExtension extension, float baseValue) { - // 完全故障阈值乘数 - return 1.0f; // 默认值 + // 完全故障阈值乘数,使用统计系统修正后的值 + return baseValue; } - // 解释文本生成方法 + // 解释文本生成方法(保持不变) private string GetDegradationFactorExplanation(Need_Maintenance need, MaintenanceNeedExtension extension) { return "WULA_Maintenance_DegradationFactor_Explanation".Translate( diff --git a/Source/WulaFallenEmpire/Stat/StatWorker_NanoRepair.cs b/Source/WulaFallenEmpire/Stat/StatWorker_NanoRepair.cs index c90c1157..2684f211 100644 --- a/Source/WulaFallenEmpire/Stat/StatWorker_NanoRepair.cs +++ b/Source/WulaFallenEmpire/Stat/StatWorker_NanoRepair.cs @@ -13,6 +13,18 @@ namespace WulaFallenEmpire if (!base.ShouldShowFor(req)) return false; + // 处理 ThingDef 的情况(种族定义) + if (req.Def is ThingDef thingDef) + { + // 检查是否为 WulaSpecies 种族 + if (thingDef.defName == "WulaSpecies") + { + // 对于 WulaSpecies 种族,只在有纳米修复 hediff 时显示 + return HasNanoRepairForRace(thingDef); + } + return false; + } + // 检查是否为 Pawn if (req.Thing is Pawn pawn) { @@ -24,24 +36,24 @@ namespace WulaFallenEmpire public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) { + // 关键修复:调用基类方法让 RimWorld 的统计系统处理所有修正 + float baseValue = base.GetValueUnfinalized(req, applyPostProcess); + if (req.Thing is Pawn pawn) { var nanoComp = GetNanoRepairComp(pawn); if (nanoComp != null) { - // 根据请求的 StatDef 返回相应的值 - if (stat.defName == "WULA_NanoRepairCostPerHP") - { - return nanoComp.Props.repairCostPerHP; - } - else if (stat.defName == "WULA_NanoRepairCooldownAfterDamage") - { - return nanoComp.Props.repairCooldownAfterDamage; - } + return GetStatValueForNanoRepair(stat.defName, nanoComp, baseValue); } } + else if (req.Def is ThingDef thingDef && thingDef.defName == "WulaSpecies") + { + // 对于 WulaSpecies 种族,返回经过修正的值 + return GetDefaultValueForStat(stat.defName, baseValue); + } - return stat.defaultBaseValue; + return baseValue; } public override string GetExplanationUnfinalized(StatRequest req, ToStringNumberSense numberSense) @@ -56,10 +68,21 @@ namespace WulaFallenEmpire explanation += "\n\n" + GetNanoRepairExplanation(nanoComp); } } + else if (req.Def is ThingDef thingDef && thingDef.defName == "WulaSpecies") + { + explanation += "\n\n" + GetNanoRepairExplanationForRace(); + } return explanation; } + private bool HasNanoRepairForRace(ThingDef raceDef) + { + // 检查该种族是否有纳米修复 hediff + // 这里可以添加更复杂的逻辑来检查种族是否有纳米修复能力 + return raceDef.defName == "WulaSpecies"; + } + private bool HasNanoRepairHediff(Pawn pawn) { if (pawn?.health?.hediffSet?.hediffs == null) @@ -90,6 +113,40 @@ namespace WulaFallenEmpire return null; } + private float GetStatValueForNanoRepair(string statDefName, HediffComp_NanoRepair nanoComp, float baseValue) + { + // 关键修复:使用基础值而不是固定值 + var props = nanoComp.Props; + + switch (statDefName) + { + case "WULA_NanoRepairCostPerHP": + return baseValue; // 使用统计系统修正后的值 + + case "WULA_NanoRepairCooldownAfterDamage": + return baseValue; // 使用统计系统修正后的值 + + default: + return baseValue; + } + } + + private float GetDefaultValueForStat(string statDefName, float baseValue) + { + // 关键修复:使用基础值而不是固定值 + switch (statDefName) + { + case "WULA_NanoRepairCostPerHP": + return baseValue; // 使用统计系统修正后的值 + + case "WULA_NanoRepairCooldownAfterDamage": + return baseValue; // 使用统计系统修正后的值 + + default: + return baseValue; + } + } + private string GetNanoRepairExplanation(HediffComp_NanoRepair nanoComp) { var props = nanoComp.Props; @@ -113,6 +170,24 @@ namespace WulaFallenEmpire return explanation; } + private string GetNanoRepairExplanationForRace() + { + var explanation = "WULA_NanoRepair_RaceProperties".Translate(); + + if (stat.defName == "WULA_NanoRepairCostPerHP") + { + explanation += "WULA_NanoRepair_CostPerHP_RaceLine".Translate(stat.defaultBaseValue.ToStringPercent()); + } + else if (stat.defName == "WULA_NanoRepairCooldownAfterDamage") + { + explanation += "WULA_NanoRepair_CooldownAfterDamage_RaceLine".Translate( + stat.defaultBaseValue, + (stat.defaultBaseValue / 60f).ToString("F1")); + } + + return explanation; + } + public override IEnumerable GetInfoCardHyperlinks(StatRequest req) { foreach (var hyperlink in base.GetInfoCardHyperlinks(req)) diff --git a/Source/WulaFallenEmpire/WulaDefOf.cs b/Source/WulaFallenEmpire/WulaDefOf.cs index 0848cdd4..9943a7ab 100644 --- a/Source/WulaFallenEmpire/WulaDefOf.cs +++ b/Source/WulaFallenEmpire/WulaDefOf.cs @@ -15,11 +15,11 @@ namespace WulaFallenEmpire DefOfHelper.EnsureInitializedInCtor(typeof(ThingDefOf_WULA)); } } + [DefOf] public static class JobDefOf_WULA { public static JobDef WULA_EnterMaintenancePod; - public static JobDef WULA_HaulToMaintenancePod; static JobDefOf_WULA() @@ -27,6 +27,7 @@ namespace WulaFallenEmpire DefOfHelper.EnsureInitializedInCtor(typeof(JobDefOf_WULA)); } } + [DefOf] public static class WulaStatDefOf { @@ -38,4 +39,27 @@ namespace WulaFallenEmpire DefOfHelper.EnsureInitializedInCtor(typeof(WulaStatDefOf)); } } -} \ No newline at end of file + + [DefOf] + public static class WulaNeedDefOf + { + public static NeedDef WULA_Energy; + + static WulaNeedDefOf() + { + DefOfHelper.EnsureInitializedInCtor(typeof(WulaNeedDefOf)); + } + } + + + [DefOf] + public static class WulaStatCategoryDefOf + { + public static StatCategoryDef WULA_Synth; + + static WulaStatCategoryDefOf() + { + DefOfHelper.EnsureInitializedInCtor(typeof(WulaStatCategoryDefOf)); + } + } +} diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 5dd15174..b24441de 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -156,6 +156,8 @@ + + diff --git a/美术与文本源文件/Wula/Building/WULA_Charging_Station_Synth_south.sai2 b/美术与文本源文件/Wula/Building/WULA_Charging_Station_Synth_south.sai2 index e2eea3df..7cd26102 100644 Binary files a/美术与文本源文件/Wula/Building/WULA_Charging_Station_Synth_south.sai2 and b/美术与文本源文件/Wula/Building/WULA_Charging_Station_Synth_south.sai2 differ diff --git a/美术与文本源文件/Wula/Building/WULA_Dropping_Building_12_Cleanzone.sai2 b/美术与文本源文件/Wula/Building/WULA_Dropping_Building_12_Cleanzone.sai2 new file mode 100644 index 00000000..8390d4b7 Binary files /dev/null and b/美术与文本源文件/Wula/Building/WULA_Dropping_Building_12_Cleanzone.sai2 differ diff --git a/美术与文本源文件/Wula/Building/WULA_WeaponArmor_Productor.sai2 b/美术与文本源文件/Wula/Building/WULA_WeaponArmor_Productor.sai2 index 6b70045e..f6b6adcb 100644 Binary files a/美术与文本源文件/Wula/Building/WULA_WeaponArmor_Productor.sai2 and b/美术与文本源文件/Wula/Building/WULA_WeaponArmor_Productor.sai2 differ diff --git a/美术与文本源文件/Wula/UI/EventUI/新建画布2.sai2 b/美术与文本源文件/Wula/UI/EventUI/新建画布2.sai2 new file mode 100644 index 00000000..26b37116 Binary files /dev/null and b/美术与文本源文件/Wula/UI/EventUI/新建画布2.sai2 differ