find(state: State, id: string) → Inst
| arg | type | description |
|---|
| state | State | |
| id | string | |
newInst(state: State, def: any, now: number, dur: number, mag: number, stacks: number, opts: any) → Inst
| arg | type | description |
|---|
| state | State | |
| def | any | |
| now | number | |
| dur | number | |
| mag | number | |
| stacks | number | |
| opts | any | |
apply(state: State, def: any, opts: any?, now: number) → void
Apply `def` (a catalog effect). opts: duration, magnitude, stacks, source, point, ability.
Returns the action taken ("added", "refreshed", "stacked", "extended", "copied", "replaced",
"kept", "ignored") and the instance it acted on.
| arg | type | description |
|---|
| state | State | |
| def | any | |
| opts | any? | |
| now | number | |
modifiers(state: State, defOf: (string) → void
The stat modifiers every live instance contributes, scaled by magnitude and stacks.
| arg | type | description |
|---|
| state | State | |
| defOf | (string | |
flags(state: State, defOf: (string) → void
The set of flags (stun, silence, root, invisible, taunted, wallJump, ...) live right now.
| arg | type | description |
|---|
| state | State | |
| defOf | (string | |
tick(state: State, defOf: (string) → void
Advance to `now`: returns ticks ({ kind = "tick", inst, damage, heal }) and expiries
({ kind = "expired", inst }) in order. Expired instances are removed.
| arg | type | description |
|---|
| state | State | |
| defOf | (string | |
remove(state: State, which: any, defOf: (string) → void
Remove instances: by effect id, or by a predicate fn(inst, def) -> boolean. Returns them.
| arg | type | description |
|---|
| state | State | |
| which | any | |
| defOf | (string | |
absorb(state: State, amount: number) → void
Let shields soak `amount`; returns what is left over and how much was absorbed.
Spent shields are removed.
| arg | type | description |
|---|
| state | State | |
| amount | number | |
all(state: State, id: string) → void
Instances of one effect id (several for an independent effect).
| arg | type | description |
|---|
| state | State | |
| id | string | |
stacks(state: State, id: string) → number
Total stacks of an effect (copies count for an independent effect).
| arg | type | description |
|---|
| state | State | |
| id | string | |