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(); }
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(); }
/** * 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(); }
public function getRfTo(ShipType $other) { return isset($this->rf[$other->getId()]) ? $this->rf[$other->getId()] : 0; }