Example #1
0
File: Game.php Project: uhtoff/WotR
 public function reduceElite(Unit $e)
 {
     $units = $this->getUnits();
     $possRegs = $units->filter(function ($u) use($e) {
         return $u->getNation() == $e->getNation() && is_null($u->getLocation()) && $u->isRegular();
     });
     $deadRegs = $possRegs->filter(function ($u) {
         return $u->getCasualty();
     });
     if (!$deadRegs->isEmpty()) {
         $nR = $deadRegs->first();
     } else {
         $nR = $possRegs->first();
     }
     $nR->setLocation($e->getLocation())->setCombatant($e->getCombatant())->setCasualty(false);
     return $nR;
 }
Example #2
0
 /**
  * @param bool $casualty
  */
 public function becomeCasualty($casualty = true)
 {
     if ($this->getFellowship()) {
         $this->leaveFellowship();
     }
     parent::becomeCasualty($casualty);
     $this->setCasualty(true);
 }