PropertyModifierSet ​
Inherits: RefCounted
The modifiers on the properties of one ability, use strategy or targeting strategy (cooldown, cost, cast time, range ...). Each modifier remembers where it came from, so two sources stack and one of them can be taken away again without touching the other. The result is resolved in a fixed order, whatever order the modifiers arrived in: 1. flat: ADD and MINUS are summed and added to the base value 2. percent: PERCENTAGE_INCREASE and PERCENTAGE_DECREASE are summed (+20 and -20 cancel) and applied to that 3. MULTIPLY: the factors are multiplied in 4. SET_VALUE: if there is one, it wins (the newest one) See docs/systems/effects-and-abilities.md, section 3.
Methods ​
void | add( source: Variant, property: String, calculation: int, value: float ) |
void | remove_source( source: Variant, property: String = "" ) |
bool | has_property( property: String ) |
bool | is_empty() |
void | clear() |
float | resolve( property: String, base: float, extra: Array = [] ) |
Method descriptions ​
void add( source: Variant, property: String, calculation: int, value: float ) ​
Adds a modifier. source is anything that identifies the origin (an effect instance, a stat effect, a string)
void remove_source( source: Variant, property: String = "" ) ​
Takes away every modifier a source put on (one property, or all of its properties)
bool has_property( property: String ) ​
Does a modifier change this property?
bool is_empty() ​
Does the set have no modifiers?
void clear() ​
Removes every modifier.
float resolve( property: String, base: float, extra: Array = [] ) ​
The base value with every modifier of the property applied. extra holds entries of the same shape that are not stored in the set (the ability modifiers of an entity's stats are worked out live from its stats)