diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-01-11 13:15:02 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-01-11 13:15:02 +0100 |
commit | 09caff2b2a06d1f8ac8203567035a21c612165f9 (patch) | |
tree | 999be04ff0a418a33e438be9befc8c9297e383f4 /src/Model/Building.php | |
parent | 6301f63bd348109b8693a922f02e16d49205a8fd (diff) |
send resources
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]; |