A commanded troll lights only the walls and doors beside it, and so does a punching wizard

Every interior line lit whenever an edge was wanted; the troll can strike
only the four sides of its own square, so only those light now.

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-24 21:37:13 -04:00
co-authored by Claude Fable 5.1
parent 7a0a972452
commit e97deb8d6f
2 changed files with 19 additions and 2 deletions
+2
View File
@@ -3171,6 +3171,8 @@
<Board <Board
{view} {view}
edgeSelectMode={edgeSelectMode && yourMoment} edgeSelectMode={edgeSelectMode && yourMoment}
punchFrom={trollInHand ? (view.creatures.find((c) => c.id === selectedCreature)?.position ?? null)
: punchWallMode ? (me?.position ?? null) : null}
selectedCreatureId={selectedCreature} selectedCreatureId={selectedCreature}
onCellClick={clickCell} onCellClick={clickCell}
onEdgeClick={clickEdge} onEdgeClick={clickEdge}
+17 -2
View File
@@ -2,7 +2,7 @@
import type { Component } from "svelte"; import type { Component } from "svelte";
import type { GameView, SightTrace } from "@wizwar/engine"; import type { GameView, SightTrace } from "@wizwar/engine";
import type { Side } from "@wizwar/engine"; import type { Side } from "@wizwar/engine";
import { fearCells } from "@wizwar/engine"; import { edgeKey, fearCells } from "@wizwar/engine";
import type { BoardFx } from "./fx"; import type { BoardFx } from "./fx";
import { colorIndexOf as sharedColorIndex, wizardColor } from "./colors"; import { colorIndexOf as sharedColorIndex, wizardColor } from "./colors";
import { CREATURE_ART, objectArt, TERRAIN_ART, tokenArt } from "./art"; import { CREATURE_ART, objectArt, TERRAIN_ART, tokenArt } from "./art";
@@ -20,6 +20,7 @@
let { let {
view, view,
edgeSelectMode = false, edgeSelectMode = false,
punchFrom = null,
selectedCreatureId = null, selectedCreatureId = null,
onCellClick, onCellClick,
onEdgeClick, onEdgeClick,
@@ -43,6 +44,9 @@
}: { }: {
view: GameView; view: GameView;
edgeSelectMode?: boolean; edgeSelectMode?: boolean;
/** A puncher's square, wizard or troll: only the walls and doors on its
* four sides can be struck, so only those lines light. */
punchFrom?: { x: number; y: number } | null;
selectedCreatureId?: string | null; selectedCreatureId?: string | null;
onCellClick?: (cell: { x: number; y: number }) => void; onCellClick?: (cell: { x: number; y: number }) => void;
onEdgeClick?: (cell: { x: number; y: number }, side: Side) => void; onEdgeClick?: (cell: { x: number; y: number }, side: Side) => void;
@@ -209,7 +213,18 @@
if (side === "S") boxes.push({ cell: c, side, x: c.x * CELL + 4, y: (c.y + 1) * CELL - 6, w: CELL - 8, h: 12 }); if (side === "S") boxes.push({ cell: c, side, x: c.x * CELL + 4, y: (c.y + 1) * CELL - 6, w: CELL - 8, h: 12 });
if (side === "N") boxes.push({ cell: c, side, x: c.x * CELL + 4, y: c.y * CELL - 6, w: CELL - 8, h: 12 }); if (side === "N") boxes.push({ cell: c, side, x: c.x * CELL + 4, y: c.y * CELL - 6, w: CELL - 8, h: 12 });
} }
return boxes; if (!punchFrom) return boxes;
const beside = (b: { cell: { x: number; y: number }; side: Side }) => {
const far = b.side === "E" ? { x: b.cell.x + 1, y: b.cell.y } : b.side === "W" ? { x: b.cell.x - 1, y: b.cell.y }
: b.side === "S" ? { x: b.cell.x, y: b.cell.y + 1 } : { x: b.cell.x, y: b.cell.y - 1 };
const at = (c: { x: number; y: number }) => c.x === punchFrom!.x && c.y === punchFrom!.y;
return at(b.cell) || at(far);
};
const solid = (b: { cell: { x: number; y: number }; side: Side }) => {
const state = view.board.edges[edgeKey(b.cell, b.side)];
return state === "wall" || state === "door";
};
return boxes.filter((b) => beside(b) && solid(b));
}); });
// FEAR's dread: three spaces in every direction, straight through walls // FEAR's dread: three spaces in every direction, straight through walls