Severity by Other Hediff Severities - KonradHeinser/EBSGFramework GitHub Wiki
This hediff comp sets the hediff's severity based on a sum of the results of various hediff sets. To start with, this is what the basic comp looks like:
<comps>
<li Class="EBSGFramework.HediffCompProperties_SeverityByOtherHediffSeverities">
</li>
</comps>
To expand on what I meant when I said "sum of the results of various hediff sets", the way this comp works is by comparing all of the hediffs the pawn has with a list that you specify. If the pawn has the hediff, then it multiplies the first match's severity by the factor, and adds it to the total. Once it's done checking going through all hediffSets, it sets the hediff severity to the total
These are the tags that are used:
- baseSeverity : Default (0.1) : The base amount that is added to the total at the beginning. If this is set to 0 and all of the hediff sets result in 0 or lower, then the hediff will go away
- hediffSets : Special item list with each item having these tags available
- hediff : The HediffDef to check for
- factor : Default (1) : The multiplier on the hediff's severity that gets the result to add. For example, if this is 2 and the hediff's severity is 0.16, then this hediff set adds 0.32 to the final severity. If this is -2, then it adds -0.32 to the final severity, or subtracts 0.32 if you prefer
- minResult : Default (0) : The lowest amount that the factor can result in (or highest if negative factor). For example, using the above example with the factor of 2 resulting in 0.32, if this is set to 0.4, then the final amount added to the total would be 0.4
- maxResult : Default (3.4 * 10^38) : The highest amount that the factor can result in (or lowest if negative factor). For example, using the above example with the factor of 2 resulting in 0.32, if this is set to 0.2, then the final amount added to the total would be 0.2
- missingHediffResult : Default (0) : If the pawn doesn't have the hediff, this is the amount added
This example gives a pawn regeneration that scales based on bloodloss. Because the factor is negative, the more blood loss they have, the slower they heal
<HediffDef>
<defName>BloodBasedRegeneration</defName>
<label>bloody regeneration</label>
<description>There was never a description here.</description>
<everCurableByItem>false</everCurableByItem>
<initialSeverity>1</initialSeverity>
<hediffClass>HediffWithComps</hediffClass>
<scenarioCanAdd>false</scenarioCanAdd>
<maxSeverity>1.0</maxSeverity>
<stages>
<li>
<becomeVisible>false</becomeVisible>
</li>
<li>
<minSeverity>0.25</minSeverity>
<statFactors>
<InjuryHealingFactor>2</InjuryHealingFactor>
</statFactors>
</li>
<li>
<minSeverity>0.75</minSeverity>
<statFactors>
<InjuryHealingFactor>3</InjuryHealingFactor>
</statFactors>
</li>
</stages>
<comps>
<li Class="EBSGFramework.HediffCompProperties_SeverityByOtherHediffSeverities">
<baseSeverity>1</baseSeverity>
<hediffSets>
<li>
<hediff>BloodLoss</hediff>
<factor>-1</factor>
</li>
</hediffSets>
</li>
<li Class="EBSGFramework.HediffCompProperties_TieredRegeneration">
<healWhileRegrowing>True</healWhileRegrowing>
<regenSets>
<li>
<ticksToRegrowPart>2500</ticksToRegrowPart>
<repeatHealCount>10</repeatHealCount>
<minSeverity>0.5</minSeverity>
<healAmount>0.3</healAmount>
</li>
</regenSets>
</li>
</comps>
</HediffDef>