hashColor(id: string) → string
| arg | type | description |
|---|
| id | string | |
titleCase(id: string) → string
| arg | type | description |
|---|
| id | string | |
plural(label: string) → string
English plural of a label: "Runner" -> "Runners", "Harpy" -> "Harpies", "Boss" -> "Bosses", "Footman" -> "Footmen"; a word that reads as plural already ("Armored", "Undead", "Swarming") stays as it is. A kind that says its own `plural` is never guessed.
| arg | type | description |
|---|
| label | string | |
archetype(id: string, tags: { string }?, traits: { string }?) → string
Pick a vector icon archetype from a kind id plus its tags/traits.
| arg | type | description |
|---|
| id | string | |
| tags | { string }? | |
| traits | { string }? | |
normaliseKind(id: string, raw: any) → Kind
Normalise whatever a provider returned for a kind into a full Kind record.
| arg | type | description |
|---|
| id | string | |
| raw | any | |
newKinds(provider: any?, fallback: ((string) → void
| arg | type | description |
|---|
| provider | any? | |
| fallback | ((string | |
kindInfo(k: Kinds, id: string) → Kind
| arg | type | description |
|---|
| k | Kinds | |
| id | string | |
addGroup(groups: { Group }, byKind: { [string]: Group }, kinds: Kinds, kind: string, count: number) → void
| arg | type | description |
|---|
| groups | { Group } | |
| byKind | { [string]: Group } | |
| kinds | Kinds | |
| kind | string | |
| count | number | |
summariseWave(w: any, index: number, kinds: Kinds) → Wave
Summarise one wave. Accepts spawnerKit's shape `{ name, enemies = { { kind, count } }, script = { { kind } } }`,
a summarised shape `{ name, groups = { { kind, count } } }`, a map `{ enemies = { runner = 12 } }`,
or a spawnerKit plan `{ spawns = { { kind } } }`.
| arg | type | description |
|---|
| w | any | |
| index | number | |
| kinds | Kinds | |
take(list: any) → void
| arg | type | description |
|---|
| list | any | |
summarise(list: any, kinds: Kinds) → void
Summarise a whole list: a bare list of waves, or a table `{ waves = { ... } }` (a waveTable).
| arg | type | description |
|---|
| list | any | |
| kinds | Kinds | |
waveAt(waves: { Wave }, n: number, endless: boolean?) → Wave
The wave record for wave number n (1-based). Endless lists loop: wave 12 of a 5-wave list is entry 2.
| arg | type | description |
|---|
| waves | { Wave } | |
| n | number | |
| endless | boolean? | |
normaliseState(s: any, prev: State?) → State
Fill a partial state with defaults and clamp it: { wave, waves, phase, nextIn, nextTotal, canCall, callBonus }.
| arg | type | description |
|---|
| s | any | |
| prev | State? | |
upcoming(s: State) → number
The wave number the preview is about: the one after the current wave (wave 1 before the game starts).
hasNext(s: State, count: number) → boolean
Whether there is a next wave to preview at all.
| arg | type | description |
|---|
| s | State | |
| count | number | |
clock(sec: number?) → string
Seconds as a clock: 75 -> "1:15", 9.2 -> "0:10" (rounded up, so 0:00 only shows at zero).
| arg | type | description |
|---|
| sec | number? | |
counter(s: State) → string
"Wave 4/10", "Wave 12" for endless (waves = 0), "Wave 1/10" before the first wave.
counterNumber(s: State) → number
The wave number the counter shows (upcoming one while building, current one while a wave runs).
composition(w: Wave?, max: number?) → string
"12 runners, 2 brutes" (counts first; singular for one). `max` groups, then "+N more".
| arg | type | description |
|---|
| w | Wave? | |
| max | number? | |
line(s: State, w: Wave?, max: number?) → string
The minimal style's sentence: "Wave 4/10 · next: 12 runners, 2 brutes · 0:15".
| arg | type | description |
|---|
| s | State | |
| w | Wave? | |
| max | number? | |
buttonText(s: State) → void
The call button's words: "START WAVE 1", "CALL EARLY", plus the bonus as "+25".
progress(nextIn: number?, total: number?) → number
Countdown fill 0..1 at `nextIn` against a total wait.
| arg | type | description |
|---|
| nextIn | number? | |
| total | number? | |
⌬ Types
Kind = {Group = { kind: string, count: number, info: Kind }Wave = { index: number, name: string, total: number, groups: { Group }, boss: boolean, rest: boolean, bonus: number? }State = {Kinds = { provider: any, fallback: ((string) -> any)?, cache: { [string]: Kind } }