Ejemplo n.º 1
0
 /**
  * Stores the required resources for the current building.
  *
  * @param integer $nextLevel
  * @param Bengine_Game_Model_Construction $construction
  *
  * @return Bengine_Game_Controller_Construction_Abstract
  */
 protected function setRequieredResources($nextLevel, Bengine_Game_Model_Construction $construction)
 {
     $basicMetal = $construction->get("basic_metal");
     $basicSilicon = $construction->get("basic_silicon");
     $basicHydrogen = $construction->get("basic_hydrogen");
     $basicEnergy = $construction->get("basic_energy");
     if ($nextLevel > 1) {
         if ($basicMetal > 0) {
             $this->requiredMetal = parseFormula($construction->get("charge_metal"), $basicMetal, $nextLevel);
         } else {
             $this->requiredMetal = 0;
         }
         if ($basicSilicon > 0) {
             $this->requiredSilicon = parseFormula($construction->get("charge_silicon"), $basicSilicon, $nextLevel);
         } else {
             $this->requiredSilicon = 0;
         }
         if ($basicHydrogen > 0) {
             $this->requiredHydrogen = parseFormula($construction->get("charge_hydrogen"), $basicHydrogen, $nextLevel);
         } else {
             $this->requiredHydrogen = 0;
         }
         if ($basicEnergy > 0) {
             $this->requiredEnergy = parseFormula($construction->get("charge_energy"), $basicEnergy, $nextLevel);
         } else {
             $this->requiredEnergy = 0;
         }
     } else {
         $this->requiredMetal = (int) $basicMetal;
         $this->requiredSilicon = (int) $basicSilicon;
         $this->requiredHydrogen = (int) $basicHydrogen;
         $this->requiredEnergy = (int) $basicEnergy;
     }
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * (non-PHPdoc)
  * @see lib/Object#init()
  */
 protected function init()
 {
     parent::init();
     $this->setModelName("game/fleet")->setCollectionName("game/fleet");
     return;
 }