Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
61abbb3900
commit
3fd8832b45
138 changed files with 2597 additions and 1253 deletions
|
|
@ -78,13 +78,10 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
*
|
||||
* @return Legacies_Empire_Model_Planet_Building_Shipyard
|
||||
*/
|
||||
public function updateQueue($time = null)
|
||||
public function updateQueue($time)
|
||||
{
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
if ($time === null) {
|
||||
$time = Legacies::now();
|
||||
}
|
||||
$elapsedTime = $time - $this->_currentPlanet->getData('b_building');
|
||||
|
||||
foreach ($this->getQueue() as $element) {
|
||||
|
|
@ -97,6 +94,7 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
$this->_currentPlanet->setElement($buildingId, $level);
|
||||
$this->_currentPlanet->updateResourceProduction($time - $elapsedTime);
|
||||
$this->_currentPlanet->updateStorages($time - $elapsedTime);
|
||||
$this->_currentPlanet->updateBuildingFields();
|
||||
$this->dequeue($element);
|
||||
|
||||
Legacies::dispatchEvent('planet.building.level-update', array(
|
||||
|
|
|
|||
|
|
@ -207,13 +207,13 @@ class Legacies_Empire_Model_Planet_Building_Shipyard
|
|||
|
||||
/**
|
||||
* Return the construction queue
|
||||
* @see Legacies_Empire_Model_Planet_Building_Shipyard_Item
|
||||
* @see Legacies_Empire_Model_Planet_Building_Shipyard_Builder
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getQueue()
|
||||
public function getBuilder()
|
||||
{
|
||||
return $this->_queue;
|
||||
return $this->_builder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Ship_LightTransport
|
||||
implements Legacies_Empire_Model_Planet_ShipInterface
|
||||
{
|
||||
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE = 4;
|
||||
|
||||
public function getBaseSpeed(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
||||
|
||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) {
|
||||
return $prices[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
|
||||
} else {
|
||||
return $prices[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_SECONDARY];
|
||||
}
|
||||
}
|
||||
|
||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) {
|
||||
return pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE));
|
||||
} else {
|
||||
return pow(1.2, $user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,4 +9,14 @@ class Legacies_Empire_Model_Planet_Ship_SolarSatellite
|
|||
Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity)
|
||||
);
|
||||
}
|
||||
|
||||
public function getMaximumSpeed(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getActualMaximumSpeed(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,10 +3,36 @@
|
|||
class Legacies_Empire_Model_Planet_Ship_Supernova
|
||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_ShipInterface
|
||||
{
|
||||
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE = 20;
|
||||
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY = 15;
|
||||
|
||||
public function getProductionRatios($quantity, $produtionRatio, $planet, $user)
|
||||
{
|
||||
return array(
|
||||
Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity) * -1250
|
||||
);
|
||||
}
|
||||
|
||||
public function getBaseSpeed(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
||||
|
||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE &&
|
||||
$user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) {
|
||||
return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
|
||||
} else {
|
||||
return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_SECONDARY];
|
||||
}
|
||||
}
|
||||
|
||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE &&
|
||||
$user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) {
|
||||
return pow(1.2, $user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE));
|
||||
} else {
|
||||
return pow(1.3, $user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE)) *
|
||||
pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,4 +2,6 @@
|
|||
|
||||
interface Legacies_Empire_Model_Planet_ShipInterface
|
||||
{
|
||||
public function getBaseSpeed(Legacies_Empire_Model_User $user);
|
||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user);
|
||||
}
|
||||
Loading…
Reference in a new issue