A hand forced by amnesia or paralysis still casts what it completes

The default cast was chosen only when a gesture was clicked, so a hand
bound to repeat its last gesture finished its spell and let it pass.
Defaults are now chosen at the start of every turn.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Eric Wagoner
2026-09-22 16:07:21 -04:00
co-authored by Claude Fable 5.1
parent 0036eaf625
commit 527820ee95
2 changed files with 66 additions and 2 deletions
+15 -2
View File
@@ -228,9 +228,11 @@ export class Duel {
/** Opponent gestures to light up in the ledger. */
highlight = $state<Highlight | null>(null);
constructor() {
constructor(initial?: GameState) {
const saved = typeof localStorage === 'undefined' ? null : loadSaved();
if (saved) {
if (initial) {
this.state = initial;
} else if (saved) {
this.state = saved.state;
this.pins = saved.pins ?? { left: null, right: null };
this.sets = saved.sets ?? blankSets();
@@ -238,6 +240,16 @@ export class Duel {
this.monsterOrders = saved.monsterOrders ?? {};
this.release = saved.release ?? '';
}
this.syncAll();
}
/**
* Choose each hand's default cast from its gestures. A hand bound by amnesia or
* paralysis can finish a spell without the player touching it, so this must run
* at the start of every turn, not only after a click.
*/
syncAll(): void {
for (const s of SET_NAMES) for (const h of HANDS) this.syncSpell(s, h);
}
/** Rename the player for this duel and every duel after it. An empty name goes back to a drawn one. */
@@ -631,6 +643,7 @@ export class Duel {
private resetDrafts(): void {
this.sets = blankSets();
this.syncAll();
this.stabTarget = FOE;
// Monsters keep attacking what they attacked last, until told otherwise or the target is gone.
const orders: Record<string, TargetId> = {};