Every segment states its hitpoints in the tooltip

'a wall — 20 hitpoints'; battered, 'a wall — 13 of 20 hitpoints left';
doors the same against their 15, lock states included ('held open by a
standing wizard — 15 hitpoints'). The crack overlay already told the
damage; now the wall itself tells what still stands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0138A8CjeQRpvzKxuMfz1Bqc
This commit is contained in:
Eric Wagoner
2026-08-18 10:37:57 -04:00
co-authored by Claude Fable 5
parent 9eeb89caca
commit 497c2245a3
2 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -396,7 +396,7 @@
<EdgeGlyph x={e.x} y={e.y} kind={e.kind === "V" ? "V" : "H"}
state={e.state === "door" ? "door" : "wall"}
lock={(e.lock ?? null) as "removed" | "jammed" | "held" | "ajar" | null}
title={lockTitle} />
title={lockTitle} damage={view.wallDamage[`${e.kind}:${e.x},${e.y}`] ?? 0} />
{/if}
{/each}
+9 -2
View File
@@ -2,16 +2,23 @@
// A wall or door on an edge, exactly as the board draws it. Wall-segment
// effects (locks picked, jammed, removed; doors held) are color states of
// this one glyph — the game has never used tokens for them.
let { x, y, kind, state, lock = null, title = null }: {
let { x, y, kind, state, lock = null, title = null, damage = 0 }: {
x: number; y: number; kind: "V" | "H";
state: "wall" | "door";
lock?: "removed" | "jammed" | "held" | "ajar" | null;
title?: string | null;
/** Battle damage taken so far (walls fall at 20, doors at 15). */
damage?: number;
} = $props();
const CELL = 48;
const WALL = 7;
const cls = $derived(state === "door" ? `door${lock ? ` ${lock}` : ""}` : "wall");
const tip = $derived(title ?? (state === "door" ? "a locked door" : "a wall"));
// Every segment tells its hitpoints: what still stands of its 20 (or 15).
const needed = $derived(state === "door" ? 15 : 20);
const hp = $derived(damage > 0
? `${Math.max(0, needed - damage)} of ${needed} hitpoints left`
: `${needed} hitpoints`);
const tip = $derived(`${title ?? (state === "door" ? "a locked door" : "a wall")} — ${hp}`);
</script>
{#if kind === "V"}