Class StatBuild
- Namespace
- SurvivorsMaker.Core
- Assembly
- SurvivorsMaker.Core.dll
One player's stats: a catalog of base values plus every applied effect. Read final values with Get(string); they include the base value and the stat's limits.
public sealed class StatBuild
- Inheritance
-
StatBuild
- Inherited Members
Constructors
StatBuild(StatCatalog, EffectHandlers)
public StatBuild(StatCatalog catalog = null, EffectHandlers handlers = null)
Parameters
catalogStatCataloghandlersEffectHandlers
Fields
Applied
public readonly List<AppliedEffect> Applied
Field Value
Catalog
public readonly StatCatalog Catalog
Field Value
CurrentWave
public int CurrentWave
Field Value
Diagnostics
public readonly List<EffectDiagnostic> Diagnostics
Field Value
Evaluation
Configuration is immutable while in use. Call Invalidate after editing its fields.
public EffectEvaluationSettings Evaluation
Field Value
Handlers
public readonly EffectHandlers Handlers
Field Value
Source
public IStatSource Source
Field Value
Store
public readonly EffectStore Store
Field Value
Unhandled
Custom effects whose handler id is not registered. They change nothing.
public readonly List<Effect> Unhandled
Field Value
UnknownTargets
Add/Set effects whose target is not in the catalog. They are stored but have no base value or limits.
public readonly List<Effect> UnknownTargets
Field Value
Properties
Revision
public long Revision { get; }
Property Value
Methods
Add(Effect)
Applies effects in input order and records application tokens for evaluation, lifetime and undo.
public AppliedEffect Add(Effect effect)
Parameters
effectEffect
Returns
Add(IEnumerable<Effect>)
Applies effects in input order and records application tokens for evaluation, lifetime and undo.
public StatBuild Add(IEnumerable<Effect> effects)
Parameters
effectsIEnumerable<Effect>
Returns
AdvanceCombatTicks(int)
Advances tick-limited applications only by active combat ticks and returns the expiry count.
public int AdvanceCombatTicks(int ticks)
Parameters
ticksint
Returns
EndWave()
Removes wave-scoped applications at the combat boundary and returns the removal count.
public int EndWave()
Returns
ExecuteConversions(string, List<ConversionOutcome>)
Explicit boundary action; Get never spends or grants. Repeated token/marker pairs are ignored.
public void ExecuteConversions(string marker, List<ConversionOutcome> into)
Parameters
markerstringintoList<ConversionOutcome>
ExpireWave(int)
Removes applications whose authored wave lifetime has expired and returns the removal count.
public int ExpireWave(int wave)
Parameters
waveint
Returns
Explain(string, Func<AppliedEffect, string>)
Explains one cached evaluation without replaying handlers, conversions, captures or debits. Allocates only on this explicit call; Get/Inspect and tick evaluation are unchanged. Set entries are deltas from the preceding fold in their own layer. Limits follow scalar entries, then final rounding. Custom/store contributions use the net Store residual.
public StatExplanation Explain(string id, Func<AppliedEffect, string> sourceKey = null)
Parameters
idstringsourceKeyFunc<AppliedEffect, string>
Returns
Get(string)
Final value: base value + effects, clamped to the stat's limits.
public int Get(string id)
Parameters
idstring
Returns
GetUnclamped(string)
Base value + effects without the limits, for UI that shows "80 (max 75)".
public int GetUnclamped(string id)
Parameters
idstring
Returns
Inspect(string)
Returns the current layer-by-layer value snapshot and diagnostics for one stat.
public StatValue Inspect(string id)
Parameters
idstring
Returns
Invalidate()
Marks cached evaluation stale after source changes outside the tracked store revision.
public void Invalidate()
Remove(AppliedEffect)
Undoes one earlier apply. Returns false if it was not applied through this build.
public bool Remove(AppliedEffect applied)
Parameters
appliedAppliedEffect
Returns
RestoreLease(Effect, EffectLeaseState)
Caller restores each instance/effect pair once. Captured limits never re-read their source.
public AppliedEffect RestoreLease(Effect effect, EffectLeaseState state)
Parameters
effectEffectstateEffectLeaseState
Returns
SaveLease(AppliedEffect)
Captures one application lifetime and state for transfer without executing its handler again.
public EffectLeaseState SaveLease(AppliedEffect token)
Parameters
tokenAppliedEffect
Returns
TryTransform(Effect, float, out float)
Transforms a finite input with the effect recipe; false means the recipe or input is invalid.
public static bool TryTransform(Effect effect, float input, out float output)