The rules.js script is responsible for checking victory conditions. This is generally performed by setting up a timer (using setTimer() function) to periodically call a global function that performs the victory condition checking.
Winning
The player is deemed to be a winner in the following scenarios:
All enemies are dead
The player of a member of their team (if using ALLIANCES_TEAMS mode) is still alive
Upon winning, rules.js should trigger gameOverMessage(true) to end the game. It should also use removeTimer() to prevent any subsequent calls to the victory condition checking code.
Losing
The player is deemed to have lost in the following scenarios:
If using ALLIANCES_TEAMS mode, the player loses if they and all members of their team are dead
If using ALLIANCES or NO_ALLIANCES mode, the player loses as soon as they are killed (even if they have allies that are still alive)
Upon losing, rules.js should trigger gameOverMessage(false) to end the game. It should also use removeTimer() to prevent any subsequent calls to the victory condition checking code.
Definition of "Alive"
Under normal game rules, a player is deemed to be alive if any of the following conditions are met: