Skip to main content

IndirectStatModifier

A class in Root.Township, Alta.StatSystem.

Combines timed IndirectModifiers on one stat into a single StatModifier, by summing their values and passing the sum through the stat's indirect modification curve. Owned by a StatManager; saved with it.

Constructors​

MemberWhat it is
IndirectStatModifier(Stat targetStat, StatManager manager)Creates an IndirectStatModifier from targetStat and manager.

Fields​

6 private and internal fields
MemberWhat it is
private StatModifier appliedModifierThe single stat modifier applied for the combined value, or null.
private static Logger loggerNLog logger for this class.
private StatManager managerThe stat manager that owns the stat.
private Stat targetStatThe stat being changed.
private HashSet<IndirectModifier> trackedModifiersThe indirect modifiers in effect.
private float valueSum of the tracked modifiers' values, before the curve.

Events​

1 private and internal event
MemberWhat it is
private event Action UpdatedPrivate event that calls each tracked modifier's Update.

Methods​

MemberWhat it is
void Load(StatManagerSaveData.IndirectStatModifier data)Re-registers saved modifiers, advanced by the time since saving, skipping those that ran out.
void RegisterModifier(IndirectModifier modifier)Starts tracking an indirect modifier and adds its value to the sum.
StatManagerSaveData.IndirectStatModifier Save()Saves the stat, the current time and each tracked modifier.
5 private and internal methods
MemberWhat it is
private void Changed()Updates or creates the applied modifier from the curve when there are tracked modifiers, or removes it when there are none.
private void ChangedModifier(IndirectModifier modifier)Adds a tracked modifier's change in value to the sum.
private void Clean(StatManager manager)On stat manager reset, drops all tracked modifiers and removes the applied one.
private void FinishedModifier(IndirectModifier modifier)Removes a finished modifier and its value from the sum.
private void Update(StatManager manager)On each stat manager update, updates every tracked modifier.

Used in​

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