- A battle takes place on a planet.
- First, a battle is initiating - defenders are yet to be defined.
- As long as the game did not start, the attacking time can cancel the battle.
- When attackers and defenders are set, the game is running (started_at gets filled)
- When one the battle is finished, the end date is set.
- Only one faction can win a battle (draw means no winner)
- A battle has several participants (attacker and defender). See Battle participants.
- id [INT, PRIMARY KEY, AUTO_INCREMENT]
- fk_planet [INT]: planet where battle took place
- status [CHAR]: [I]nitiated, [C]anceled, [R]unning, [F]inished
- initiated_at [DATETIME]
- started_at [DATETIME]
- ended_at [DATETIME]: when battle was canceled or finished
- attacking_faction [CHAR]: [U]ef, [A]eon, [C]ybran, [S]eraphim
- defending_faction [CHAR]: [U]ef, [A]eon, [C]ybran, [S]eraphim
- winning_faction [CHAR, NULLABLE]: [U]ef, [A]eon, [C]ybran, [S]eraphim - NULL on draw
- Ready: SELECT (SELECT slots FROM planets, maps WHERE planets.id = battles.fk_planet AND planets.fk_map = maps.id) = (SELECT COUNT(fk_character) FROM battle_participants WHERE fk_battle = battles.id)