Severity Change When Hit - KonradHeinser/EBSGFramework GitHub Wiki
This hediff comp allows you to alter the severity of a hediff whenever the pawn is hit. The basic comp setup looks like this:
<comps>
<li Class="EBSGFramework.HediffCompProperties_SeverityChangeWhenDamaged">
</li>
</comps>
There are two ways this can increase severity, though they aren't mutually exclusive if you wish to include both of them
- severityChange : Default (0) : Static amount to change the severity by
- severityChangeFactor : Default (0) : Amount to multiply the damage amount by. For example, if set to 0.01, a damage of 10 increases severity by 0.1
There are additional nodes that can be used to add conditionals for when the severity change can occur:
- cooldownTicks : Default (10) : Requires a certain number of ticks occur between hits to avoid rapid increases/decreases caused by extremely fast weapons being used against the pawn, or to add a limiter for any other purpose
- validSeverity : Default (0) : Causes the effect to only activate when in this range. If a single value is entered, then any severity above that number will be considered valid
- validDamageDefs : A list of DamageDefs that trigger this comp
- forbiddenDamageDefs : List of DamageDefs that prevent this comp from triggering. If using validDamageDefs, this won't do anything
This example goes up slowly over the course of a quadrum, but drops rapidly if the pawn suffers flame or burn damage:
<HediffDef>
<defName>AMX_Barkskin</defName>
<label>barkskin</label>
<description>.</description>
<everCurableByItem>false</everCurableByItem>
<hediffClass>HediffWithComps</hediffClass>
<initialSeverity>0.001</initialSeverity>
<minSeverity>0.001</minSeverity>
<stages>
<li>
<statFactors>
<MoveSpeed>0.8</MoveSpeed>
</statFactors>
<statOffsets>
<ArmorRating_Sharp>0.5</ArmorRating_Sharp>
<ArmorRating_Blunt>0.2</ArmorRating_Blunt>
<PawnBeauty>-2</PawnBeauty>
</statOffsets>
<multiplyStatChangesBySeverity>True</multiplyStatChangesBySeverity>
</li>
</stages>
<comps>
<li Class="EBSGFramework.HediffCompProperties_SeverityChangeWhenDamaged">
<severityChangeFactor>-0.1</severityChangeFactor>
<validDamageDefs>
<li>Flame</li>
<li>Burn</li>
</validDamageDefs>
</li>
<li Class="HediffCompProperties_SeverityPerDay">
<severityPerDay>20</severityPerDay>
</li>
</comps>
</HediffDef>