180 lines
7.3 KiB
XML
180 lines
7.3 KiB
XML
<?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_SpawnEffecterOnDestroy">
|
||
<effect>CocoonDestroyed</effect>
|
||
</li>
|
||
<li Class="CompProperties_SpawnerFilth">
|
||
<filthDef>Filth_Slime</filthDef>
|
||
<spawnCountOnSpawn>10</spawnCountOnSpawn>
|
||
<spawnMtbHours>4</spawnMtbHours>
|
||
<spawnRadius>5</spawnRadius>
|
||
</li>
|
||
|
||
<!-- 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>ArachnaeNode_Race_WeaponSmith</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>
|