diff options
Diffstat (limited to 'src/Model/Building.php')
-rw-r--r-- | src/Model/Building.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Model/Building.php b/src/Model/Building.php index e42af03..36bdc68 100644 --- a/src/Model/Building.php +++ b/src/Model/Building.php @@ -4,6 +4,7 @@ namespace App\Model; use App\DB; use App\Model; +use App\Support\ResourceType; class Building { @@ -17,11 +18,15 @@ class Building public \DateTime $updatedAt; public string $unitType; + public int $buildTimeFactor; + public array $resourceRequirementsBase; public array $resourceRequirementsFactor; + public array $buildingRequirements; public array $techRequirements; + public int $maxLevel; @@ -80,6 +85,7 @@ class Building return $this->level + count($upgradeEvents); } + public function getBuildTime(): int { return $this->getBuildTimeForLevel($this->level + 1); @@ -92,6 +98,7 @@ class Building return intval($level * ($level / $townHall->level) * $_ENV['BASE_BUILDING_BUILD_TIME_FACTOR'] * $this->buildTimeFactor); } + /** * @return array<string, int> */ @@ -106,7 +113,7 @@ class Building public function getResourceRequirementsForLevel(int $level): array { $resourceRequirements = []; - foreach (['wood', 'clay', 'iron'] as $resourceType) { + foreach (ResourceType::asPropertiesForBuildings() as $resourceType) { $base = $this->resourceRequirementsBase[$resourceType]; $factor = $this->resourceRequirementsFactor[$resourceType]; |