protected function cyclePlayer() { $Player = $this->Game->getCurrentPlayer(); if ($Player->State == PlayerState::Join || $Player->State == PlayerState::Hit) { return true; } do { if (++$this->Game->turn == $this->Game->getNumberOfPlayers()) { return false; } } while ($this->Game->getCurrentPlayer()->State == PlayerState::BlackJack); return true; }
public function dealer_done(Game $Game, Player $Dealer) { if ($Game->getNumberOfPlayers() > 1) { $this->addMessage('All players have stood or are bust. The dealer draws cards:'); $this->addMessage($Dealer->Hand->getHandString() . " (" . $Dealer->Hand->Value . ")"); } else { $this->addMessage('The dealer draws cards ' . $Dealer->Hand->getHandString() . " (" . $Dealer->Hand->Value . ")"); } if ($Dealer->State == PlayerState::Bust) { $this->addMessage('The dealer is bust.'); } elseif ($Dealer->State == PlayerState::Stand) { $this->addMessage('The dealer stands.'); } if ($this->chat->isPrivate()) { $this->keyboard = [[['text' => emoji(0x1f4b5) . " Play again - default bet", 'callback_data' => '/bjstart'], ['text' => emoji(0x1f4b0) . " Play again - bet double", 'callback_data' => '/bjstart ' . 2 * $Game->getCurrentPlayer()->bet]], [['text' => emoji(0x1f4b0) . " Play again - bet half", 'callback_data' => '/bjstart all/2'], ['text' => emoji(0x1f4b0) . " Play again - bet all", 'callback_data' => '/bjstart all']], [['text' => emoji(0x1f3ae) . ' Back to games menu', 'callback_data' => '/help games'], ['text' => emoji(0x1f6aa) . ' Main menu', 'callback_data' => '/help']]]; } else { $this->keyboard = [[['text' => emoji(0x1f4b5) . " New game - default bet", 'callback_data' => '/blackjack'], ['text' => emoji(0x1f4b0) . " Play again - bet double", 'callback_data' => '/blackjack ' . 2 * $Game->getCurrentPlayer()->bet]], [['text' => emoji(0x1f4b0) . " New game - bet half", 'callback_data' => '/blackjack all/2'], ['text' => emoji(0x1f4b0) . " New game - bet all", 'callback_data' => '/blackjack all']]]; } }