A crowded table: keyed threats, a compact roster, a ledger selector, host-only starts
Threats are keyed by seat as well as hand and spell, so two opponents building the same spell no longer crash the board (regression test). Past three wizards the rail lists the others on a line each with health, condition and whether they have moved; a row of names turns the ledger toward any wizard, as do pressing a warning or choosing a target; each seat keeps one colour across the ledger, the warnings and the rail. The result strip folds untouched wizards into one line. A full table no longer begins by itself: the host begins at every size and may send a bot away. Target lists carry health and condition, and an intent sentence says what the reveal will do. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141G6xqLeNRYEtviLWSB5Up
This commit is contained in:
1 parent
c24fccaa35
commit
5c79a65319
19 files changed
+473
-60
No files matched your search
@@ -1,8 +1,9 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { Duel } from './duel.svelte';
|
||||
import { resolveTurn } from './resolve';
|
||||
import { createGame, type GameState } from './state';
|
||||
import type { Gesture } from './spells';
|
||||
import { play } from './test-helpers';
|
||||
import { noop, play } from './test-helpers';
|
||||
|
||||
/** A is one gesture from a lightning bolt and has just been struck by amnesia. */
|
||||
function amnesiaBeforeLightning(): GameState {
|
||||
@@ -27,3 +28,24 @@ describe('the duel store', () => {
|
||||
expect(duel.foe.hp).toBe(10);
|
||||
});
|
||||
});
|
||||
|
||||
describe('threats at a crowded table', () => {
|
||||
it('keys each opponent apart when two build the same spell with the same hand', () => {
|
||||
let s = createGame({ A: 'You', B: 'Bryn', C: 'Cass' }, 1);
|
||||
s = resolveTurn(s, { A: noop(), B: { ...noop(), left: 'S' }, C: { ...noop(), left: 'S' } });
|
||||
const duel = new Duel(s);
|
||||
const missiles = duel.threatsNow.filter((t) => t.spell.id === 'missile');
|
||||
expect(missiles.map((t) => t.who).sort()).toEqual(['B', 'C']);
|
||||
const keys = duel.threats.map((t) => duel.threatKey(t));
|
||||
expect(new Set(keys).size).toBe(keys.length);
|
||||
});
|
||||
|
||||
it('labels targets with health and condition', () => {
|
||||
let s = createGame({ A: 'You', B: 'Bryn', C: 'Cass' }, 1);
|
||||
s = resolveTurn(s, { A: noop(), B: noop(), C: noop() });
|
||||
s.wizards.C.hp = 8;
|
||||
s.wizards.C.invisibleTurns = 2;
|
||||
const duel = new Duel(s);
|
||||
expect(duel.targetLabel('C')).toBe('Cass · 8 HP · invisible');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user