Skip to main content

StatModifier

A class in Root.Township, Alta.StatSystem.

A modifier that adds to or multiplies one stat while it's applied. Buff and non-buff modifiers change separate parts of the stat.

Constructors​

MemberWhat it is
StatModifier(StatDefinition statDefinition, float value, bool isMultiplier = false, bool isBuff = true)Creates a StatModifier from stat, value, isMultiplier and isBuff.
StatModifier(Stat stat, float value, bool isMultiplier = false, bool isBuff = true)Creates a StatModifier from stat, value, isMultiplier and isBuff.

Fields​

1 private and internal field
MemberWhat it is
private bool isBuffWhether the modifier applies to the stat's buff values or its non-buff values. UpdateValue always changes the buff values.

Properties​

MemberWhat it is
bool IsMultiplier { get; private set; }Whether the value multiplies the stat instead of adding to it.
Stat Stat { get; private set; }The stat being changed.
StatDefinition StatDefinition { get; private set; }Which stat this modifier is for.
float Value { get; private set; }The amount added, or the multiplier.

Methods​

MemberWhat it is
override bool Initialize(StatManager manager)Finds the stat in the manager if it wasn't given one. False if the stat doesn't exist.
void UpdateValue(float value)Changes the value while applied. It always changes the buff parts, even for a non-buff modifier.
protected override void InternalApply()Adds the value to the stat's extra, or multiplies its multiplier, buff or non-buff.
protected override void InternalRemove()Undoes InternalApply.

Used in​

Members of other types that take, return or hold a StatModifier: