/**
  * Collects the data for the shiptype arrays
  */
 protected function createShipTypeArrays()
 {
     // attacker
     foreach ($this->navalFormationFleets as $fleetID => $fleet) {
         $userObj = $this->navalFormationUsers[$fleet->ownerID];
         Spec::storeData(false, false, $fleet);
         $specs = Spec::getBySpecType(3, false);
         foreach ($specs as $specID => $specObj) {
             $this->attackerShipTypes[$specID . $fleetID] = self::createShipTypeArray($specObj, $userObj);
         }
     }
     // defender (planet)
     Spec::storeData($this->getTargetPlanet());
     $specs = Spec::getBySpecType(array(3, 4), false);
     foreach ($specs as $specID => $specObj) {
         $userObj = $this->standByUsers[$this->ofiaraID];
         $this->defenderShipTypes[$specID . '0'] = self::createShipTypeArray($specObj, $userObj);
     }
     // defender (stand-by)
     foreach ($this->standByFleets as $fleetID => $fleet) {
         $userObj = $this->standByUsers[$fleet->ownerID];
         Spec::storeData(false, false, $fleet);
         $specs = Spec::getBySpecType(3, false);
         foreach ($specs as $specID => $specObj) {
             $this->defenderShipTypes[$specID . $fleetID] = self::createShipTypeArray($specObj, $userObj);
         }
     }
 }
 /**
  * Destroys the espionage sondes if they get destroyed.
  */
 protected function destroy()
 {
     $shipCount = 0;
     Spec::storeData($this->getTargetPlanet(), false);
     $specs = Spec::getBySpecType(3, false);
     foreach ($specs as $specObj) {
         $shipCount += $specObj->level;
     }
     $this->destroyChance = pow($this->getOfiara()->spy_tech / $this->getOwner()->spy_tech, 5) * $this->fleet[210] * pow($shipCount, 0.2) / 10;
     $this->destroyChance = min($this->destroyChance, 100);
     $rand = rand(0, 99);
     if ($this->destroyChance > $rand) {
         $this->fight = true;
         $this->simulate();
         $this->generateReport();
     }
     $this->ereport .= WCF::getLanguage()->get('wot.mission.mission6.impact.owner.defenseChance', array('$defenseChance' => StringUtil::formatNumeric(round($this->destroyChance))));
 }
示例#3
0
 /**
  * Initialises the specification system.
  */
 protected function initSpec()
 {
     Spec::storeData(self::getPlanet(), self::getUser());
 }
示例#4
0
 /**
  * Builds the data array.
  *
  * @param	Planet	planet
  */
 protected static function getData(Planet $planet)
 {
     Spec::storeData($planet);
     $data = array('specID' => $planet->b_building_id, 'level' => Spec::getSpecObj($planet->b_building_id)->level + 1, 'planetID' => $planet->planetID, 'planetName' => $planet->name, 'coords' => array($planet->galaxy, $planet->system, $planet->planet, $planet->planetKind));
     return $data;
 }
 /**
  * Creates the ship data arrays for each defense type
  */
 protected function createPrototypes()
 {
     Spec::storeData($this->getTargetPlanet());
     $specs = Spec::getBySpecType(4, false);
     foreach ($specs as $specID => $specObj) {
         $this->prototypes[$specID] = array('specID' => $specID, 'count' => $specObj->level, 'colName' => $specObj->colName, 'hullPlating' => ($specObj->costsMetal + $specObj->costsMetal) / 10 * (1 + 0.1 * $this->getOfiara()->defence_tech));
         $this->defenderShipCount += $specObj->level;
     }
 }