Пример #1
0
 /**
  * Renvoie les Qgs dont this est dans la ZDC
  * @param Hexa $hexa
  * @return QgCollection
  * @throws \Exception
  */
 public function inZdcDe(Hexa $hexa)
 {
     $ret = new QgCollection();
     if (is_null($this->getIdJoueur())) {
         throw new \Exception("Qg " . $this->getId() . " has no Joueur");
     }
     $qgs = $hexa->getCouronnePleine(Missions::getMaxTailleZdc())->getQgs();
     foreach ($qgs as $qg) {
         if (is_null($qg->getIdJoueur())) {
             throw new \Exception("Qg " . $qg->getId() . " has no Joueur");
         }
         if ($qg->getJoueur()->isEnnemi($this->getJoueur()) && $qg->getIdTypeMission() != Missions::RETRANCHEMENT && ($qg->getIdTypeQg() == $this->getIdTypeQg() || $this->getIdTypeQg() == Unites::TYPE_AMPHIBIE && ($qg->getIdTypeQg() == Unites::TYPE_TERRESTRE || $qg->getIdTypeQg() == Unites::TYPE_NAVAL)) && $qg->getHexa()->getCouronnePleine(Missions::$types[$qg->getIdTypeMission()]['tailleZone'])->exists($hexa)) {
             $ret->ajout($qg);
         }
     }
     return $ret;
 }