Exemplo n.º 1
0
 protected function finishGame()
 {
     $channel = $this->event->getRequest()->getSource();
     $players = $this->current_game->getPlayersRankedByScore();
     $this->event->addResponse(Response::notice($channel, 'And with that, the game is over.'));
     $scores = array();
     foreach ($players as $player) {
         $scores[] = $player->getName() . ' - ' . $player->getScore();
     }
     $message = 'Final Score: ' . join(' ,  ', $scores);
     $this->event->addResponse(Response::notice($channel, $message));
     if (!$this->current_game->isTied()) {
         $this->event->addResponse(Response::notice($channel, $players[0]->getName() . ' wins.'));
         if ($this->current_game->getTieCounter() > 0) {
             $this->event->addResponse(Response::notice($channel, 'That was the end of a ' . $this->current_game->getTieCounter() + 1 . ' game tied-game series.'));
         }
         $this->current_game = null;
     } else {
         $this->event->addResponse(Response::notice($channel, 'It\'s a tied game!'));
         $this->current_game->continueTie();
         $this->event->addResponse(Response::notice($channel, 'Same play order as before: ' . join(', ', $this->getCurrentGamePlayerNames())));
         $this->event->addResponse(Response::notice($channel, '@' . $this->current_game->getCurrentPlayer()->getName() . ', you\'re up first.  Type \'@oftbot roll\' to take your first roll.'));
     }
 }