Rev 14: elimination sweeps the board by either door

Two ways out of the game, one cleanup. A wizard killed by damage took
their monsters, sustained spells, and armed ambushes with them; a
wizard eliminated by treasure loss left everything standing — a fire
imp scorching for a dead master, a Medusa still gazing at a corpse.
Both paths now share one sweep, gated at rev 14 so stored games keep
their orphans acting as recorded.

Also: Lifesaver lasts until used, carried as a near-billion-turn
sentinel — which the scoresheet printed. Durations that mean forever
no longer show a number.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Eric Wagoner
2026-08-16 22:27:14 -04:00
co-authored by Claude Fable 5
parent a60467c6fc
commit d4565006bc
5 changed files with 48 additions and 10 deletions
+32
View File
@@ -494,3 +494,35 @@ describe("monsters roll to hit the hidden (rules rev 13)", () => {
expect(JSON.stringify(state.rng)).toBe(rngBefore);
});
});
describe("elimination sweeps the board either way (rules rev 14)", () => {
it("a treasure-eliminated wizard's fire imp vanishes with them", () => {
let { state } = createGame({ playerIds: ["a", "b", "c"], seed: 42, sets: ["basic", "expansion1"], deckRev: 14 });
const victim = state.players.find((p) => p.id === "c")!;
state.creatures.push({
id: "imp1", kind: "fire-imp", controllerId: "c",
position: { ...victim.position },
damage: 0, maxDamage: 5, movesPerTurn: 0, movementUsed: 0,
attackUsed: false, justCreated: false,
wallPassesPerTurn: 0, wallPassUsed: 0, scorchedThisTurn: [],
});
state.sustained.push({
id: "fx-med", cardId: "medusa", casterId: "a", targetId: "c",
remainingTurns: 3, data: {},
});
// Both of c's treasures sit captured on living enemies' home bases.
const mine = state.treasures.filter((t) => t.owner === "c");
expect(mine.length).toBe(2);
mine[0]!.position = { ...state.players.find((p) => p.id === "a")!.home };
mine[0]!.carriedBy = null;
mine[1]!.position = { ...state.players.find((p) => p.id === "b")!.home };
mine[1]!.carriedBy = null;
const active = activePlayer(state).id;
const r = applyCommand(state, active, { type: "endTurn", draw: 0 });
if (!r.ok) throw new Error(r.error);
state = r.state;
expect(state.players.find((p) => p.id === "c")!.alive).toBe(false);
expect(state.creatures.some((c) => c.controllerId === "c")).toBe(false);
expect(state.sustained.some((s) => s.targetId === "c")).toBe(false);
});
});