Returns all cells reachable from center within a movement budget.
center
budget
Uses Dijkstra's algorithm — each reachable cell is visited once at its minimum cost. The center cell is always included (at cost 0).
The returned array includes the center itself. Order is not guaranteed.
const reachable = getMovementRange( offsetToHex(unitCol, unitRow), 3, (from, to) => { const { col, row } = hexToOffset(to); if (map.getTerrain(col, row) === TerrainType.Water) return Infinity; return map.getElevation(col, row) > 4 ? 2 : 1; }, map,); Copy
const reachable = getMovementRange( offsetToHex(unitCol, unitRow), 3, (from, to) => { const { col, row } = hexToOffset(to); if (map.getTerrain(col, row) === TerrainType.Water) return Infinity; return map.getElevation(col, row) > 4 ? 2 : 1; }, map,);
Returns all cells reachable from
centerwithin a movementbudget.Uses Dijkstra's algorithm — each reachable cell is visited once at its minimum cost. The center cell is always included (at cost 0).
The returned array includes the
centeritself. Order is not guaranteed.