#include "GameState.h"

void GameState :: gamestateBattleSwooshStartup ()
{
  rulez.newBattle ();
  rander.loadResourceBattle(playerPowerSelector);
  rander.startupBattle(playerPowerSelector, textFeeders);
}

void GameState :: gamestateBattleSwooshBeforeDraw ()
{
  if (rulez.getIntroBattle ())
    rander.outputBattleSwoosh ("INTRO BATTLE");
  else
    rander.outputBattleSwoosh ("BATTLE");
}

void GameState :: gamestateBattleSwooshAfterDraw ()
{
  inputBufferIterator = inputBuffer.begin ();
  while (inputBufferIterator < inputBuffer.end ())
    {
      if (inputBufferIterator -> getInput () == INPUT_QUITGAME)
        {
          addQuitCommand ();
        }
      inputBufferIterator ++;
    }

  if (SDL_GetTicks () >= 1000 + startTime)
    {
      //move according to who's first.
      if (rulez.isItPlayerTurn ())
        setNewGameState (GAMESTATE_BATTLE_PLAYER_PHASE);
      else
        setNewGameState (GAMESTATE_BATTLE_ENEMY_PHASE);
    }
}
