Give Hediff Based on Severity - KonradHeinser/EBSGFramework GitHub Wiki
This outcome doer allows you to create ingestibles that become stronger or weaker based on the severity of specified hediff(s). It contains all of the normal hediff giving ingestion options, in addition to a bunch of extra ones for altering effects. The main difference though, is that the instead of using a static severity tag, it uses a severityCurve.
<outcomeDoers>
<li Class="EBSGFramework.IngestionOutcomeDoer_GiveHediffBasedOnHediffSeverity">
<hediffDef>InsertHediffDefHere</hediffDef>
<severityCurve> <!--Sample curve that provides the same effects as the alcohol tolerance curve-->
<li>(0, 0.15)</li>
<li>(0.25, 0.122)</li>
<li>(0.5, 0.0938)</li>
<li>(0.75, 0.0656)</li>
<li>(1, 0.0375)</li>
</severityCurve>
</li>
</outcomeDoers>
The other three tags that stuck around from the vanilla IngestionOutcomeDoer_GiveHediff are these:
- divideByBodySize : Severity is divided by body size. This occurs after checking the severity curve and before handling chemical stuff (if applicable)
- toleranceChemical : The ChemicalDef related to this ingestion. This is only used for drugs
- multiplyByGeneToleranceFactors : Causes specific genes to have effects on the severity if there is a toleranceChemical
The final additions to mention here are options that allow you to check for other hediffs similar to what tolerance does rather than using the hediff itself. As a warning checkedHediffList involves a lot of math and reading to fully understand, but the short version is that it normally adds the effects of each hediff severities on its list, and the names of the options below it cause it to do exactly what they imply:
- checkedHediffDef : Default (hediffDef) : This can be used to make the ingestion doer check a specific other HediffDef
- checkedHediffList : This is a list of hediff defs, and has several options related to it. The default behavior is to change severity based on every hediff present. If multiple hediffs have the same severity, then that point is added to the total multiple times.
For example, if there are 4 hediffs at severity 1, 1, 0.5, and 0.25, the curve point for each is used. If we are using the above curve, that means the final severity used is 0.2908 (0.0375 + 0.0375 + 0.0938 + 0.122).
- getSeveritySum : Default (False) : Instead of acting on each severity individually, it gets the sum of all the severities. It is recommended you have a much longer severity curve (or a positive directional one), because if we use the above example, then we land outside the curve at 2.75 total severity (1 + 1 + 0.5 + 0.25), which would result in losing around 0.16 severity instead of gaining severity (I won't make you look at the math, just trust me on this one).
- useHighest : Default (False) : Good news is that we're out of the long explanation portion because this just does exactly what it says. If we use the above example, we get the curve point attached to a severity of 1, which increases severity by 0.15.
- justFirst : Default (False) : Only uses the first match. Assuming the list I gave before was in order of first found to last, we would end up with the 1 point again.
For an example, this is what the outcomeDoers of alcohol would look like if it wanted to reference the hediff directly instead of the chemical, and had an overly thorough severityCurve. This is not recommended if you're just pointing to a chemical tolerance, but you could link both the chemical and a separate tolerance if you want two separate tolerances to take effect at the same time, or something along those lines. To save you from having to read everything, I've only included the outcome doers themselves:
<outcomeDoers>
<li Class="EBSGFramework.IngestionOutcomeDoer_GiveHediffBasedOnHediffSeverity">
<hediffDef>AlcoholHigh</hediffDef>
<checkedHediffDef>AlcoholTolerance</checkedHediffDef>
<severityCurve>
<li>(0, 0.15)</li>
<li>(0.25, 0.122)</li>
<li>(0.5, 0.0938)</li>
<li>(0.75, 0.0656)</li>
<li>(1, 0.0375)</li>
</severityCurve>
</li>
<li Class="IngestionOutcomeDoer_GiveHediff">
<hediffDef>AlcoholTolerance</hediffDef>
<severity>0.016</severity>
<divideByBodySize>true</divideByBodySize>
<multiplyByGeneToleranceFactors>true</multiplyByGeneToleranceFactors>
</li>
</outcomeDoers>