Give Multiple Hediffs - KonradHeinser/EBSGFramework GitHub Wiki
This acts like Vanilla's GiveHediff, but allows for a lot more options. Each individual hediff can be assigned the same nodes as what GiveHediff would give, so for example, you can make it apply buff A to both target and caster, buff B to only target, and buff C to only caster, all in one ability comp. The hediff comp accepts one input, a list of hediffsToGive. The hediff to give nodes are:
<comps>
<li Class="EBSGFramework.CompProperties_AbilityGiveMultipleHediffs">
<hediffsToGive>
<li>
</li>
</hediffsToGive>
</li>
</comps>
These are the options available:
- successChance : A special item that dictates the chance of success. If you don't add this to the comp, then it will always work. If this fails, then none of the hediff chances are checked, even if they have individual chances as well
- 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
- successChance : A special item that dictates the chance of success. This takes the place of chance if added to the item (changing chance will no longer change the chance, and endOn checks the results of this), and if neither this nor chance are added to the item, the hediff is always added (assuming the psychic check passes)
- psychic : Default (False) : The hediff is only added to pawns which are not psychically deaf (in the stat sense, not the trait/gene sense)
- 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
- applyToSelf : Default (false) : Applies this hediff to the caster, regardless of the selected target
- applyToTarget : Default (true) : Applies this hediff to the target. Usually no reason to set this to false due to the below node
- onlyApplyToSelf : Default (false) : Equivalent to setting applyToTarget to false, and applyToSelf to true, just does both in a single node
- 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)
Example of comp in an ability that adds those generic buffs mentioned earlier.
<comps>
<li Class="EBSGFramework.CompProperties_AbilityGiveMultipleHediffs">
<hediffsToGive> <!--List includes most mundane injuries, excluding lost parts-->
<li> <!--Imaginary BuffA gives bonuses to both pawns, and starts with a severity of 10.-->
<hediffDef>BuffA</hediffDef>
<applyToSelf>true</applyToSelf>
<replaceExisting>true</replaceExisting>
<severity>10</severity>
</li>
<li> <!--Imaginary BuffB doesn't have anything special going on, just applies to the target at 1 severity-->
<hediffDef>BuffB</hediffDef>
</li>
<li> <!--Imaginary BuffC acts similar to B, but is only applied to the caster-->
<hediffDef>BuffC</hediffDef>
<onlyApplyToSelf>true</onlyApplyToSelf>
</li>
</hediffsToGive>
</li>
</comps>