Files
systemic-game-design-course/course/04-interceptors/reference/ts
Lucas WintherandClaude Opus 5.5 85959ba5a0
CI / Tool tests and sync-check (push) Successful in 16s
CI / Verify references (all modules, Rust and TS) (push) Successful in 2m4s
CI / Verify Expansion Drop solutions (all modules, Rust and TS) (push) Successful in 2m1s
CI / Coupling audit on references (push) Successful in 5s
CI / Differential fuzzing of the Rust and TS references (300 seeds) (push) Successful in 53s
CI / Mutation check (tools/mutants.json against the highest TS reference) (push) Successful in 34s
CI / Verify the SpellGrid level proofs (solver) (push) Successful in 5m25s
CI / Site build (push) Successful in 15s
CI / Naive engine tests (Module 0) (push) Successful in 20s
fix: final review (engine errors end a Sequence cleanly; nesting guard labelled as the course's; Node 22.15; minor lesson and tool fixes)
I1: run-scenario and both SpellGrid CLIs check moves first and treat any other engine
error as fatal (same text in both tracks); trigger blocks close on error (try/finally,
catch_unwind in Rust); unknown summons rejected. I2, I3, M1-M7, T3, T9a-c, T10a-b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 14:58:27 +01:00
..
2026-10-29 02:54:37 +01:00
2026-10-29 02:54:37 +01:00
2026-10-29 02:54:37 +01:00
2026-10-29 02:54:37 +01:00
2026-10-29 02:54:37 +01:00
2026-10-29 02:54:37 +01:00
2026-10-29 02:54:37 +01:00

Module 4 reference engine (TypeScript)

The course's own engine as of the end of Module 4. It adds auras as card data and one routine that decides how many times a queued trigger activates, so "Your minions trigger their Deathrattles twice." is a card, not a change to Deathrattle. It also adds playing a minion from hand, and Battlecries. Module 3's reference was the starting point, so a diff between the two shows what this module adds. Module 5's reference starts from this one.

  • src/engine/: generic machinery. Names no cards.
    • aura.ts: the Aura Update (Other), which snapshots the auras of every minion in play, and activations, the one routine that reads the snapshot and returns how many times a trigger of a given kind activates for a given player. Stacking policy (max or additive) is a field of each multiplier.
    • queue.ts: actions, the context an effect sees, and the resolver. The end of the outermost Phase runs the Death Creation Step, then the Aura Update (Other). Summoning a minion also runs the Aura Update; playing one does not. Each queued trigger asks activations once, as it starts, and then activates that many times back to back. A Play action moves a minion from hand to board and raises a Played event, which the minion's Battlecry answers.
    • death.ts: the Death Creation Step, unchanged from Module 3.
    • world.ts: entities, zones, order of play, heroes, stats, Armor, the pending-destroy flag, the aura snapshot and the log.
    • card.ts: card definitions (stats, triggers, auras, a spell's effect) and the library.
    • event.ts: the engine's events. Played is engine-only: src/harness.ts leaves it out of the course's GameEvent log, where the played minion's Summoned already shows it.
  • src/content/index.ts: card definitions. Baron Rivendare is one aura entry: triggerMultiplier on deathrattle, times 2, stacking max. Twisting Nether (the Module 3 Expansion Drop) is here because the Module 4 tests use it.
  • src/harness.ts: the adapter the course tests call. summon goes through the engine's summon, so it runs an Aura Update. play (the Module 1 Expansion Drop) runs one Sequence with a Play action.

Run it with the module's tests: node tools/verify-references.mjs 04 from the course repository.