 
   getAction: (clientId) =>
     @playerActions[clientId]
+
+  hasWeather: (weatherName) =>
+    weather = (if @hasWeatherCancelAbilityOnField() then "None" else @weather)
+    weatherName == weather
+
+  hasWeatherCancelAbilityOnField: =>
+    _.any @getActivePokemon(), (pokemon) ->
+      pokemon.hasAbility('Air Lock') || pokemon.hasAbility('Cloud Nine')
+
+  # Add `string` to a buffer that will be sent to each client.
+  message: (string) =>
+    @buffer.push(string)
+
+  clearMessages: =>
+    while @buffer.length > 0
+      @buffer.pop()
+
+  # Sends to each player the battle messages that have been queued up
+  # TODO: It should be sent to spectators as well
+  sendMessages: =>
+    @message 'The turn continued.'
+    for id, player of @players
+      player.updateChat('SERVER', @buffer.join("<br>"))
+    @clearMessages()
 
   # Tells the player to execute a certain move by name. The move is added
   # to the list of player actions, which are executed once the turn continues.

    @sendMessages()

    if @areAllRequestsCompleted() then @startNewTurn()

  sendMessages: =>
    @message 'The turn continued.'
    for id, player of @players
      player.updateChat('SERVER', @buffer.join("<br>"))
    @clearBuffer()

  endBattle: =>
    winner = @getWinner()

      # Clean up playerActions hash.
      delete @playerActions[id]

    # TODO: THE FOLLOWING SHOULD BE SKIPPED IF THIS IS JUST REPLACEMENTS
    if @isOver()
      @sendMessages()
      @endBattle()
      return
      
    # END TURN effects (skipped if replacements phase)

    if @requestQueue.length > 0
      {player, validActions} = @requestQueue.shift()
