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:
co-authored by
Claude Fable 5
parent
9eeb89caca
commit
497c2245a3
@@ -396,7 +396,7 @@
|
|||||||
<EdgeGlyph x={e.x} y={e.y} kind={e.kind === "V" ? "V" : "H"}
|
<EdgeGlyph x={e.x} y={e.y} kind={e.kind === "V" ? "V" : "H"}
|
||||||
state={e.state === "door" ? "door" : "wall"}
|
state={e.state === "door" ? "door" : "wall"}
|
||||||
lock={(e.lock ?? null) as "removed" | "jammed" | "held" | "ajar" | null}
|
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}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,23 @@
|
|||||||
// A wall or door on an edge, exactly as the board draws it. Wall-segment
|
// 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
|
// effects (locks picked, jammed, removed; doors held) are color states of
|
||||||
// this one glyph — the game has never used tokens for them.
|
// 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";
|
x: number; y: number; kind: "V" | "H";
|
||||||
state: "wall" | "door";
|
state: "wall" | "door";
|
||||||
lock?: "removed" | "jammed" | "held" | "ajar" | null;
|
lock?: "removed" | "jammed" | "held" | "ajar" | null;
|
||||||
title?: string | null;
|
title?: string | null;
|
||||||
|
/** Battle damage taken so far (walls fall at 20, doors at 15). */
|
||||||
|
damage?: number;
|
||||||
} = $props();
|
} = $props();
|
||||||
const CELL = 48;
|
const CELL = 48;
|
||||||
const WALL = 7;
|
const WALL = 7;
|
||||||
const cls = $derived(state === "door" ? `door${lock ? ` ${lock}` : ""}` : "wall");
|
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>
|
</script>
|
||||||
|
|
||||||
{#if kind === "V"}
|
{#if kind === "V"}
|
||||||
|
|||||||
Reference in New Issue
Block a user