TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches
Terraria.ModLoader.StatModifier Struct Reference
+ Collaboration diagram for Terraria.ModLoader.StatModifier:

Public Member Functions

 StatModifier ()
 
 StatModifier (float additive, float multiplicative, float flat=0f, float @base=0f)
 
override bool Equals (object obj)
 
override int GetHashCode ()
 
float ApplyTo (float baseValue)
 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:
 
StatModifier CombineWith (StatModifier m)
 
StatModifier Scale (float scale)
 

Static Public Member Functions

static StatModifier operator+ (StatModifier m, float add)
 By using the add operator, the supplied additive modifier is combined with the existing modifiers. For example, adding 0.12f would be equivalent to a typical 12% damage boost. For 99% of effects used in the game, this approach is used.
 
static StatModifier operator- (StatModifier m, float sub)
 By using the subtract operator, the supplied subtractive modifier is combined with the existing modifiers. For example, subtracting 0.12f would be equivalent to a typical 12% damage decrease. For 99% of effects used in the game, this approach is used.
 
static StatModifier operator* (StatModifier m, float mul)
 The multiply operator applies a multiplicative effect to the resulting multiplicative modifier. This effect is very rarely used, typical effects use the add operator.
 
static StatModifier operator/ (StatModifier m, float div)
 
static StatModifier operator+ (float add, StatModifier m)
 
static StatModifier operator* (float mul, StatModifier m)
 
static bool operator== (StatModifier m1, StatModifier m2)
 
static bool operator!= (StatModifier m1, StatModifier m2)
 

Public Attributes

float Base
 An offset to the base value of the stat. Directly applied to the base stat before multipliers are applied.
 
float Flat
 Increase to the final value of the stat. Directly added to the stat after multipliers are applied.
 

Static Public Attributes

static readonly StatModifier Default = new StatModifier()
 

Properties

float Additive [get, private set]
 The combination of all additive multipliers. Starts at 1.
 
float Multiplicative [get, private set]
 The combination of all multiplicative multipliers. Starts at 1. Applies 'after' all additive bonuses have been accumulated.
 

Detailed Description

Definition at line 3 of file StatModifier.cs.


The documentation for this struct was generated from the following file: