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:
co-authored by
Claude Fable 5.1
parent
48350a3686
commit
071e7ce988
@@ -1,7 +1,7 @@
|
|||||||
// Websocket client + reactive session state (Svelte 5 runes).
|
// Websocket client + reactive session state (Svelte 5 runes).
|
||||||
|
|
||||||
import type { Command, GameEvent, GameView, Side } from "@wizwar/engine";
|
import type { Command, GameEvent, GameView, Side } from "@wizwar/engine";
|
||||||
import { cardDef } from "@wizwar/engine";
|
import { cardDef, isPermanentDuration } from "@wizwar/engine";
|
||||||
import { receiptFor } from "./receipt";
|
import { receiptFor } from "./receipt";
|
||||||
|
|
||||||
/** The same server over plain HTTP, for the one door a socket cannot carry: a picture. */
|
/** 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 "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 "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 "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 "spellExpired": return `${spellName(e.cardId)} wears off ${e.target}.`;
|
||||||
case "teleported": return e.by === e.player
|
case "teleported": return e.by === e.player
|
||||||
? `${e.player} teleports across the maze!`
|
? `${e.player} teleports across the maze!`
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
// engine's own events, so it explains what happened rather than what the
|
// engine's own events, so it explains what happened rather than what the
|
||||||
// cards promise.
|
// cards promise.
|
||||||
|
|
||||||
import { cardDef, type GameEvent } from "@wizwar/engine";
|
import { cardDef, isPermanentDuration, type GameEvent } from "@wizwar/engine";
|
||||||
|
|
||||||
export interface Receipt {
|
export interface Receipt {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -75,7 +75,8 @@ export function receiptFor(batch: readonly GameEvent[], e: GameEvent): Receipt |
|
|||||||
: e.fullyStopped ? "nothing lands"
|
: e.fullyStopped ? "nothing lands"
|
||||||
: healed && healed.type === "lifeGained" ? `${healed.amount} heals ${e.defender} instead`
|
: healed && healed.type === "lifeGained" ? `${healed.amount} heals ${e.defender} instead`
|
||||||
: e.damageDealt > 0 ? `${e.damageDealt} lands on ${e.defender}`
|
: 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",
|
: "nothing to land",
|
||||||
);
|
);
|
||||||
lines.push(parts.join(" → "));
|
lines.push(parts.join(" → "));
|
||||||
|
|||||||
Reference in New Issue
Block a user