Skip to content

BattleHex

Represents a single tile on the battlefield gridallows computing geometric relationships (distance, neighbours, line-of-sight) that don't rely on current state of a battlefield

isValid

Returns true if this hex value identifies existing battlefield position.

  • returns boolean

isAvailable

Returns true if the hex is on the battlefield and is not located in the first or last column, which are reserved for back tile of war machines and are not accessible for regular movement. NOTE: does NOT checks whether hex is blocked by obstacles or units

  • returns boolean

getClosestTile

Searches provided array for hex that is closest to current one. If multiple equidistant hexes are found, this function will prefer hex closest to specified battle side.

  • param side: BattleSide — Tie-breaker side — closer to this side wins when several candidates are equidistant.
  • param hexes: BattleHexArray — Candidate hexes to search through.

  • returns BattleHex

copyToNorthWest

Returns the neighbouring hex one step north-west.

copyToNorthEast

Returns the neighbouring hex one step north-east.

copyToEast

Returns the neighbouring hex one step east.

copyToSouthEast

Returns the neighbouring hex one step south-east.

copyToSouthWest

Returns the neighbouring hex one step south-west.

copyToWest

Returns the neighbouring hex one step west.