Support live attribute restoration mechanics

This commit is contained in:
JB
2026-07-27 21:32:04 -04:00
parent 36dd018a4a
commit 568e46cd05
19 changed files with 979 additions and 31 deletions
+9 -2
View File
@@ -2009,8 +2009,15 @@ script. State rows expose label, agent or target scope, initial value, bounds,
best-case value, and optional expiry. Outcome rows expose kind, target scope,
Attribute or resource when applicable, value basis, state scaling, phase, and
every source-specific value column. The Value Model control supports static
values, event fields, reducer output, source-defined scenario controls, and OS
Protocol upgrade scaling where the source permits it.
values, live Attribute percentages, event fields, reducer output, source-defined
scenario controls, and OS Protocol upgrade scaling where the source permits it.
Selecting a live Attribute uses the shared searchable single-assignment pattern
and displays the Attribute's unit. Label the percentage-normalized model
`ATTRIBUTE ÷ 100` so authors can see the transform applied to the stored value.
Restoration outcomes also expose an
`INSTANT` or `CONTINUOUS` segmented choice. Continuous delivery reveals one
required duration field and describes the configured value as the total
delivered across that duration; switching back to instant clears the duration.
Action Family recipes are optional authoring starters. Present the recipe
catalog as a searchable assignment with only the parameters required by the
+18 -2
View File
@@ -425,8 +425,10 @@ The program graph uses three child tables:
band, and phase: `on_event`, `after_event`, `on_enter`, `on_exit`, or
`while_active`. One typed value or expression exists for every variant
required by the owning source. The common value models are static values,
event-field values, reducer output, source-defined scenario values, and OS
Protocol upgrade scaling.
live Attribute percentages, event-field values, reducer output,
source-defined scenario values, and OS Protocol upgrade scaling. Restoration
outcomes may deliver their total immediately or continuously over an explicit
duration.
The generic runtime in `src/lib/calculations/mechanic.ts` processes combat events
in timestamp order. Predicates decide whether an event enters a clause. Reducers
@@ -434,6 +436,20 @@ convert event streams into activations or derived values. The runtime applies
state mutations, enforces pool bounds and expiry, emits outcomes in phase order,
and records telemetry for each activation.
Live Attribute references use a stable Attribute ID and read the authoritative
loadout total that the builder captures for the evaluation pass. Percentage
Attributes retain their displayed units, so an expression that applies a
coefficient to a percentage divides the Attribute value by 100. Evaluation
fails when the loadout does not supply a referenced Attribute; the runtime does
not substitute zero.
Continuous restoration resolves the outcome's total when the branch activates,
then delivers that total at a constant rate over the configured duration.
Activations create independent streams, overlapping streams add, and restoration
above the resource maximum is lost when it occurs. The runtime integrates
delivery at event and expiry boundaries before processing the event at that
timestamp, which keeps results independent of an arbitrary tick interval.
Periodic behavior requires an interval in the reducer. The runtime does not
infer a one-second cadence from missing data. A mechanic with an unknown cadence
uses `requires_assumptions`, identifies the missing input, and stays out of the