A permanent spell settles 'for good' in the chronicle and the receipt, not for a billion turns

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
Eric Wagoner
2026-09-21 11:09:01 -04:00
co-authored by Claude Fable 5.1
parent 48350a3686
commit 071e7ce988
2 changed files with 7 additions and 4 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
// Websocket client + reactive session state (Svelte 5 runes).
import type { Command, GameEvent, GameView, Side } from "@wizwar/engine";
import { cardDef } from "@wizwar/engine";
import { cardDef, isPermanentDuration } from "@wizwar/engine";
import { receiptFor } from "./receipt";
/** The same server over plain HTTP, for the one door a socket cannot carry: a picture. */
@@ -99,7 +99,9 @@ export function humanize(e: GameEvent): string | null {
case "squareContentDestroyed": return e.kind === "ooze" ? `🔥 The ooze burns away under ${e.attacker}'s fire!` : `🌿 The ${e.kind} is torn apart by ${e.attacker}'s attack!`;
case "slowDeathWindow": return `Slow Death bites ${e.player} for ${e.points} — a counter hovers over the wound…`;
case "slowDeathCountered": return `${e.player}'s ${cardDef(e.cardId).name} blunts the rot — ${e.remaining} point${e.remaining === 1 ? "" : "s"} still coming.`;
case "spellSustained": return `${spellName(e.cardId)} settles over ${e.target} (${e.turns} turn${e.turns === 1 ? "" : "s"}).`;
case "spellSustained": return isPermanentDuration(e.turns)
? `${spellName(e.cardId)} settles over ${e.target} for good.`
: `${spellName(e.cardId)} settles over ${e.target} (${e.turns} turn${e.turns === 1 ? "" : "s"}).`;
case "spellExpired": return `${spellName(e.cardId)} wears off ${e.target}.`;
case "teleported": return e.by === e.player
? `${e.player} teleports across the maze!`
+3 -2
View File
@@ -3,7 +3,7 @@
// engine's own events, so it explains what happened rather than what the
// cards promise.
import { cardDef, type GameEvent } from "@wizwar/engine";
import { cardDef, isPermanentDuration, type GameEvent } from "@wizwar/engine";
export interface Receipt {
title: string;
@@ -75,7 +75,8 @@ export function receiptFor(batch: readonly GameEvent[], e: GameEvent): Receipt |
: e.fullyStopped ? "nothing lands"
: healed && healed.type === "lifeGained" ? `${healed.amount} heals ${e.defender} instead`
: e.damageDealt > 0 ? `${e.damageDealt} lands on ${e.defender}`
: tookHold && tookHold.type === "spellSustained" ? `${card} takes hold of ${e.defender} for ${tookHold.turns} turn${tookHold.turns === 1 ? "" : "s"}`
: tookHold && tookHold.type === "spellSustained"
? (isPermanentDuration(tookHold.turns) ? `${card} takes hold of ${e.defender} for good` : `${card} takes hold of ${e.defender} for ${tookHold.turns} turn${tookHold.turns === 1 ? "" : "s"}`)
: "nothing to land",
);
lines.push(parts.join(" → "));