Exemplo n.º 1
0
 public function add(ShipType $shipType)
 {
     if (isset($this->array[$shipType->getId()])) {
         $this->array[$shipType->getId()]->increment($shipType->getCount());
     } else {
         $this->array[$shipType->getId()] = $shipType->cloneMe();
         //avoid collateral effects
     }
     $this->count += $shipType->getCount();
 }
Exemplo n.º 2
0
 public function addShipType(ShipType $shipType)
 {
     if (isset($this->array[$shipType->getId()])) {
         $this->array[$shipType->getId()]->increment($shipType->getCount());
     } else {
         $shipType = $shipType->cloneMe();
         //avoid collateral effects
         if ($this->id != -1) {
             $shipType->setWeaponsTech($this->weapons_tech);
             $shipType->setShieldsTech($this->shields_tech);
             $shipType->setArmourTech($this->armour_tech);
         }
         $this->array[$shipType->getId()] = $shipType;
     }
     $this->count += $shipType->getCount();
 }
Exemplo n.º 3
0
 public function getShotsFiredByAttackerToAll(ShipType $shipType_A, $real = false)
 {
     $num = new Number($this->getAttackerTotalShots() * $shipType_A->getCount());
     $denum = new Number($this->attackerShipType->getTotalCount());
     return Math::divide($num, $denum, $real);
 }