diff --git a/packages/engine/src/game.ts b/packages/engine/src/game.ts index 1fa6150..d91e80e 100644 --- a/packages/engine/src/game.ts +++ b/packages/engine/src/game.ts @@ -3726,8 +3726,10 @@ function fearRepels(state: GameState, moverId: PlayerId | null, from: Cell, to: for (const other of state.players) { if (!other.alive || other.id === moverId) continue; if (sustainedOn(state, other.id, "fear").length === 0) continue; - const d = Math.abs(other.position.x - to.x) + Math.abs(other.position.y - to.y); - const dBefore = Math.abs(other.position.x - from.x) + Math.abs(other.position.y - from.y); + // "Spaces" are counted through the maze — warps included, walls + // respected — exactly as feet would walk them. + const d = walkingDistance(state, other.position, to); + const dBefore = walkingDistance(state, other.position, from); if (d <= 3 && d < dBefore) return true; } return false; diff --git a/packages/engine/test/creatures.test.ts b/packages/engine/test/creatures.test.ts index e7808ff..0d21069 100644 --- a/packages/engine/test/creatures.test.ts +++ b/packages/engine/test/creatures.test.ts @@ -739,7 +739,7 @@ describe("fear holds off monsters and unwilling feet alike (rules rev 32)", () = wallPassesPerTurn: 0, wallPassUsed: 0, attackUsed: false, justCreated: false, scorchedThisTurn: [], } as never); - state.edgeOverrides[edgeKey({ x: 2, y: 8 }, "S")] = "open"; + for (const y of [5, 6, 7, 8]) state.edgeOverrides[edgeKey({ x: 2, y }, "S")] = "open"; while (state.players[state.turn.activeIndex]!.id !== "a") { const r = applyCommand(state, state.players[state.turn.activeIndex]!.id, { type: "endTurn", draw: 0 }); if (!r.ok) throw new Error(r.error); diff --git a/packages/web/src/Board.svelte b/packages/web/src/Board.svelte index 8cb35ae..7a8b606 100644 --- a/packages/web/src/Board.svelte +++ b/packages/web/src/Board.svelte @@ -1,5 +1,6 @@