         return false  if !team.pokemon[index]
         return false  if arrangement.indexOf(index, i + 1) != -1
       if @battle.arrangeTeam(playerId, arrangement)
+        @arranging = false
+        @battle.tell(Protocol.REARRANGE_TEAMS, @battle.getArrangements()...)
         @battle.startBattle()
         @battle.sendUpdates()
       return true


    getArrangements: ->
      for playerId in @playerIds
        console.log @arranging, @arranged
        @arranged[playerId] || [0...@getTeam(playerId).length]

      @arranged = {}

    start: ->
      @tell(Protocol.TEAM_PREVIEW)
      @shouldStart = false

  extendFacade:
    arrangeTeam: (playerId, arrangement) ->
