예제 #1
0
 protected static function pass()
 {
     if (GameUtils::checkTurn(self::$game, self::$player)) {
         if (self::$game['inter_turn_reason'] == '') {
             if (self::$player['phase'] == 2) {
                 if (self::$player->getCanPass()) {
                     $next = GameUtils::getNextPosition(self::$game, self::$player['position']);
                     GameUtils::setTurn(self::$game, $next);
                     GameUtils::setInterTurn(self::$game, 0);
                     $playerRepository = new PlayerRepository();
                     $nextPlayer = $playerRepository->getPlayerByGameAndPosition(self::$game['id'], $next);
                     $nextPlayer->setPhase(1);
                     self::$player->setPhase(0);
                     self::$player->setUseBang(0);
                     Chat::addMessage('Posunul si ťah.', self::$room, User::SYSTEM, self::$loggedUser['id']);
                     Chat::addMessage('Si na ťahu, použi príkaz ".tahaj"', self::$room, User::SYSTEM, $nextPlayer['user']['id']);
                 } else {
                     Chat::addMessage('Nemôžeš posunúť ťah, pretože máš na ruke priveľa kariet', self::$room, User::SYSTEM, self::$loggedUser['id']);
                 }
             } else {
                 Chat::addMessage('Nemôžeš posunúť ťah, pretože si ešte neťahal karty.', self::$room, User::SYSTEM, self::$loggedUser['id']);
             }
         } else {
             Chat::addMessage('musis reagovat na ' . self::$game['inter_turn_reason'], self::$room, User::SYSTEM, self::$loggedUser['id']);
         }
     } else {
         Chat::addMessage('Nemôžeš posunúť ťah, pretože nie si na rade.', self::$room, User::SYSTEM, self::$loggedUser['id']);
     }
 }