-
Notifications
You must be signed in to change notification settings - Fork 3
Damage Modification
Athena supports damage modification via DamageModifierExtension mod extension. It can be applied to pawns, any Thing that deals damage, guns, melee weapons, apparel and hediffs.
public class DamageModifierExtension: DefModExtension
{
// List of possible modification effects that affect outgoing damage
public List<DamageModificator> outgoingModifiers = new List<DamageModificator>();
// List of possible modification effects that affect outgoing damage
public List<DamageModificator> incomingModifiers = new List<DamageModificator>();
// Passive outgoing damage modifier that's always applied
public float outgoingDamageMultiplier = 1f;
// Passive incoming damage modifier that's always applied
public float incomingDamageMultiplier = 1f;
}You can choose what enemies or factions you want to deal increased(or decreased) damage to via AmplificationType objects:
public class DamageModificator
{
// List of FleshTypeDefs that are required to trigger the effect
public List<FleshTypeDef> fleshTypes;
// List of PawnKinds that are required to trigger the effect
public List<PawnKindDef> pawnKinds;
// List of ThingDefs that are required to trigger the effect
public List<ThingDef> thingDefs;
// List of HediffDefs that are required to trigger the effect
public List<HediffDef> hediffDefs;
// Faction that's required to trigger the effect
public FactionDef factionDef;
// List of genes that are would trigger the effect
public List<GeneDef> geneDefs;
// List of mutually exclusive effects. If any effect with a common element in this field has been applied, this effect won't apply
public List<string> excluded;
// Same as above, but applies to all damage amplification from this pawn/object, it's apparel, it's hediffs, etc. Does not intercept with excluded.
public List<string> excludedGlobal;
// List of target's StatDefs that affect the damage
public List<StatDef> targetStatDefs;
// List of attacker's StatDefs that affect the damage
public List<StatDef> attackerStatDefs;
// Number by which the damage is modified when the conditions above are met
public float modifier = 1f;
// Number by which the damage is passively offset when the conditions above are met. Applied after all modifiers.
public float offset = 0f;
}Stuns are also affected by these changes (Stun and EMP damage defs).
You can also use incomingModifiers and incomingDamageMultiplier to modify incoming damage. In that case checks are instead applied to the instigator of the damage, be that a pawn, turret, or something else.
If you have more than one def field, then only targets which fit all the criteria will trigger the effect. In case you want to make effects mutually exclusive, you could add a string of your choice to excluded and whenever one effect with that string activates all other effects won't.
Here's an example of two mutually exclusive effects, first of which only triggers against insects with heart attacks and another one that triggers against members of the mechanoid faction.
<modExtensions>
<li Class="AthenaFramework.DamageModifierExtension">
<outgoingModifiers>
<li>
<fleshTypes>
<li>Insectoid</li>
</fleshTypes>
<hediffDefs>
<li>HeartAttack</li>
</hediffDefs>
<excluded>
<li>HeartAttackInsectsOrMechs</li>
</excluded>
<modifier>1.5</modifier>
</li>
<li>
<factionDef>Mechanoid</factionDef>
<excluded>
<li>HeartAttackInsectsOrMechs</li>
</excluded>
<modifier>3.2</modifier>
</li>
</outgoingModifiers>
</li>
</modExtensions>There are also CompProperties_DamageModifier and HediffCompProperties_DamageModifier comps which can be used for additional features such as detailed equipment effects controls (in case you want your equipment's protection only apply to itself and not the wearer, for example) and incoming/outgoing damage scaling with hediff's severity.
Due to how game saves weapons in DamageInfo I wasn't able to make them work on guns and melee weapons
public class CompProperties_DamageModifier: CompProperties
{
// List of possible modification effects that affect outgoing damage
public List<DamageModificator> outgoingModifiers = new List<DamageModificator>();
// List of possible modification effects that affect outgoing damage
public List<DamageModificator> incomingModifiers = new List<DamageModificator>();
// Passive outgoing damage modifier that's always applied
public float outgoingDamageMultiplier = 1f;
// Passive incoming damage modifier that's always applied
public float incomingDamageMultiplier = 1f;
// Whenever the damage modification should be applied on the parent itself
public bool workOnParent = true;
// Whenever damage modifications should be applied on pawns that equips the parent
public bool workOnEquip = true;
// Whenever damage modifications should be applied on the parent when it's equipped
public bool workWhenEquipped = false;
} public class HediffCompProperties_DamageModifier : HediffCompProperties
{
// List of possible modification effects that affect outgoing damage
public List<DamageModificator> outgoingModifiers = new List<DamageModificator>();
// List of possible modification effects that affect outgoing damage
public List<DamageModificator> incomingModifiers = new List<DamageModificator>();
// Passive outgoing damage modifier that's always applied
public float outgoingDamageMultiplier = 1f;
// Passive incoming damage modifier that's always applied
public float incomingDamageMultiplier = 1f;
// Curves for outgoing and incoming damage multiplication based on hediff's severity
public SimpleCurve outgoingDamageCurve;
public SimpleCurve incomingDamageCurve;
}- Stats
- Gene Templates
- Pawn Group Utility
- Under Group Combat Pressure Think Node
- Min Prey Body Size
- Modular Things
- Gene Locked Recipes and Buildings
- Additional Gene Drops
- Angle Based Shotguns
- Following ("Running") Beams
- Pawn Turret Extensions
- Damage Modification
- Advanced Tools
- Shockwave Attacks
- Miniguns
- Elite Shot
- AOE Hediff Explosion Projectiles
- Frag Grenades
- Cooldown Graphics
- Scatter Things Ability
- Abilities on Equipment
- Burst Projectile Abilities
- Reloadable Abilities
- Shockwave Ability
- Projectile Comps
- Projectile Impact Effects
- Projectile Trails
- Bouncy Projectiles
- Spawner Projectiles
- Roof Collapse Projectiles
- Scattershot Projectiles
- Custom Body Graphic For Apparel
- Multi Layered Apparel Graphics
- Advanced Equipment Shields
- Equipment with Prerequisites
- Advanced Armor
- Gene-based Apparel Textures
- Gene Locked Equipment
- Additional Apparel Graphics Comps
- Hediff Giver Extension
- Bomb Hediff Comp
- Remove On Severity Comp
- Renderable Hediffs
- Shield Hediffs
- Armored Hediffs
- Disableable Hediffs
- Modular Hediffs
- Hediffs with Prerequisites
- Singular Hediff Abilities
- Hediff On Damage
- Additional Hediff Graphics Comps
- Caching
- IArmored
- IDamageResponse
- IRenderable
- IStageOverride
- IStatModifier
- IProjectile
- IPreventEquip
- IHediffGraphicGiver and IEquippableGraphicGiver
- IDamageModifier
- IColorSelector
- IBodyModifier