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:
co-authored by
Claude Fable 5.1
parent
7a0a972452
commit
e97deb8d6f
@@ -3171,6 +3171,8 @@
|
||||
<Board
|
||||
{view}
|
||||
edgeSelectMode={edgeSelectMode && yourMoment}
|
||||
punchFrom={trollInHand ? (view.creatures.find((c) => c.id === selectedCreature)?.position ?? null)
|
||||
: punchWallMode ? (me?.position ?? null) : null}
|
||||
selectedCreatureId={selectedCreature}
|
||||
onCellClick={clickCell}
|
||||
onEdgeClick={clickEdge}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { Component } from "svelte";
|
||||
import type { GameView, SightTrace } 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 { colorIndexOf as sharedColorIndex, wizardColor } from "./colors";
|
||||
import { CREATURE_ART, objectArt, TERRAIN_ART, tokenArt } from "./art";
|
||||
@@ -20,6 +20,7 @@
|
||||
let {
|
||||
view,
|
||||
edgeSelectMode = false,
|
||||
punchFrom = null,
|
||||
selectedCreatureId = null,
|
||||
onCellClick,
|
||||
onEdgeClick,
|
||||
@@ -43,6 +44,9 @@
|
||||
}: {
|
||||
view: GameView;
|
||||
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;
|
||||
onCellClick?: (cell: { x: number; y: number }) => 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 === "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
|
||||
|
||||
Reference in New Issue
Block a user