暂存
This commit is contained in:
Binary file not shown.
@@ -72,7 +72,7 @@
|
||||
</AbilityDef>
|
||||
|
||||
<AbilityDef>
|
||||
<defName>ARA_EggSpew</defName>
|
||||
<defName>ARA_EggSpewBioforgeIncubator</defName>
|
||||
<label>生育培育卵</label>
|
||||
<description>工艺卵</description>
|
||||
<iconPath>UI/Commands/EggSpew</iconPath>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Defs>
|
||||
|
||||
<JobDef>
|
||||
<defName>ARA_IncubateJob</defName>
|
||||
<defName>ARA_StartInteractiveProduction</defName>
|
||||
<driverClass>ArachnaeSwarm.JobDriver_StartProduction</driverClass>
|
||||
<reportString>正在启动生产 TargetA.</reportString>
|
||||
<allowOpportunisticPrefix>true</allowOpportunisticPrefix>
|
||||
|
||||
@@ -73,7 +73,72 @@
|
||||
<destroyOnSpawn>True</destroyOnSpawn>
|
||||
<minSafeTemperature>18</minSafeTemperature>
|
||||
<maxSafeTemperature>23</maxSafeTemperature>
|
||||
<!-- 通过设置一个低容量强迫玩家多次添加燃料 -->
|
||||
<fuelCapacity>10</fuelCapacity>
|
||||
|
||||
<penaltyPerDegreePerTick>0.00001</penaltyPerDegreePerTick>
|
||||
<!--
|
||||
<![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>
|
||||
<!-- Add the vanilla component to handle structural damage from extreme temperatures -->
|
||||
<li Class="CompProperties_TemperatureRuinable">
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace ArachnaeSwarm
|
||||
// When the float menu is clicked, we set the selected process on the comp,
|
||||
// so the JobDriver knows which process to start.
|
||||
this._selectedProcess = process;
|
||||
Job job = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("ARA_IncubateJob"), parent);
|
||||
Job job = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("ARA_StartInteractiveProduction"), parent);
|
||||
selPawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user