Hediffs on Removal - KonradHeinser/EBSGFramework GitHub Wiki
This hediff comp creates other hediffs when the attached hediff is removed. The basic comp looks like this:
<comps>
<li Class="EBSGFramework.HediffCompProperties_HediffsOnRemoval">
<hediffsToGive>
<li>
</li>
</hediffsToGive>
</li>
</comps>
These are the options available:
- hediffsToGive : A special list of items that handles hediff adding, with these as the options in each li:
- hediffDef : Each desired hediff will require its own list item
- chance : Default (1) : The chance of the hediffDef actually applying
- onlyBrain : Default (false) : Instead of applying to the entire body, it applies the hediff to the brain
- bodyParts : A list of body parts to apply the hediff to. Overrides onlyBrain
- skipExisting : Default (False) : If true and the pawn already has the hediff on all of the parts, then this hediff is skipped. If the hediff is only on some parts, the comp will still add the hediff to those parts
- replaceExisting : Default (False) : If true and the pawn already has the hediff, that hediff is removed (can trigger this comp on that hediff), and a new version of it is added
- severity : Default (1) : The severity to give, or add to the existing one if replaceExisting and skipExisting are false. If a range of values is given instead of a singular value, then a random number in that range is used for the severity. If this number is less than or equal to 0, the li is skipped unless replaceExisting is true, in which case the hediffDef is removed
- endOn : Default (End) : Determines at what point hediffs are done being added. The options are End (end of the list), Success (any hediffs are marked as added), Fail (chance failed or the hediffs were psychic but couldn't be added due to psychic sensitivity being 0), FailIgnorePsychic (chance failed)
- validSeverity : Severity required for the hediffs to be added. Can be either a single value or a range (i.e. 0~1.5). If a single value, then the severity must be at or above that value for the comp to activate. If using a range, then the hediff's severity must be in that range for the comp to activate
This example creates a cycle of hediffs that are added as the one before it is removed. Every time the cycle goes through ABC, it increases the D hediff by 1, allowing for a method of creating an ever increasing effect achieved by cycling through the other ones (this example can only remove hediffs with dev mode, but could be changed to be more automatic, triggered by items, or triggered by abilities)
<HediffDef>
<defName>A</defName>
<label>a</label>
<description>Start of the cycle</description>
<everCurableByItem>false</everCurableByItem>
<initialSeverity>0.001</initialSeverity>
<stages />
<hediffClass>HediffWithComps</hediffClass>
<scenarioCanAdd>false</scenarioCanAdd>
<comps>
<li Class="EBSGFramework.HediffCompProperties_HediffsOnRemoval">
<hediffsToGive>
<li>
<hediffDef>B</hediffDef>
</li>
</hediffsToGive>
</li>
</comps>
</HediffDef>
<HediffDef>
<defName>B</defName>
<label>b</label>
<description>A middle step</description>
<everCurableByItem>false</everCurableByItem>
<initialSeverity>0.001</initialSeverity>
<stages />
<hediffClass>HediffWithComps</hediffClass>
<scenarioCanAdd>false</scenarioCanAdd>
<comps>
<li Class="EBSGFramework.HediffCompProperties_HediffsOnRemoval">
<hediffsToGive>
<li>
<hediffDef>C</hediffDef>
</li>
</hediffsToGive>
</li>
</comps>
</HediffDef>
<HediffDef>
<defName>C</defName>
<label>c</label>
<description>Adds the last hediff and starts the next cycle</description>
<everCurableByItem>false</everCurableByItem>
<initialSeverity>0.001</initialSeverity>
<stages />
<hediffClass>HediffWithComps</hediffClass>
<scenarioCanAdd>false</scenarioCanAdd>
<comps>
<li Class="EBSGFramework.HediffCompProperties_HediffsOnRemoval">
<hediffsToGive>
<li>
<hediffDefs>
<li>D</li>
<li>A</li>
</hediffDefs>
</li>
</hediffsToGive>
</li>
</comps>
</HediffDef>
<HediffDef>
<defName>D</defName>
<label>d</label>
<description>End of the line</description>
<everCurableByItem>false</everCurableByItem>
<initialSeverity>0.001</initialSeverity>
<stages />
<scenarioCanAdd>false</scenarioCanAdd>
</HediffDef>