Battle

Submitted by Brutus5000 on Wed, 07/20/2016 - 08:39
Parent element
Semantic
  • 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.
Table name
battles
Table structure
  • 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
Calculated Fields
  • 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)

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.