Alter Xenotype on Use by Severity - KonradHeinser/EBSGFramework GitHub Wiki
This thing comp allows you to make usable things alter a pawn's xenotype similar to the Alter Xenotype on Use, but instead of working in isolation, it relies on a hediff to know if/how to change the pawn:
<comps>
<li Class="EBSGFramework.CompProperties_UseEffectAlterXenotypeByHediffSeverity">
</li>
</comps>
These are the options available in the comp:
-
hediff : The HediffDef this comp is linked to. It is generally recommended that the hediff be little more than a storage that is dedicated solely to remembering how many are consumed unless you intend to have this alter xenotype based on situation instead of cumulative uses
-
initialSeverity : A special list that uses the XenotypeDef as the tag name, and a range of floats (or just a singular one) as the value. If a pawn has a xenotype on this list, then the first time they use one of the items they will start at a random value in the range (or the singular value) instead of starting at severityChange
- For example, if you have a series of xenotypes obtained through use of this item at 1, 5, and 9 uses, you can use this to make it so if the pawn is already xenoA, they will start at a severity of 2 instead of 1 (1 to reach the first stage + 1 for first use), and if they are already xenoB they can start at 6 instead of 1 (5 to reach the xeno + 1 for the first use). If you gave xenoB a range of 6~9, then there would be a 25% chance of the first use being the last as it would be treated as though the pawn already had 8 uses + 1 for the first one that the player actually did
-
severityChange : Default (1) : The amount of severity to give/add to the hediff. It is generally recommended that this be the only way the hediff's severity is altered unless you are very sure about what you're doing
-
xenotypes : A special list of items that determines what happens after the hediff's severity is changed
- severity : The hediff severity required for this to be the chosen set. This can be a singular value (usually if the linked hediff is just a cumulative use counter) or a range of values
- xenotype : The XenotypeDef to turn the pawn into. Technically optional if you only want to add/remove specific genes
- setXenotype : Default (True) : While true, most old genes are removed, with the only exceptions being hair and skin color endogenes. When False, only genes that are incompatible with genes from the new xenotype are removed, creating a type of hybrid that still uses the new xenotype's name
- Keep in mind that because old genes are not removed, the second or third xenotype on a list can become a merged version of the merged version of the previous xeno if this setting is set to False. This can be countered by using exclusionTags on the genes, or by designing the xenotypes to build off of each other
- removeGenes : A list of GeneDefs to remove after the xenotype is applied, assuming it isn't left blank. This is optional
- addGenes : A list of GeneDefs to add after the xenotype is applied and genes are removed, assuming either of those need to occur. This is optional
- filth : A ThingDef to create around the pawn when the comp triggers
- filthCount : Default (4-7) : How many of the filth to create, if filth is used
-
prerequisites : A special item that limits who can use the item
- hasAnyOfHediffs : List of HediffDefs that the pawn must have any one of
- hasAllOfHediffs : List of HediffDefs that the pawn must have all of
- hasNoneOfHediffs : List of HediffDefs that the pawn must have none of
- hasAnyOfGenes : List of GeneDefs that the pawn must have any one of
- hasAllOfGenes : List of GeneDefs that the pawn must have all of
- hasNoneOfGenes : List of GeneDefs that the pawn must have none of
- isAnyOfXenotype : List of XenotypeDefs that the pawn must be one of
- isNoneOfXenotype : List of XenotypeDefs that the pawn must not be one of
- skillRequirements : Special list of skills that use the SkillDef's defName for the tag, and a range of skill levels for the value. If no value is entered (i.e. ), then the condition is met as long as the skill is not disabled. Aptitude is not included in the level, so other genes won't affect this
- complexSkillRequirements : A list of special lists that use the SkillDef's defName for the tag, and a range of skill levels for the value. Each li acts similar to skillRequirements where all of skills in the li must be within the range. If any of the li's have all of their skills met, then this condition is considered met
-
sendMessage : Default (False) : Sends a generic message about the xenotype being applied
This example turns the user into a sanguophage. On the first use, the pawn becomes a bloodfeeder without ageless and deathless, but the next two uses give those genes to the pawn. Because initialSeverity is set for Hussar, they will skip the first stage when they are turned into a weaker bloodfeeder, and will just gain the Ageless gene instead. If that Hussar uses another one of the items, they will then turn into a full Sanguophage as normal:
<ThingDef ParentName="ResourceBase">
<defName>SanguophageEvolution</defName>
<label>sanguophage evolution</label>
<description>A serum that turns the pawn into a sanguophage, with some genes missing until more are used.</description>
<stackLimit>10</stackLimit>
<graphicData>
<texPath>Things/Item/Resource/DeathrestCapacitySerum</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<statBases>
<MaxHitPoints>60</MaxHitPoints>
<MarketValue>1000</MarketValue>
<DeteriorationRate>5</DeteriorationRate>
<Mass>0.50</Mass>
<Flammability>0.7</Flammability>
</statBases>
<thingCategories>
<li>Drugs</li>
</thingCategories>
<comps>
<li Class="CompProperties_Usable">
<useJob>UseArtifact</useJob>
<useLabel>Use {0_label}</useLabel>
<showUseGizmo>true</showUseGizmo>
</li>
<li Class="EBSGFramework.CompProperties_UseEffectAlterXenotypeByHediffSeverity">
<hediff>SanguophageEvolution</hediff>
<sendMessage>False</sendMessage>
<prerequisites>
<hasNoneOfGenes>
<!--All deathless pawns, sanguophage and non-sanguophage alike, can't use this item-->
<li>Deathless</li>
</hasNoneOfGenes>
</prerequisites>
<initialSeverity>
<Hussar>2</Hussar>
</initialSeverity>
<xenotypes>
<li>
<severity>1</severity>
<xenotype>Sanguophage</xenotype>
<removeGenes>
<li>Ageless</li>
<li>Deathless</li>
</removeGenes>
<!--Overrides the pawn's genes to be those of a sanguophage, then -->
</li>
<li>
<severity>2</severity>
<addGenes>
<li>Ageless</li>
</addGenes>
<!--Because this only adds a gene, gene changes from other sources will persist-->
</li>
<li>
<severity>3</severity>
<xenotype>Sanguophage</xenotype>
<!--Ensures the pawn is a true sanguophage
If other sources altered the pawn's genes between the 1st and 3rd use, those changes are overriden-->
</li>
</xenotypes>
</li>
<li Class="CompProperties_UseEffectDestroySelf" />
</comps>
<thingSetMakerTags>
<li>RewardStandardHighFreq</li>
</thingSetMakerTags>
</ThingDef>
<HediffDef>
<defName>SanguophageEvolution</defName>
<label>sanguophage evolution</label>
<description>This pawn is becoming closer to what a true sanguophage should be.</description>
<everCurableByItem>false</everCurableByItem>
<initialSeverity>1</initialSeverity>
<hediffClass>HediffWithComps</hediffClass>
<scenarioCanAdd>false</scenarioCanAdd>
<stages>
<li>
<label>Bloodfeeder</label>
<becomeVisible>false</becomeVisible>
</li>
<li>
<minSeverity>2</minSeverity>
<label>Bloodfeeder</label>
<becomeVisible>false</becomeVisible>
</li>
</stages>
<comps>
<li Class="EBSGFramework.HediffCompProperties_RemoveAtSeverities">
<severity>3</severity>
</li>
</comps>
</HediffDef>