예제 #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();
 }
예제 #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();
 }
예제 #3
0
 /**
  * Fire::__construct()
  * 
  * @param ShipType $attackerShipType
  * @param Fleet $defenderFleet
  * @param bool $attacking
  * @return
  */
 public function __construct(ShipType $attackerShipType, Fleet $defenderFleet)
 {
     log_comment('calculating fire from attacker ' . $attackerShipType->getId());
     $this->attackerShipType = $attackerShipType;
     $this->defenderFleet = $defenderFleet;
     $this->calculateTotal();
 }
예제 #4
0
 public function getRfTo(ShipType $other)
 {
     return isset($this->rf[$other->getId()]) ? $this->rf[$other->getId()] : 0;
 }