示例#1
0
文件: Game.php 项目: uhtoff/WotR
 public function getUnitsToRecruit(Location $l, $elite = true)
 {
     $units = $this->getUnits(true)->filter(function ($u) use($l) {
         return $u->getNation() && $u->getNation()->getDetails() == $l->getNation();
     });
     $types = array();
     foreach ($units as $u) {
         if (in_array($u->getType(), $types) || !$elite && $u->isElite()) {
             $units->removeElement($u);
         } else {
             $types[] = $u->getType();
         }
     }
     return $units;
 }
示例#2
0
 /**
  * Set source
  *
  * @param \Meldon\WotRBundle\Entity\Location $source
  * @return Connection
  */
 public function setSource(\Meldon\WotRBundle\Entity\Location $source = null)
 {
     $this->source = $source;
     $source->addConnection($this);
     return $this;
 }
示例#3
0
文件: Unit.php 项目: uhtoff/WotR
 /**
  * Set location
  *
  * @param \Meldon\WotRBundle\Entity\Location $location
  * @return Unit
  */
 public function setLocation(\Meldon\WotRBundle\Entity\Location $location = null)
 {
     if (is_a($this->getLocation(), 'Location')) {
         $this->getLocation()->removeUnit($this);
     }
     $this->location = $location;
     $location->addUnit($this);
     return $this;
 }