Battle Manager Class Overview

The Battle Manager is a global class responsible for controlling the enemies' turns when engaged in battles against the player.

Functions:

get_scene_enemies()

Populates the scene_enemies array with enemies from the current level room and connects their signals to the BattleManager.

_process(delta)

Updates the paused status based on the timer.

trigger_enemy_battle(enemy:Enemy)

Adds an enemy to the turn_order and changes its behavior to "Battle".

enemy_was_attacked(enemy:Enemy)

Handles an enemy being attacked during its turn or triggers battle mode if not already in battle.

on_enemy_died(enemy:Enemy)

Removes a dead enemy from the turn_order and manages turn passing if it was the current turn.

enemy_attacked(enemy:Enemy)

Handles the event when an enemy attacks, passing the turn or triggering battle mode.

pass_turn()

Advances to the next turn in the turn_order and manages turn and round rest times.

is_enemy_turn(enemy)

Checks if it is the specified enemy's turn and if the battle is not paused.