protected function run() { if ($this->check == self::OK) { GameUtils::throwCards($this->game, $this->actualPlayer, array($this->ponyExpressCard), 'table'); $drawnCards = GameUtils::drawCards($this->game, 3); $handCards = unserialize($this->actualPlayer['hand_cards']); foreach ($drawnCards as $drawnCard) { $handCards[] = $drawnCard; } $this->actualPlayer['hand_cards'] = serialize($handCards); $this->actualPlayer->save(); } }
protected function run() { if ($this->check == DefensiveCommand::OK) { // odhodime kartu biblia GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards, 'table'); $this->runMollyStarkAction(); // potiahneme kartu $drawnCards = GameUtils::drawCards($this->game, 1); $handCards = unserialize($this->actualPlayer['hand_cards']); $handCards = array_merge($handCards, $drawnCards); $this->actualPlayer['hand_cards'] = serialize($handCards); $this->changeInterturn(); } }
protected function run() { if ($this->check == self::OK) { GameUtils::throwCards($this->game, $this->actualPlayer, array($this->wellsFargoCard)); $drawnCards = GameUtils::drawCards($this->game, 3); // TODO toto je asi miesto kde sa zvysuje pocet kariet - v game utils throw cards sa karta zahodi ale tu este asi je $handCards = unserialize($this->actualPlayer['hand_cards']); foreach ($drawnCards as $drawnCard) { $handCards[] = $drawnCard; } $this->actualPlayer['hand_cards'] = serialize($handCards); $this->actualPlayer->save(); } }
protected function run() { if ($this->check == self::OK) { $additionalLifes = 1; if ($this->useCharacter === TRUE && $this->actualPlayer->getIsTequilaJoe()) { $additionalLifes = 2; } $newLifes = min($this->actualPlayer['actual_lifes'] + $additionalLifes, $this->actualPlayer['max_lifes']); $this->actualPlayer['actual_lifes'] = $newLifes; $this->actualPlayer->save(); GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards); foreach ($this->game->getPlayers() as $player) { if ($player->getIsMadamYto()) { $drawnCards = GameUtils::drawCards($this->game, 1); $handCards = unserialize($player['hand_cards']); $handCards = array_merge($handCards, $drawnCards); $player['hand_cards'] = serialize($handCards); $player->save(); } } } }
protected function run() { if ($this->check == self::OK) { $this->attackedPlayer['phase'] = Player::PHASE_UNDER_ATTACK; $this->attackedPlayer->save(); $drawnCards = GameUtils::drawCards($this->game, 1); $handCards = unserialize($this->actualPlayer['hand_cards']); $handCards = array_merge($handCards, $drawnCards); $this->actualPlayer['hand_cards'] = serialize($handCards); $this->actualPlayer['phase'] = Player::PHASE_WAITING; if ($this->actualPlayer->getIsBelleStar($this->game)) { $notices = $this->actualPlayer->getNoticeList(); $notices['character_used'] = 1; $this->actualPlayer->setNoticeList($notices); } $this->actualPlayer->save(); // TODO toto plati len ak je to utok bangom, ale bang sa pouziva na viacerych miestach - premysliet a dorobit aj duel a indianov prip dalsie $this->game['inter_turn'] = $this->attackedPlayer['id']; $this->game['inter_turn_reason'] = serialize(array('action' => 'derringer', 'from' => $this->actualPlayer['id'], 'to' => $this->attackedPlayer['id'])); $this->game->save(); GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards, 'table'); } }
protected function drawBountyCard() { if ($this->actualPlayer->getHasBountyOnTheTable()) { $drawnCards = GameUtils::drawCards($this->game, 1); $handCards = unserialize($this->attackingPlayer['hand_cards']); $handCards = array_merge($handCards, $drawnCards); $this->attackingPlayer['hand_cards'] = serialize($handCards); } }
protected function run() { if ($this->check == self::OK) { if ($this->params['playCardName'] == 'jail') { // TODO tieto karty treba najprv ukazat hracom cez log a aby sa dali vyhodit, musia byt najprv v ruke aktualneho hraca a potom ich vyhodi $count = 1; if ($this->actualPlayer->getIsLuckyDuke($this->game)) { $count = 2; } $drawnCards = GameUtils::drawCards($this->game, $count); // TODO pocet zavisi aj od charakteru $isHeart = FALSE; $cardRepository = new CardRepository(); $thrownCards = array(); foreach ($drawnCards as $drawnCardId) { $drawnCard = $cardRepository->getOneById($drawnCardId); $thrownCards[] = $drawnCard; if ($drawnCard->getIsHearts($this->game)) { $isHeart = TRUE; // break tu nie je lebo musime prejst cez vsetky karty // aby sme vyrobili pole kariet ktore treba vyhodit } } $this->moveDrawnCards($thrownCards); if ($isHeart) { $this->drawResult = self::OK; $this->actualPlayer['phase'] = Player::PHASE_DRAW; $this->actualPlayer->save(); GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards, 'table'); } else { $this->drawResult = self::KO; $this->actualPlayer['phase'] = Player::PHASE_NONE; $this->actualPlayer->save(); GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards, 'table'); $nextPositionPlayer = GameUtils::getPlayerOnNextPosition($this->game, $this->actualPlayer); $this->game['turn'] = $nextPositionPlayer['id']; $this->game->save(); $nextPositionPlayer['phase'] = $this->getNextPhase($nextPositionPlayer); $nextPositionPlayer->save(); } } elseif ($this->params['playCardName'] == 'dynamite') { $count = 1; if ($this->actualPlayer->getIsLuckyDuke($this->game)) { $count = 2; } $drawnCards = GameUtils::drawCards($this->game, $count); $isSafe = FALSE; $cardRepository = new CardRepository(); $thrownCards = array(); foreach ($drawnCards as $drawnCardId) { $drawnCard = $cardRepository->getOneById($drawnCardId); $thrownCards[] = $drawnCard; if (!$drawnCard->getIsSpades($this->game) || in_array($drawnCard['value'], array('10', 'J', 'Q', 'K', 'A'))) { $isSafe = TRUE; // break tu nie je lebo musime prejst cez vsetky karty // aby sme vyrobili pole kariet ktore treba vyhodit } } $dynamite = $this->actualPlayer->getHasDynamiteOnTheTable($this->game); if ($isSafe === TRUE) { $this->moveDrawnCards($thrownCards); $this->drawResult = self::OK; // posunieme dynamit dalsiemu hracovi $nextPositionPlayer = GameUtils::getPlayerOnNextPosition($this->game, $this->actualPlayer); if ($nextPositionPlayer->getHasDynamiteOnTheTable($this->game)) { // ak dalsi hrac uz ma na stole dynamit, musim sa pozriet na hraca za nim $nextPositionPlayer = GameUtils::getPlayerOnNextPosition($this->game, $nextPositionPlayer); } if ($nextPositionPlayer['id'] != $this->actualPlayer['id']) { // v pripade dvoch hracov a dvoch dynamitov sa dynamity neposuvaju $retVal = GameUtils::moveCards($this->game, array($dynamite), $this->actualPlayer, 'table', $nextPositionPlayer, 'table'); $this->actualPlayer = $retVal['playerFrom']; } $this->actualPlayer['phase'] = $this->getNextPhase($this->actualPlayer); $this->actualPlayer = $this->actualPlayer->save(TRUE); } else { $this->drawResult = self::KO; // zahodime dynamit $retVal = GameUtils::throwCards($this->game, $this->actualPlayer, array($dynamite), 'table'); $this->actualPlayer = $retVal['player']; $this->game = $retVal['game']; // stiahneme hracovi tri zivoty $newLifes = $this->actualPlayer['actual_lifes'] - 3; $this->actualPlayer['actual_lifes'] = $newLifes; $this->actualPlayer['phase'] = $this->getNextPhase($this->actualPlayer); $this->actualPlayer = $this->actualPlayer->save(TRUE); $this->moveDrawnCards($thrownCards); if ($newLifes <= 0) { // TODO check ci nema na ruke pivo / piva a ak ano automaticky ich pouzit na zachranu // aspon dokym nebude na 1 zivote // nezabudnut na tequilla joe $nextPositionPlayer = GameUtils::getPlayerOnNextPosition($this->game, $this->actualPlayer); $this->game['turn'] = $nextPositionPlayer['id']; $this->game->save(); $nextPositionPlayer['phase'] = $this->getNextPhase($nextPositionPlayer); $nextPositionPlayer->save(); $this->removePlayerFromGame(); } } } elseif ($this->params['playCardName'] == 'rattlesnake') { $count = 1; if ($this->actualPlayer->getIsLuckyDuke($this->game)) { $count = 2; } $drawnCards = GameUtils::drawCards($this->game, $count); $isSafe = FALSE; $cardRepository = new CardRepository(); $thrownCards = array(); foreach ($drawnCards as $drawnCardId) { $drawnCard = $cardRepository->getOneById($drawnCardId); $thrownCards[] = $drawnCard; if (!$drawnCard->getIsSpades($this->game)) { $isSafe = TRUE; // break tu nie je lebo musime prejst cez vsetky karty // aby sme vyrobili pole kariet ktore treba vyhodit } } if ($isSafe === TRUE) { $this->moveDrawnCards($thrownCards); $this->drawResult = self::OK; $this->actualPlayer['phase'] = $this->getNextPhase($this->actualPlayer, TRUE); $this->actualPlayer = $this->actualPlayer->save(TRUE); } else { $this->drawResult = self::KO; // stiahneme hracovi jeden zivot $newLifes = $this->actualPlayer['actual_lifes'] - 1; $this->actualPlayer['actual_lifes'] = $newLifes; $this->actualPlayer['phase'] = $this->getNextPhase($this->actualPlayer, TRUE); $this->actualPlayer = $this->actualPlayer->save(TRUE); $this->moveDrawnCards($thrownCards); if ($newLifes <= 0) { // TODO check ci nema na ruke pivo / piva a ak ano automaticky ich pouzit na zachranu // aspon dokym nebude na 1 zivote // nezabudnut na tequilla joe $nextPositionPlayer = GameUtils::getPlayerOnNextPosition($this->game, $this->actualPlayer); $this->game['turn'] = $nextPositionPlayer['id']; $this->game->save(); $nextPositionPlayer['phase'] = $this->getNextPhase($nextPositionPlayer); $nextPositionPlayer->save(); $this->removePlayerFromGame(); } } } elseif ($this->params['playCardName'] == 'barrel') { $count = 1; if ($this->actualPlayer->getIsLuckyDuke($this->game)) { $count = 2; } $drawnCards = GameUtils::drawCards($this->game, $count); $isHeart = FALSE; $cardRepository = new CardRepository(); $thrownCards = array(); foreach ($drawnCards as $drawnCardId) { $drawnCard = $cardRepository->getOneById($drawnCardId); $thrownCards[] = $drawnCard; if ($drawnCard->getIsHearts($this->game)) { $isHeart = TRUE; // break tu nie je lebo musime prejst cez vsetky karty // aby sme vyrobili pole kariet ktore treba vyhodit } } $notices = $this->actualPlayer->getNoticeList(); if ($this->drawType == 'barrel') { $notices['barrel_used'] = 1; } elseif ($this->drawType == 'character') { $notices['character_jourdonnais_used'] = 1; } $this->actualPlayer->setNoticeList($notices); $this->actualPlayer = $this->actualPlayer->save(TRUE); if ($isHeart) { $this->drawResult = self::OK; $this->changeInterturn(); } else { $this->drawResult = self::KO; } $this->moveDrawnCards($thrownCards); } else { if ($this->useCharacter === TRUE && $this->actualPlayer->getIsVeraCuster($this->game)) { $notices = $this->actualPlayer->getNoticeList(); $selectedCharacter = $this->enemyPlayer->getCharacter(); $notices['selected_character'] = $selectedCharacter['id']; $this->actualPlayer->setNoticeList($notices); $this->actualPlayer = $this->actualPlayer->save(TRUE); // kedze je mozne ze si vyberieme nejaky charakter, ktory ovplyvnuje vzdialenost, preratame maticu $matrix = GameUtils::countMatrix($this->game); $this->game['distance_matrix'] = serialize($matrix); $this->game = $this->game->save(TRUE); } $counts = $this->getCountCards(); if ($this->actualPlayer->getIsYoulGrinner($this->game)) { $youlHandCardsCount = count($this->actualPlayer->getHandCards()); foreach ($this->getPlayers() as $player) { if ($player->getIsAlive() && $player['id'] != $this->actualPlayer['id']) { $playersHandCardsCount = count($player->getHandCards()); if ($playersHandCardsCount > $youlHandCardsCount) { $movedCard = $player->getCardWithId(); GameUtils::moveCards($this->game, array($movedCard), $player, 'hand', $this->actualPlayer, 'hand'); } } } } elseif ($this->useCharacter === TRUE) { if ($this->actualPlayer->getIsJesseJones($this->game)) { $retVal = GameUtils::moveCards($this->game, $this->enemyPlayersCards[$this->enemyPlayer['id']], $this->enemyPlayer, 'hand', $this->actualPlayer, $this->place); $this->actualPlayer = $retVal['playerTo']; $this->game = $retVal['game']; } elseif ($this->actualPlayer->getIsPatBrennan($this->game)) { $retVal = GameUtils::moveCards($this->game, $this->enemyPlayersCards[$this->enemyPlayer['id']], $this->enemyPlayer, 'hand', $this->actualPlayer, $this->place); $this->actualPlayer = $retVal['playerTo']; $this->game = $retVal['game']; // kedze je mozne ze rusime nejaku modru kartu ktora ovplyvnuje vzdialenost, preratame maticu // ak to bude velmi pomale, budeme to robit len ak je medzi zrusenymi kartami fakt takato karta $matrix = GameUtils::countMatrix($this->game); $this->game['distance_matrix'] = serialize($matrix); $this->game->save(); } elseif ($this->actualPlayer->getIsPedroRamirez($this->game)) { $throwPile = unserialize($this->game['throw_pile']); $card = array_pop($throwPile); $this->game['throw_pile'] = serialize($throwPile); $handCards = unserialize($this->actualPlayer['hand_cards']); $handCards[] = $card; $this->actualPlayer['hand_cards'] = serialize($handCards); } elseif ($this->actualPlayer->getIsEvelynTheBang($this->game)) { MySmarty::assign('card', NULL); // TODO select random bang card or evelyn character card $response = MySmarty::fetch('you-are-attacked.tpl'); $this->enemyPlayer['phase'] = Player::PHASE_UNDER_ATTACK; $this->enemyPlayer['command_response'] = $response; $this->enemyPlayer->save(); $this->game['inter_turn'] = $this->enemyPlayer['id']; $this->game['inter_turn_reason'] = serialize(array('action' => 'bang', 'from' => $this->actualPlayer['id'], 'to' => $this->enemyPlayer['id'])); $this->game->save(); } } $drawnCards = GameUtils::drawCards($this->game, $counts['draw']); // len hrac ktory musi vratit kartu nazad bude vyberat karty if ($counts['rest_action'] == 'back_to_deck') { $possibleChoices = array('drawn_cards' => $drawnCards, 'possible_pick_count' => $counts['pick'], 'rest_action' => $counts['rest_action']); $this->actualPlayer['possible_choices'] = serialize($possibleChoices); } else { // ostatnym sa rovno pridaju do ruky $handCards = unserialize($this->actualPlayer['hand_cards']); foreach ($drawnCards as $drawnCard) { $handCards[] = $drawnCard; } $this->actualPlayer['hand_cards'] = serialize($handCards); } if ($this->useCharacter === TRUE && $this->actualPlayer->getIsEvelynTheBang($this->game)) { $this->actualPlayer['phase'] = Player::PHASE_WAITING; } else { $this->actualPlayer['phase'] = Player::PHASE_PLAY; } $this->actualPlayer->save(); } } elseif ($this->check == self::PEYOTE_OK) { $color = $this->params['peyoteColor']; $method = 'getIs' . ucfirst($color); $drawnCards = GameUtils::drawCards($this->game, 1); // TODO messages, ukazat kartu ktora bola potiahnuta $cardRepository = new CardRepository(TRUE); $drawnCardId = $drawnCards[0]; $drawnCard = $cardRepository->getOneById($drawnCardId); if ($drawnCard->{$method}($this->game)) { $handCards = unserialize($this->actualPlayer['hand_cards']); $handCards[] = $drawnCardId; $this->actualPlayer['hand_cards'] = serialize($handCards); } else { GameUtils::throwCards($this->game, NULL, array($drawnCard)); $this->actualPlayer['phase'] = Player::PHASE_PLAY; } $this->actualPlayer->save(); } }
protected function run() { if ($this->check == self::OK) { $place = $this->params['place']; if (!$place) { $place = 'hand'; } // aj Vera Custer moze hrat za Garyho Lootera $garyLooters = array(); foreach ($this->getPlayers() as $player) { // pozrieme sa na vsetkych hracov ktori este nie su mrtvi a ani nie su aktualny hrac if ($player['actual_lifes'] > 0 && $this->actualPlayer['id'] != $player['id']) { if ($player->getIsGaryLooter($this->game)) { $garyLooters[] = $player; } } } if ($place == 'hand' && $garyLooters) { // vymysliet ako davat Garymu a Vere karty na striedacku - zatial spravene len pre nahodne vybraneho Garyho $garyLooter = $garyLooters[array_rand($garyLooters)]; GameUtils::moveCards($this->game, $this->cards, $this->actualPlayer, 'hand', $garyLooter, 'hand'); } else { GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards, $place); } if ($place == 'table') { // kedze je mozne ze rusime nejaku modru kartu ktora ovplyvnuje vzdialenost, preratame maticu // ak to bude velmi pomale, budeme to robit len ak je medzi vyhodenymi kartami fakt takato karta $matrix = GameUtils::countMatrix($this->game); $this->game['distance_matrix'] = serialize($matrix); $this->game->save(); } if (in_array($this->interTurnReason['action'], array('wild_band'))) { $this->runMollyStarkAction(); $this->changeInterturn(); } } elseif ($this->check == self::OK_JOSE_DELGADO) { $place = 'hand'; GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards, $place); $drawnCards = GameUtils::drawCards($this->game, 2); $handCards = unserialize($this->actualPlayer['hand_cards']); $handCards = array_merge($handCards, $drawnCards); $this->actualPlayer['hand_cards'] = serialize($handCards); $notices = $this->actualPlayer->getNoticeList(); if (isset($notices['character_used'])) { $notices['character_used'] = $notices['character_used'] + 1; } else { $notices['character_used'] = 1; } $this->actualPlayer->setNoticeList($notices); // zistit ci sa tu nahodou nestane to ze hracovi ostanu karty v ruke a este mu pribudnu dalsie $this->actualPlayer->save(); } elseif ($this->check == self::OK_DOC_HOLYDAY) { GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards); MySmarty::assign('card', $this->cards[0]); // TODO mozno sem poslat nejake veci ze zautocil doc holyday svojim charakterom $response = MySmarty::fetch($this->template); $this->attackedPlayer['command_response'] = $response; $this->attackedPlayer['phase'] = Player::PHASE_UNDER_ATTACK; $this->attackedPlayer->save(); $notices = $this->actualPlayer->getNoticeList(); $notices['character_used'] = 1; $this->actualPlayer->setNoticeList($notices); $this->actualPlayer['phase'] = Player::PHASE_WAITING; $this->actualPlayer->save(); $this->game['inter_turn'] = $this->attackedPlayer['id']; $this->game['inter_turn_reason'] = serialize(array('action' => 'doc_holyday', 'from' => $this->actualPlayer['id'], 'to' => $this->attackedPlayer['id'])); $this->game->save(); } elseif ($this->check == self::OK_SID_KETCHUM) { $additionalLifes = 1; $newLifes = min($this->actualPlayer['actual_lifes'] + $additionalLifes, $this->actualPlayer['max_lifes']); $this->actualPlayer['actual_lifes'] = $newLifes; $this->actualPlayer->save(); GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards); } elseif ($this->check == self::OK_POKER) { // odlozime karty $handCards = unserialize($this->actualPlayer['hand_cards']); $newHandCards = array(); $selectedCard = $this->cards[0]; foreach ($handCards as $handCard) { if ($handCard != $selectedCard['id']) { $newHandCards[] = $handCard; } } $this->actualPlayer['hand_cards'] = serialize($newHandCards); $this->actualPlayer->save(); $this->interTurnReason['thrownCards'][] = $selectedCard['id']; $this->changeInterturn(); } }
protected function runSuzyLafayetteAction() { if (!in_array($this->commandName, array('create', 'join', 'add_ai_player', 'init', 'choose_character', 'start'))) { if ($this->actualPlayer && $this->actualPlayer->getIsSuzyLafayette($this->game)) { if (!in_array($this->commandName, array('throw', 'draw', 'choose_cards'))) { $handCards = unserialize($this->actualPlayer['hand_cards']); if (count($handCards) == 0) { $drawnCards = GameUtils::drawCards($this->game, 1); $handCards = array_merge($handCards, $drawnCards); $this->actualPlayer['hand_cards'] = serialize($handCards); $this->actualPlayer = $this->actualPlayer->save(TRUE); } } } elseif ($this->enemyPlayer && $this->enemyPlayer->getIsSuzyLafayette($this->game)) { $handCards = unserialize($this->enemyPlayer['hand_cards']); if (count($handCards) == 0) { $drawnCards = GameUtils::drawCards($this->game, 1); $handCards = array_merge($handCards, $drawnCards); $this->enemyPlayer['hand_cards'] = serialize($handCards); $this->enemyPlayer = $this->enemyPlayer->save(TRUE); } } } }
protected function helenaZontero() { $drawnCardIds = GameUtils::drawCards($this->game, 1); $cardRepository = new CardRepository(TRUE); $drawnCard = $cardRepository->getOneById($drawnCardIds); if ($drawnCard->getIsRed($this->game)) { $roles = array(); foreach ($this->getPlayers() as $player) { if (!$player->getRoleObject()->getIsSheriff() && $player->getIsAlive()) { $role = $player->getRoleObject(); $roles[] = $role['id']; } } shuffle($roles); foreach ($this->getPlayers() as $newPlayer) { if (!$newPlayer->getRoleObject()->getIsSheriff() && $newPlayer->getIsAlive()) { $role = array_pop($roles); $newPlayer['role'] = $role; $newPlayer->save(); } } } GameUtils::throwCards($this->game, NULL, array($drawnCard)); }
protected function run() { if ($this->check == self::OK) { $passTurn = TRUE; if ($this->game->getIsHNVendetta() && !$this->actualPlayer->getPlayedVendetta()) { // TODO mozno by toto mohla byt metoda $count = 1; // neviem ci lucky duke pri vendete taha dve karty if ($this->actualPlayer->getIsLuckyDuke($this->game)) { $count = 2; } $drawnCards = GameUtils::drawCards($this->game, $count); $isHeart = FALSE; $cardRepository = new CardRepository(); $thrownCards = array(); foreach ($drawnCards as $drawnCardId) { $drawnCard = $cardRepository->getOneById($drawnCardId); $thrownCards[] = $drawnCard; if ($drawnCard->getIsHearts($this->game)) { $isHeart = TRUE; // break tu nie je lebo musime prejst cez vsetky karty // aby sme vyrobili pole kariet ktore treba vyhodit } } GameUtils::throwCards($this->game, NULL, $thrownCards); if ($isHeart) { $passTurn = FALSE; } } if ($passTurn) { $this->actualPlayer['phase'] = Player::PHASE_NONE; $this->actualPlayer['bang_used'] = 0; $tableCards = unserialize($this->actualPlayer['table_cards']); $waitCards = unserialize($this->actualPlayer['wait_cards']); $this->actualPlayer['table_cards'] = serialize(array_merge($tableCards, $waitCards)); $this->actualPlayer['wait_cards'] = serialize(array()); // znulujeme notices $notices = $this->actualPlayer->getNoticeList(); if (isset($notices['barrel_used'])) { unset($notices['barrel_used']); } if (isset($notices['character_jourdonnais_used'])) { unset($notices['character_jourdonnais_used']); } if (isset($notices['character_used'])) { unset($notices['character_used']); } // spravime zalohu premennej ghost $isGhost = $this->actualPlayer->getIsGhost(); // zrusime ghosta if (isset($notices['ghost'])) { unset($notices['ghost']); } if (isset($notices['vendetta'])) { unset($notices['vendetta']); } if (isset($notices['blood_brothers'])) { unset($notices['blood_brothers']); } $this->actualPlayer->setNoticeList($notices); $this->actualPlayer = $this->actualPlayer->save(TRUE); if ($this->game->getIsHNGhostTown() && $isGhost === TRUE) { // odstranime ghosta $this->removePlayerFromGame(); } $nextPositionPlayer = GameUtils::getPlayerOnNextPosition($this->game, $this->actualPlayer, TRUE); $this->game['turn'] = $nextPositionPlayer['id']; $this->game->save(); if ($this->game->getIsHNGhostTown() && $nextPositionPlayer['actual_lifes'] == 0) { $notices = $nextPositionPlayer->getNoticeList(); $notices['ghost'] = 1; $nextPositionPlayer->setNoticeList($notices); } $nextPositionPlayer['phase'] = $this->getNextPhase($nextPositionPlayer); $nextPositionPlayer->save(); // preratame maticu $matrix = GameUtils::countMatrix($this->game); $this->game['distance_matrix'] = serialize($matrix); $this->game->save(); } else { $notices = $this->actualPlayer->getNoticeList(); $notices['vendetta'] = 1; $this->actualPlayer->setNoticeList($notices); $this->actualPlayer['phase'] = $this->getNextPhase($this->actualPlayer); $this->actualPlayer = $this->actualPlayer->save(TRUE); // TODO message } } }