Damage Modifying Stats Extension - KonradHeinser/EBSGFramework GitHub Wiki
This extension allows you to alter outgoing and incoming damage something receives based on the stats of the attacker and/or the victim. This extension can be added to genes, weapons (for outgoing damage only), pawn races, and pawn kinds:
<modExtensions>
<li Class="EBSGFramework.DamageModifyingStatsExtension">
</li>
</modExtensions>
Before I start listing out all the options, I wanted to clarify four things now to attempt to reduce the large amount of text below
- The term StatModifier refers to something similar to what you use for statFactors and statOffsets, where the tags are the stat's defName, and the value inside is a number
- Related to the StatModifier note, StatModifiers are used as offsets. These offsets take effect after all the multipliers and divisors, and add an amount equal to the stat value times the value put within the modifier (it subtracts from the damage if a negative value is used)
- For example, if you put 3, then after all the multiplying and dividing, three times that pawn's psychic sensitivity will be added to the total (at default psychic sensitivity this means 3 damage is added to all attacks, and while at 200% 6 damage is added)
- The term StatReq refers to a special series of options only used in this framework. They always default to Always, but have a lot of options that will hopefully allow you to narrow the scope of the effects easily. The Higher and Lower refer to whether the stat in question is higher or lower than its default value, and any time it is not, it will not change the results (multiply/divide by 1 regardless of default value if you prefer)
- The options are: Higher, Lower, Pawn, PawnHigher, PawnLower, NonPawn, NonPawnHigher, NonPawnLower, Humanlike, HumanlikeHigher, HumanlikeLower
- For those curious, when multiple extensions exist (i.e. a weapon, a gene, and a pawn kind all trying to influence damage), they are processed in a specific order. The modifiers that offset damage are impacted by any factor from any extension that pops up later in the order, though the chances of it coming up in most games is generally low, and ideally those using factors implement a maximum to avoid having excessive damage dealt
- The order is: Weapon, attacker race, attacker genes, attacker pawn kind, victim race, victim genes, victim pawn kind
These influence how much damage the pawn deals to others. The pawn in question is the Attacker, while the one the attack is the Target
-
outgoingAttackerFactors : A list of StatDefs that multiply the damage results
-
outAttackerFactorReq : The StatReq that influences outgoingTargetFactors
-
outgoingAttackerModifiers : A list of StatModifiers that offset the value after all the factors/divisors are applied
-
outgoingAttackerDivisors : A list of StatDefs that divide the damage of the results
-
outAttackDivReq : The StatReq that influences outgoingAttackerDivisors. If any of the listed stats are capable of going anywhere near 0, it is recommended that this be some variant of Higher, or that you use maxOutRemaining
-
outgoingTargetFactors : A list of StatDefs that multiply the damage results
-
outTargetFactorReq : The StatReq that influences outgoingTargetFactors
-
outgoingTargetModifiers : A list of StatModifiers that offset the value after all the factors/divisors are applied
-
outgoingTargetDivisors : A list of StatDefs that divide the damage of the results
-
outTargetDivReq : The StatReq that influences outgoingTargetDivisors. If any of the listed stats are capable of going anywhere near 0, it is recommended that this be some variant of Higher, or that you use maxOutRemaining
-
maxOutRemaining : The maximum amount of damage that can be dealt. If multiple extensions are influencing this, the last one processed will determine the final limit, but each one will limit how much damage the next extension starts with. If you are using factors, or divisors with stats capable of going below 1, it is generally recommended you use this to avoid extreme damage values
-
minOutRemaining : Default (0) : The minimum amount of damage that should be dealt. If multiple extensions are influencing this, the last one processed will determine the final limit, but each one give a base amount of damage for the next extension to start with.
These influence how much damage the pawn receives from others. The pawn in question is the Target, while the other pawn is the Attacker
-
incomingAttackerFactors : A list of StatDefs that multiply the damage results
-
inAttackerFactorReq : The StatReq that influences incomingTargetFactors
-
incomingAttackerModifiers : A list of StatModifiers that offset the value after all the factors/divisors are applied
-
incomingAttackerDivisors : A list of StatDefs that divide the damage of the results
-
inAttackDivReq : The StatReq that influences incomingAttackerDivisors. If any of the listed stats are capable of going anywhere near 0, it is recommended that this be some variant of Higher, or that you use maxInRemaining
-
incomingTargetFactors : A list of StatDefs that multiply the damage results
-
inTargetFactorReq : The StatReq that influences incomingTargetFactors
-
incomingTargetModifiers : A list of StatModifiers that offset the value after all the factors/divisors are applied
-
incomingTargetDivisors : A list of StatDefs that divide the damage of the results
-
inTargetDivReq : The StatReq that influences incomingTargetDivisors. If any of the listed stats are capable of going anywhere near 0, it is recommended that this be some variant of Higher, or that you use maxInRemaining
-
maxInRemaining : The maximum amount of damage that can be dealt. If multiple extensions are influencing this, the last one processed will determine the final limit, but each one will limit how much damage the next extension starts with. If you are using factors, or divisors with stats capable of going below 1, it is generally recommended you use this to avoid extreme damage values
-
minInRemaining : Default (0) : The minimum amount of damage that should be dealt. If multiple extensions are influencing this, the last one processed will determine the final limit, but each one give a base amount of damage for the next extension to start with.
This example creates a variation of the revolver that gains some bonus damage based on the wielder's psychic sensitivity, but its damage is also inversely impacted by the victim's psychic sensitivity:
<ThingDef ParentName="BaseHumanMakeableGun">
<defName>Gun_PsyRevolver</defName>
<label>psy-revolver</label>
<description>An ancient pattern double-action revolver. It's not very powerful, but has a decent range for a pistol and is quick on the draw.\n\nThis particular variant can supercharge its bullets by using the wielder's psychic sensitivity, but the bullets will always be weaker against targets that have heightened psychic sensitivity.</description>
<possessionCount>1</possessionCount>
<graphicData>
<texPath>Things/Item/Equipment/WeaponRanged/Revolver</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<uiIconScale>1.4</uiIconScale>
<soundInteract>Interact_Revolver</soundInteract>
<statBases>
<WorkToMake>4000</WorkToMake>
<Mass>1.4</Mass>
<AccuracyTouch>0.80</AccuracyTouch>
<AccuracyShort>0.75</AccuracyShort>
<AccuracyMedium>0.45</AccuracyMedium>
<AccuracyLong>0.35</AccuracyLong>
<RangedWeapon_Cooldown>1.6</RangedWeapon_Cooldown>
</statBases>
<weaponTags>
<li>SimpleGun</li>
<li>Revolver</li>
</weaponTags>
<weaponClasses>
<li>RangedLight</li>
</weaponClasses>
<costList>
<Steel>30</Steel>
<ComponentIndustrial>2</ComponentIndustrial>
</costList>
<recipeMaker>
<skillRequirements>
<Crafting>3</Crafting>
</skillRequirements>
<displayPriority>400</displayPriority>
</recipeMaker>
<verbs>
<li>
<verbClass>Verb_Shoot</verbClass>
<hasStandardCommand>true</hasStandardCommand>
<defaultProjectile>Bullet_Revolver</defaultProjectile>
<warmupTime>0.3</warmupTime>
<range>25.9</range>
<soundCast>Shot_Revolver</soundCast>
<soundCastTail>GunTail_Light</soundCastTail>
<muzzleFlashScale>9</muzzleFlashScale>
</li>
</verbs>
<tools>
<li>
<label>grip</label>
<capacities>
<li>Blunt</li>
</capacities>
<power>9</power>
<cooldownTime>2</cooldownTime>
</li>
<li>
<label>barrel</label>
<capacities>
<li>Blunt</li>
<li>Poke</li>
</capacities>
<power>9</power>
<cooldownTime>2</cooldownTime>
</li>
</tools>
<modExtensions>
<li Class="EBSGFramework.DamageModifyingStatsExtension">
<!--This will add more damage to the bullet based on psychic sensitivity without making it mandatory for the wielder to have some-->
<outgoingAttackerModifiers>
<PsychicSensitivity>3</PsychicSensitivity>
</outgoingAttackerModifiers>
<outgoingTargetDivisors>
<!--Divisors means higher psychic sensitivity means lower damage. Factors is the reverse-->
<li>PsychicSensitivity</li>
</outgoingTargetDivisors>
<outTargetDivReq>Humanlike</outTargetDivReq>
<!--Non-humanlikes generally don't have psychic sensitivity, so restricting this avoids making the weapon too strong-->
<maxOutRemaining>30</maxOutRemaining>
<!--Because PsychicSensitivity can reach 0, a maximum needs to be set to avoid extreme damage amounts-->
</li>
</modExtensions>
</ThingDef>