private function onNight(Game $game) { $nightMsg = ":crescent_moon: :zzz: The sun sets and the villagers go to sleep."; $this->sendMessageToChannel($game, $nightMsg); $wolves = $game->getPlayersOfRole(Role::WEREWOLF); $wolfMsg = ":crescent_moon: It is night and it is time to hunt. Type !kill #channel @player to make your choice. "; foreach ($wolves as $wolf) { $this->client->getDMByUserId($wolf->getId())->then(function (DirectMessageChannel $channel) use($wolfMsg) { $this->client->send($wolfMsg, $channel); }); } $seerMsg = ":mag_right: Seer, select a player by saying !see #channel @username."; $seers = $game->getPlayersOfRole(Role::SEER); foreach ($seers as $seer) { $this->client->getDMByUserId($seer->getId())->then(function (DirectMessageChannel $channel) use($seerMsg) { $this->client->send($seerMsg, $channel); }); } $bodyGuardMsg = ":muscle: Bodyguard, you may guard someone once per night. That player cannot be eliminated. Type !guard #channel @user"; $bodyguards = $game->getPlayersOfRole(Role::BODYGUARD); foreach ($bodyguards as $bodyguard) { $this->client->getDMByUserId($bodyguard->getId())->then(function (DirectMessageChannel $channel) use($bodyGuardMsg) { $this->client->send($bodyGuardMsg, $channel); }); } }
/** * @param Game $game */ private function onNight(Game $game) { $client = $this->client; $nightMsg = ":moon: :zzz: The sun sets, and the hard rain makes it difficult to hear anything outside. Villagers bar their doors, take long pulls of :beer:, and try not to think of what might lurk beyond the feeble candlelight. "; $this->sendMessageToChannel($game, $nightMsg); $wolves = $game->getWerewolves(); $wolfMsg = ":moon: It is night and it is time to hunt. Type !kill #channel @player to make your choice. "; foreach ($wolves as $wolf) { $this->client->getDMByUserId($wolf->getId())->then(function (DirectMessageChannel $channel) use($client, $wolfMsg) { $client->send($wolfMsg, $channel); }); } $seerMsg = ":crystal_ball: Seer, select a player by saying !see #channel @username."; $seers = $game->getPlayersOfRole(Role::SEER); foreach ($seers as $seer) { $this->client->getDMByUserId($seer->getId())->then(function (DirectMessageChannel $channel) use($client, $seerMsg) { $client->send($seerMsg, $channel); }); } $bodyGuardMsg = ":shield: Bodyguard, you may guard someone once per with your grizzled ex-lawman skills. That player cannot be eliminated. Type !guard #channel @user"; $bodyguards = $game->getPlayersOfRole(Role::BODYGUARD); foreach ($bodyguards as $bodyguard) { $this->client->getDMByUserId($bodyguard->getId())->then(function (DirectMessageChannel $channel) use($client, $bodyGuardMsg) { $client->send($bodyGuardMsg, $channel); }); } $witches = $game->getPlayersOfRole(Role::WITCH); if (count($witches) > 0) { $witch_msg = ":wine_glass: You may poison someone once for the entire game. Type \"!poison #channel @user\" to poison someone \r\nor \"!poison #channel noone\" to do nothing. \r\n:warning: Night will not end until you make a decision."; if ($game->getWitchPoisonPotion() > 0) { foreach ($witches as $witch) { $this->client->getDMByUserId($witch->getId())->then(function (DirectMessageChannel $channel) use($client, $witch_msg) { $client->send($witch_msg, $channel); }); } } else { $game->setWitchPoisoned(true); } } }