Example #1
0
 /**
  * @param PlayerMove $playerMove
  * @return bool
  */
 private function processTurn(PlayerMove $playerMove)
 {
     $this->processTurnActions($playerMove);
     $this->Game->savePlayer();
     if ($this->cyclePlayer()) {
         $this->Game->saveGame();
         $this->Talk->next_turn($this->Game);
     } else {
         $this->finaliseGame();
         $this->Game->endGame();
     }
     return true;
 }
Example #2
0
 public function war_begins(Game $game)
 {
     if ($game->getNumberOfPlayers() > 1) {
         $this->addMessage("All remaining players have made their moves. War begins.");
     }
 }
Example #3
0
 /**
  * @param Game $Game
  */
 public function next_turn(\GroupBot\Brains\CardGame\Types\Game $Game)
 {
     /** @var Player $Player */
     $Player = $Game->getCurrentPlayer();
     if ($Player->State == PlayerState::Join && $Player->player_no != 0) {
         $this->addMessage("*" . $Player->user->getName() . "'s* hand: " . $Player->Hand->getHandString() . " (" . $Player->Hand->Value . ")");
     }
     if (!($Player->State == PlayerState::Join && $Player->player_no == 0)) {
         $this->addMessage("Dealer's hand: " . $Game->Dealer->Hand->getHandString() . " (" . $Game->Dealer->Hand->Value . ")");
     }
     if ($Game->getNumberOfPlayers() > 1) {
         $out = "It is now *" . $Player->user->getPrefixedUserName() . "'s* turn";
         if ($Player->split == 1) {
             $out .= " (hand one)";
         } elseif ($Player->split == 2) {
             $out .= " (hand two)";
         }
         $this->addMessage($out . ".");
     } else {
         $this->addMessage("Please place your move.");
     }
     $this->next_turn_options($Game);
 }