private function onFirstNight(Game $game)
{
$client = $this->client;
foreach ($game->getLivingPlayers() as $player) {
$client->getDMByUserId($player->getId())->then(function (DirectMessageChannel $dmc) use($client, $player, $game) {
$client->send("Your role is {$player->role}", $dmc);
if ($player->role == Role::WEREWOLF) {
if ($game->getNumRole(Role::WEREWOLF) > 1) {
$werewolves = PlayerListFormatter::format($game->getPlayersOfRole(Role::WEREWOLF));
$client->send("The werewolves are: {$werewolves}", $dmc);
} else {
$client->send("You are the only werewolf.", $dmc);
}
}
if ($player->role == Role::SEER) {
$client->send("Seer, select a player by saying !see #channel @username.\r\nDO NOT DISCUSS WHAT YOU SEE DURING THE NIGHT, ONLY DISCUSS DURING THE DAY IF YOU ARE NOT DEAD!", $dmc);
}
if ($player->role == Role::BEHOLDER) {
$seers = $game->getPlayersOfRole(Role::SEER);
$seers = PlayerListFormatter::format($seers);
$client->send("The seer is: {$seers}", $dmc);
}
});
}
$playerList = PlayerListFormatter::format($game->getLivingPlayers());
$roleList = RoleListFormatter::format($game->getLivingPlayers());
$msg = ":wolf: A new game of Werewolf is starting! For a tutorial, type !help.\r\n\r\n";
$msg .= "Players: {$playerList}\r\n";
$msg .= "Possible Roles: {$game->getRoleStrategy()->getRoleListMsg()}\r\n\r\n";
if ($this->optionsManager->getOptionValue(OptionName::role_seer)) {
$msg .= ":crescent_moon: :zzz: It is the middle of the night and the village is sleeping.";
$msg .= " The game will begin when the Seer chooses someone.";
}
$this->sendMessageToChannel($game, $msg);
if (!$this->optionsManager->getOptionValue(OptionName::role_seer)) {
$this->changeGameState($game->getId(), GameState::NIGHT);
}
}