Creatures step through board-edge warps by click, like wizards
The engine always warped a creature marched off a lettered opening — verified headless — but the table offered no way to ask for it: cell clicks for a selected creature matched only geometric neighbors, and the warp arrows moved only your wizard. Now a selected creature standing on an opening lights the arrow (and, per the existing cue, its destination), the arrow marches the creature through, and clicking the far mouth directly does the same. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
c4dafe1df7
commit
6e6691c6c0
@@ -348,6 +348,13 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Standing on a board-edge opening: clicking the far mouth warps it.
|
||||
const w = view.board.warps.find((w) =>
|
||||
cellKey(w.from.cell) === cellKey(creature.position) && cellKey(w.to.cell) === cellKey(cell));
|
||||
if (w) {
|
||||
dispatch({ type: "moveCreature", creatureId: selectedCreature, direction: w.from.side });
|
||||
return;
|
||||
}
|
||||
}
|
||||
selectedCreature = null;
|
||||
return;
|
||||
@@ -404,9 +411,12 @@
|
||||
|
||||
function clickWarp(cell: { x: number; y: number }, side: Side) {
|
||||
if (!view || !isYourTurn || !me) return;
|
||||
// Standing on the opening: step through. Otherwise treat it as a cell
|
||||
// click on the opening square (e.g. to walk toward it).
|
||||
if (me.position.x === cell.x && me.position.y === cell.y) {
|
||||
// Standing on the opening: step through — the selected creature first,
|
||||
// your wizard otherwise. Elsewhere it is just a cell click.
|
||||
const creature = selectedCreature ? view.creatures.find((c) => c.id === selectedCreature) : null;
|
||||
if (creature && creature.position.x === cell.x && creature.position.y === cell.y) {
|
||||
dispatch({ type: "moveCreature", creatureId: creature.id, direction: side });
|
||||
} else if (me.position.x === cell.x && me.position.y === cell.y) {
|
||||
dispatch({ type: "move", direction: side });
|
||||
} else {
|
||||
clickCell(cell);
|
||||
|
||||
@@ -329,7 +329,9 @@
|
||||
{@const wy = w.from.cell.y * CELL + CELL / 2 +
|
||||
(w.from.side === "S" ? CELL * 0.42 : w.from.side === "N" ? -CELL * 0.42 : 0)}
|
||||
{@const standing = view.players.some((p) =>
|
||||
p.id === view.you && p.position.x === w.from.cell.x && p.position.y === w.from.cell.y)}
|
||||
p.id === view.you && p.position.x === w.from.cell.x && p.position.y === w.from.cell.y) ||
|
||||
view.creatures.some((c) => c.id === selectedCreatureId &&
|
||||
c.position.x === w.from.cell.x && c.position.y === w.from.cell.y)}
|
||||
{@const letter = warpLetters.get(`${w.from.cell.x},${w.from.cell.y}`) ?? ""}
|
||||
<g
|
||||
class="warp-g" class:standing
|
||||
|
||||
Reference in New Issue
Block a user