TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ ApplyTo()

float Terraria.ModLoader.StatModifier.ApplyTo ( float baseValue)
inline

Use this to apply the modifiers of this T:Terraria.ModLoader.StatModifier to the baseValue . You should assign the value passed in to the return result. For example:


damage = CritDamage.ApplyTo(damage)


could be used to apply a crit damage modifier to a base damage value

For help understanding the meanings of the applied values please make note of documentation for:

  • F:Terraria.ModLoader.StatModifier.Base
  • P:Terraria.ModLoader.StatModifier.Additive
  • P:Terraria.ModLoader.StatModifier.Multiplicative
  • F:Terraria.ModLoader.StatModifier.Flat

The order of operations of the modifiers are as follows:

  1. The baseValue is added to F:Terraria.ModLoader.StatModifier.Base
  2. That result is multiplied by P:Terraria.ModLoader.StatModifier.Additive
  3. The previous result is then multiplied by P:Terraria.ModLoader.StatModifier.Multiplicative
  4. Finally, F:Terraria.ModLoader.StatModifier.Flat as added to the result of all previous calculations
Parameters
baseValueThe starting value to apply modifiers to
Returns
The result of baseValue after all modifiers are applied

Definition at line 150 of file StatModifier.cs.

151 {
152 return (baseValue + Base) * Additive * Multiplicative + Flat;
153 }
float Flat
Increase to the final value of the stat. Directly added to the stat after multipliers are applied.
float Additive
The combination of all additive multipliers. Starts at 1.
float Multiplicative
The combination of all multiplicative multipliers. Starts at 1. Applies 'after' all additive bonuses ...

References Terraria.ModLoader.StatModifier.Additive, Terraria.ModLoader.StatModifier.Flat, and Terraria.ModLoader.StatModifier.Multiplicative.

Referenced by Terraria.Projectile.AI_075(), Terraria.Player.CommandForbiddenStorm(), Terraria.Player.DashMovement(), Terraria.NPC.HitModifiers.GetDamage(), Terraria.Player.HurtModifiers.GetDamage(), Terraria.NPC.HitModifiers.GetKnockback(), Terraria.Player.HurtModifiers.GetKnockback(), Terraria.Player.HorizontalMovement(), Terraria.Player.JumpMovement(), Terraria.Player.OnHurt_Part2(), Terraria.NPC.HitModifiers.ToHitInfo(), Terraria.Player.HurtModifiers.ToHurtInfo(), and Terraria.Projectile.Update().

+ Here is the caller graph for this function: