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

catalog StatCatalog
handlers EffectHandlers

Fields

Applied

public readonly List<AppliedEffect> Applied

Field Value

List<AppliedEffect>

Catalog

public readonly StatCatalog Catalog

Field Value

StatCatalog

CurrentWave

public int CurrentWave

Field Value

int

Diagnostics

public readonly List<EffectDiagnostic> Diagnostics

Field Value

List<EffectDiagnostic>

Evaluation

Configuration is immutable while in use. Call Invalidate after editing its fields.

public EffectEvaluationSettings Evaluation

Field Value

EffectEvaluationSettings

Handlers

public readonly EffectHandlers Handlers

Field Value

EffectHandlers

Source

public IStatSource Source

Field Value

IStatSource

Store

public readonly EffectStore Store

Field Value

EffectStore

Unhandled

Custom effects whose handler id is not registered. They change nothing.

public readonly List<Effect> Unhandled

Field Value

List<Effect>

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

List<Effect>

Properties

Revision

public long Revision { get; }

Property Value

long

Methods

Add(Effect)

Applies effects in input order and records application tokens for evaluation, lifetime and undo.

public AppliedEffect Add(Effect effect)

Parameters

effect Effect

Returns

AppliedEffect

Add(IEnumerable<Effect>)

Applies effects in input order and records application tokens for evaluation, lifetime and undo.

public StatBuild Add(IEnumerable<Effect> effects)

Parameters

effects IEnumerable<Effect>

Returns

StatBuild

AdvanceCombatTicks(int)

Advances tick-limited applications only by active combat ticks and returns the expiry count.

public int AdvanceCombatTicks(int ticks)

Parameters

ticks int

Returns

int

EndWave()

Removes wave-scoped applications at the combat boundary and returns the removal count.

public int EndWave()

Returns

int

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

marker string
into List<ConversionOutcome>

ExpireWave(int)

Removes applications whose authored wave lifetime has expired and returns the removal count.

public int ExpireWave(int wave)

Parameters

wave int

Returns

int

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

id string
sourceKey Func<AppliedEffect, string>

Returns

StatExplanation

Get(string)

Final value: base value + effects, clamped to the stat's limits.

public int Get(string id)

Parameters

id string

Returns

int

GetUnclamped(string)

Base value + effects without the limits, for UI that shows "80 (max 75)".

public int GetUnclamped(string id)

Parameters

id string

Returns

int

Inspect(string)

Returns the current layer-by-layer value snapshot and diagnostics for one stat.

public StatValue Inspect(string id)

Parameters

id string

Returns

StatValue

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

applied AppliedEffect

Returns

bool

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

effect Effect
state EffectLeaseState

Returns

AppliedEffect

SaveLease(AppliedEffect)

Captures one application lifetime and state for transfer without executing its handler again.

public EffectLeaseState SaveLease(AppliedEffect token)

Parameters

token AppliedEffect

Returns

EffectLeaseState

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)

Parameters

effect Effect
input float
output float

Returns

bool