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 <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-04-07 14:52:15 -04:00
co-authored by Claude Happy
parent 232e06de6d
commit 91f160806c
+8 -2
View File
@@ -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;