diff --git a/packages/web/src/App.svelte b/packages/web/src/App.svelte index ebc9a04..7ec8d20 100644 --- a/packages/web/src/App.svelte +++ b/packages/web/src/App.svelte @@ -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); diff --git a/packages/web/src/Board.svelte b/packages/web/src/Board.svelte index 0a875c6..d597671 100644 --- a/packages/web/src/Board.svelte +++ b/packages/web/src/Board.svelte @@ -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}`) ?? ""}