Example #1
0
 public function CostIsDeductible(Cost $value)
 {
     $enoughMetal = $this->Metal() - $value->Metal() >= 0;
     $enoughCrystal = $this->Crystal() - $value->Crystal() >= 0;
     $enoughDeuterium = $this->Deuterium() - $value->Deuterium() >= 0;
     $enoughEnergy = $this->Energy() - $value->Energy() >= 0;
     if ($enoughMetal && $enoughCrystal && $enoughDeuterium && $enoughEnergy) {
         return true;
     }
     return false;
 }
Example #2
0
 public function BuildTime(Colony $colony, Cost $buildCosts)
 {
     // Calculate time required
     global $NN_config;
     $metalCost =& $buildCosts->Metal();
     $crystalCost =& $buildCosts->Crystal();
     $gameSpeed =& $NN_config["game_speed"];
     $robotFactories = $colony->Buildings()->GetMemberByName("robotics_factory")->Amount();
     $nanoFactories = $colony->Buildings()->GetMemberByName("nano_factory")->Amount();
     $manufacturers = $colony->Owner()->Officers()->GetMemberByName("manufacturer")->Amount();
     $timeRequired = ($metalCost + $crystalCost) / $gameSpeed * (1 / ($robotFactories + 1)) * pow(0.5, $nanoFactories);
     $timeRequired = floor($timeRequired * 3600 * (1 - $manufacturers * 0.1));
     return $timeRequired;
 }