Engine > Systems > Bot System

Orchestrates the bot turn for all entities owned by a bot player. Each entity runs three sequential phases against its own AP pool: attack an adjacent target, move into attack range and attack, then spend remaining AP on random movement.

processTurn

Processes the full bot turn for all entities owned by the given player. Returns an ordered list of effects covering every attack and move that occurred.

#processEntity

Processes a single entity across three sequential phases: attack, move and attack, then random movement. Incapacitated entities are skipped.

#checkAttack

Phase 1. Attacks an adjacent target if the entity has enough AP and a valid target is in range. Picks randomly among available targets.

#checkMoveAndAttack

Phase 2. Moves the entity to the nearest tile from which it can attack, then attacks. Skipped if the entity lacks enough AP for at least one move plus an attack, or if no reachable tile puts a target in range.

#checkMove

Phase 3. Spends remaining AP moving toward a random living enemy unit. Each step picks randomly from the 3 neighbors closest to the target.




© Gamesanova 2026