Ejemplo n.º 1
0
 protected function check()
 {
     if ($this->game->getIsHNHardLiquor()) {
         $phaseChecker = new PlayerPhaseChecker($this, array('isInDrawPhase'));
         $check = $phaseChecker->check();
         if ($check === TRUE) {
             $this->check = self::OK;
         }
     } elseif ($this->game->getIsHNBloodBrothers()) {
         if (!$this->actualPlayer->getGiveLifeInBloodBrothers()) {
             $this->check = self::OK;
             // TODO moze to robit len na zaciatku tahu - v draw faze? kedy bude moct venovat zivot gary looter?
             // TODO nesmie to byt posledny zivot
             // TODO musi vybrat hraca
             // TODO asi by to nemal byt hrac ktory ma plny pocet zivotov
         } else {
             // TODO uz pouzil blood brothers
         }
     }
 }
Ejemplo n.º 2
0
 protected function check()
 {
     // TODO skontrolovat ci uz hrac nie je na 0
     $checker = new PlayerPhaseChecker($this, array('isUnderAttack'));
     if ($checker->check()) {
         if ($this->actualPlayer['actual_lifes'] == 1 && $this->params['playCardName'] == 'beer') {
             // TODO save last life + shootgun
             // zistime ci hrac moze pouzit zachranne pivo
             if ($this->game->getIsHNTheReverend()) {
                 $this->check = self::REVEREND_IN_THE_GAME;
             } else {
                 $livePlayers = 0;
                 foreach ($this->getPlayers() as $player) {
                     if ($player->getIsAlive()) {
                         $livePlayers++;
                     }
                 }
                 if ($livePlayers > 2) {
                     if ($this->actualPlayer['actual_lifes'] == 1) {
                         $this->beerCard = $this->actualPlayer->getHasBeerOnHand();
                         if ($this->beerCard) {
                             if ($this->interTurnReason['action'] == 'bang' && $this->attackingPlayer->getHasShootgunOnTheTable()) {
                                 // TODO - mozno hrac nema karty na ruke
                                 if ($this->params['additionalCardsId']) {
                                     $card = $this->actualPlayer->getCardWithId('hand', $this->params['additionalCardsId']);
                                     if ($card) {
                                         $this->shootgunCards[] = $card;
                                         $this->check = self::SAVE_LAST_LIFE;
                                     } else {
                                         // nemas kartu s id playcardid
                                     }
                                 } else {
                                     // TODO musis vyhodit este jednu kartu
                                 }
                             } else {
                                 $this->check = self::SAVE_LAST_LIFE;
                             }
                         } else {
                             $this->check = self::NO_BEER_ON_HAND;
                         }
                     } else {
                         $this->check = self::NOT_LAST_LIFE;
                     }
                 } else {
                     $this->check = self::ONLY_TWO_PLAYERS_IN_GAME;
                 }
             }
         } else {
             if ($this->interTurnReason['action'] == 'bang' && $this->attackingPlayer->getHasShootgunOnTheTable()) {
                 if (count($this->actualPlayer->getHandCards())) {
                     // TODO - mozno hrac nema karty na ruke
                     if ($this->params['playCardId']) {
                         $card = $this->actualPlayer->getCardWithId('hand', $this->params['playCardId']);
                         if ($card) {
                             $this->shootgunCards[] = $card;
                             $this->check = self::OK;
                         } else {
                             // nemas kartu s id playcardid
                         }
                     } else {
                         // TODO musis vyhodit este jednu kartu
                     }
                 } else {
                     $this->check = self::OK;
                 }
             } else {
                 // mozno bude treba pridat dalsie checkery
                 $this->check = self::OK;
             }
         }
     } elseif ($this->actualPlayer['phase'] == Player::PHASE_HIGH_NOON) {
         // TODO use beer to save last life?
         $this->check = self::LOST_LIFE_IN_HIGH_NOON;
     } else {
         if ($this->useCharacter && $this->actualPlayer->getIsChuckWengam($this->game)) {
             if ($this->actualPlayer['actual_lifes'] > 1) {
                 $this->check = self::LOST_LIFE_AND_DRAW_CARDS;
             } else {
                 $this->check = self::CANNOT_LOST_YOUR_LAST_LIFE;
             }
         }
     }
 }