Merge branch '生物质工艺茧'

This commit is contained in:
2025-09-04 16:47:14 +08:00
13 changed files with 912 additions and 3 deletions

Binary file not shown.

View File

@@ -69,6 +69,40 @@
</li>
</comps>
</AbilityDef>
<AbilityDef>
<defName>ARA_EggSpewBioforgeIncubator</defName>
<label>生育培育卵</label>
<description>工艺卵</description>
<iconPath>UI/Commands/EggSpew</iconPath>
<cooldownTicksRange>5000</cooldownTicksRange>
<aiCanUse>true</aiCanUse>
<displayOrder>300</displayOrder>
<displayGizmoWhileUndrafted>true</displayGizmoWhileUndrafted>
<disableGizmoWhileUndrafted>false</disableGizmoWhileUndrafted>
<warmupStartSound>AcidSpray_Warmup</warmupStartSound>
<verbProperties>
<verbClass>Verb_CastAbility</verbClass>
<range>1</range>
<warmupTime>12</warmupTime>
<soundCast>AcidSpray_Resolve</soundCast>
<violent>false</violent>
<targetable>false</targetable>
<targetParams>
<canTargetSelf>True</canTargetSelf>
</targetParams>
</verbProperties>
<comps>
<li Class="CompProperties_AbilityLaunchProjectile">
<projectileDef>ARA_Proj_BioforgeIncubator</projectileDef>
</li>
<li Class="ArachnaeSwarm.CompProperties_AbilityNeedCost">
<needDef>Food</needDef>
<needCost>0</needCost>
<failMessage>营养值不足,需要进食</failMessage>
</li>
</comps>
</AbilityDef>
<AbilityDef>
<defName>ARA_AcidSprayBurst</defName>
<label>女皇种酸液轰炸</label>
@@ -201,6 +235,23 @@
<tryAdjacentFreeSpaces>true</tryAdjacentFreeSpaces>
</projectile>
</ThingDef>
<ThingDef ParentName="BaseGrenadeProjectile">
<defName>ARA_Proj_BioforgeIncubator</defName>
<label>阿拉克涅孵化茧</label>
<thingClass>Projectile_SpawnsThing</thingClass>
<graphicData>
<texPath>ArachnaeSwarm/Building/ARA_EggSac</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<projectile>
<damageDef>Bullet</damageDef>
<speed>21</speed>
<damageAmountBase>0</damageAmountBase>
<spawnsThingDef>ARA_BioforgeIncubator</spawnsThingDef>
<tryAdjacentFreeSpaces>true</tryAdjacentFreeSpaces>
</projectile>
</ThingDef>
<AbilityDef>
<defName>ARA_BaseRace_Acid_Launcher</defName>

View File

@@ -68,8 +68,7 @@
<titleShort>蜜罐种</titleShort>
<description>[PAWN_nameDef]是一只阿拉克涅蜜罐种督虫。基因的选择性表达使其长出了肿胀的囊袋和复杂的口器,这使得她可以吞噬那些未经过处理的尸体和各种杂食或是将其进一步分解,并通过消化器官将其转变为阿拉克涅虫蜜以供其他虫族食用。\n\n[PAWN_nameDef]在战斗中并不是一个值得正视的对手,她没有可以接入武装器官的副肢,脆弱臃肿的特性也决定了她几乎无法躲开任何攻击。</description>
<slot>Adulthood</slot>
<workDisables>AllWork</workDisables>
<requiredWorkTags>Cooking</requiredWorkTags>
<requiredWorkTags>Cooking</requiredWorkTags>
<spawnCategories>
<li>ArachnaeNode_spawnCategories_Myrmecocystus</li>
@@ -81,7 +80,6 @@
<titleShort>盾头种</titleShort>
<description>[PAWN_nameDef]是一只阿拉克涅盾头种督虫。盾头种是一种笨重的阿拉克涅虫族,她们拥有厚厚的经常过度生长的甲壳,除了生产甲壳素外,也拥有接入武装器官的辅肢,可以凭借虫群的武装器官和自己与生俱来的盔甲承担保卫虫巢的任务。</description>
<slot>Adulthood</slot>
<workDisables>AllWork</workDisables>
<spawnCategories>
<li>ArachnaeNode_spawnCategories_ShieldHead</li>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<JobDef>
<defName>ARA_StartInteractiveProduction</defName>
<driverClass>ArachnaeSwarm.JobDriver_StartProduction</driverClass>
<reportString>正在启动生产 TargetA.</reportString>
<allowOpportunisticPrefix>true</allowOpportunisticPrefix>
</JobDef>
</Defs>

