From 91f160806cb4652d9290d306204c2ce0c2a51ad7 Mon Sep 17 00:00:00 2001 From: dingo Date: Tue, 7 Apr 2026 14:52:15 -0400 Subject: [PATCH] Fix terramorpha TILES_NOT_ADJACENT on hex grids IsOrthogonallyAdjacentTo uses Manhattan distance == 1, which only covers the 4 square neighbours. The two hex-diagonal offsets (1,-1) and (-1,+1) have Manhattan distance 2 and were rejected. Now mirrors the existing server pattern: use HexGrid.Distance == 1 when board.HexSides > 0, fall back to IsOrthogonallyAdjacentTo for square boards. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- Server/src/SOR.Game/GameEngine.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Server/src/SOR.Game/GameEngine.cs b/Server/src/SOR.Game/GameEngine.cs index 8576f50..f62ad42 100644 --- a/Server/src/SOR.Game/GameEngine.cs +++ b/Server/src/SOR.Game/GameEngine.cs @@ -374,10 +374,16 @@ public static class GameEngine if (board.GetTile(t) is null) throw new GameException("TILE_OUT_OF_BOUNDS"); - // Di/Tri: each subsequent tile must be orthogonally adjacent to the previous. + // Di/Tri: each subsequent tile must be adjacent to the previous. + // Hex boards use cube-metric distance 1; square boards use Manhattan distance 1. for (int i = 1; i < targetTiles.Count; i++) - if (!targetTiles[i].IsOrthogonallyAdjacentTo(targetTiles[i - 1])) + { + bool adjacent = board.HexSides > 0 + ? HexGrid.Distance(targetTiles[i], targetTiles[i - 1], board.HexSides) == 1 + : targetTiles[i].IsOrthogonallyAdjacentTo(targetTiles[i - 1]); + if (!adjacent) throw new GameException("TILES_NOT_ADJACENT"); + } player.Hand.Remove(card); player.CurrentSp -= card.SpCost;