View File

@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThingDef ParentName="BuildingBase">
<defName>ARA_BioforgeIncubator</defName>
<label>阿拉克涅孵化茧</label>
<description>一个脆弱、易燃、黏滑的囊状物,是阿拉克涅工艺种所诞之卵,内含哺育阿拉克涅武器种虫族所需的营养和遗传物质,可以通过阿拉克涅工艺种的交互完成激活进程。</description>
<thingClass>Building</thingClass>
<graphicData>
<texPath>ArachnaeSwarm/Building/ARA_EggSac</texPath>
<graphicClass>Graphic_Single</graphicClass>
<drawSize>(1.5,1.5)</drawSize>
</graphicData>
<size>(1,1)</size>
<altitudeLayer>Building</altitudeLayer>
<passability>PassThroughOnly</passability>
<fillPercent>0.3</fillPercent>
<rotatable>false</rotatable>
<tickerType>Normal</tickerType>
<statBases>
<MaxHitPoints>50</MaxHitPoints>
<Flammability>1</Flammability>
</statBases>
<building>
<deconstructible>false</deconstructible>
<repairable>false</repairable>
</building>
<comps>
<li Class="CompProperties_Flickable"/>
<!-- The new, GrowthVat-style fuel component -->
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition">
<fuelCapacity>10</fuelCapacity>
<fuelLabel>Biomass</fuelLabel>
<fuelFilter>
<categories>
<li>Foods</li>
</categories>
</fuelFilter>
<fuelConsumptionRate>0</fuelConsumptionRate> <!-- IMPORTANT: Disable base class consumption -->
</li>
<!-- The refactored producer component -->
<li Class="ArachnaeSwarm.CompProperties_InteractiveProducer">
<processes>
<li>
<thingDef>Gun_ChainShotgun</thingDef>
<productionTicks>60000</productionTicks>
<totalNutritionNeeded>20</totalNutritionNeeded>
</li>
<li>
<thingDef>Gun_AssaultRifle</thingDef>
<productionTicks>60000</productionTicks>
<totalNutritionNeeded>15</totalNutritionNeeded>
</li>
</processes>
<whitelist>
<li>ARA_ArachnaeQueen</li>
</whitelist>
<spawnCount>1</spawnCount>
<destroyOnSpawn>True</destroyOnSpawn>
<minSafeTemperature>18</minSafeTemperature>
<maxSafeTemperature>23</maxSafeTemperature>
<penaltyPerDegreePerTick>0.00001</penaltyPerDegreePerTick>
<damagePerTickWhenUnfueled>0.2</damagePerTickWhenUnfueled>
<minNutritionToStart>1.0</minNutritionToStart>
<qualityThresholds>
<li>
<quality>Legendary</quality>
<threshold>0.99</threshold>
</li>
<li>
<quality>Masterwork</quality>
<threshold>0.90</threshold>
</li>
<li>
<quality>Excellent</quality>
<threshold>0.70</threshold>
</li>
<li>
<quality>Good</quality>
<threshold>0.50</threshold>
</li>
<li>
<quality>Normal</quality>
<threshold>0.20</threshold>
</li>
<li>
<quality>Poor</quality>
<threshold>0.10</threshold>
</li>
</qualityThresholds>
<!--
<![CDATA[
当一个生产流程完成时,系统会通过以下三个步骤来确定最终的物品品质:
第 1 步: 计算“基础品质分” (Base Quality Score)
基础品质分代表了在整个生产过程中,理想条件所占的比例。理想条件被严格定义为:燃料充足 且 温度适宜。
公式:
基础品质分 = 在理想条件下度过的时间(ticks) / 生产总需时间(ticks)
C# 代码对应:
baseQuality = (_selectedProcess.productionTicks > 0) ? (float)ticksUnderOptimalConditions / _selectedProcess.productionTicks : 0f;
说明:
ticksUnderOptimalConditions 是一个计数器只有在同时满足燃料充足和温度安全这两个条件的游戏刻Tick它才会加 1。
_selectedProcess.productionTicks 是在 XML 中为该产品定义的总生产时间。
这个得分的范围是 0.0 (0%) 到 1.0 (100%)。如果整个过程都完美无缺,这个分数就是 1.0。
第 2 步: 计算“温度惩罚分” (Temperature Penalty Score)
温度惩罚分是一个独立累加的负面分数。它只在环境温度超出安全范围时才会累积。
公式:
每刻惩罚增加量 = 超出安全范围的度数 × penaltyPerDegreePerTick
温度惩罚分 = 所有惩罚增加量的总和
C# 代码对应:
temperaturePenaltyPercent = Mathf.Min(1f, temperaturePenaltyPercent + tempDelta * Props.penaltyPerDegreePerTick);
说明:
penaltyPerDegreePerTick 是一个可在 XML 中配置的系数代表每超出1度、每刻所产生的惩罚量。
这个惩罚是不可逆的。即使温度恢复正常,已经累积的惩罚也不会减少。
它的最大值被限制在 1.0 (100%),以防止无限累加。
第 3 步: 计算“最终品质分”并映射到品质等级
最终品质分由基础分减去惩罚分得出,这个分数将直接决定物品的品质等级。
公式:
最终品质分 = 基础品质分 - 温度惩罚分
C# 代码对应:
finalQualityScore = Mathf.Clamp01(baseQuality - temperaturePenaltyPercent);
映射到品质等级:
得到 finalQualityScore (一个 0.0 到 1.0 之间的值) 后,系统会通过一系列 if-else if 判断,将其映射到游戏中的 QualityCategory (品质等级)。例如,在我们的代码中:
>= 0.99 -> 传说 (Legendary)
>= 0.90 -> 杰作 (Masterwork)
>= 0.70 -> 优秀 (Excellent)
>= 0.50 -> 良好 (Good)
>= 0.20 -> 普通 (Normal)
>= 0.10 -> 差 (Poor)
< 0.10 -> 劣质 (Awful)
总结
这个系统的核心在于,它鼓励玩家全程维持最佳生产环境。
仅仅保持燃料充足或温度适宜是不够的,必须两者兼顾才能提高“基础品质分”。
同时,必须极力避免温度超出安全范围,因为“温度惩罚分”是纯粹的惩罚,它只会单方面地拉低最终品质,且无法挽回。
这种设计为玩家提供了一个清晰的目标和富有挑战性的过程管理,而不是一个简单的“放置-等待”式生产。
]]>
-->
</li>
<li Class="ArachnaeSwarm.CompProperties_TemperatureRuinableDamage">
<minSafeTemperature>13</minSafeTemperature>
<maxSafeTemperature>28</maxSafeTemperature>
<progressPerDegreePerTick>0.00005</progressPerDegreePerTick>
<damagePerTick>0.001</damagePerTick>
<recoveryRate>0.001</recoveryRate>
</li>
</comps>
</ThingDef>
</Defs>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>
<EstimatedQuality>预计品质</EstimatedQuality>
<QualityScore>品质评分</QualityScore>
<TemperaturePenalty>温度惩罚</TemperaturePenalty>
<CurrentTemperature>当前温度: {0}</CurrentTemperature>
<SafeTemperatureRange>安全范围</SafeTemperatureRange>
<CannotStartProduction>无法开始生产</CannotStartProduction>
<NoFuel>无燃料</NoFuel>
<StartProduction>开始生产 {0}</StartProduction>
<CommandCancelProduction>取消生产</CommandCancelProduction>
<CommandCancelProductionDesc>停止当前的生产流程。</CommandCancelProductionDesc>
<Producing>正在生产 {0}</Producing>
<TimeLeft>剩余时间</TimeLeft>
<ProjectedQuality>预计品质</ProjectedQuality>
<TemperaturePenalty>温度惩罚</TemperaturePenalty>
<NotProducing>未在生产</NotProducing>
</LanguageData>