diff options
Diffstat (limited to 'src/Model/Building.php')
-rw-r--r-- | src/Model/Building.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Model/Building.php b/src/Model/Building.php index eefb4df..e42af03 100644 --- a/src/Model/Building.php +++ b/src/Model/Building.php @@ -18,7 +18,8 @@ class Building public string $unitType; public int $buildTimeFactor; - public array $resourceRequirements; + public array $resourceRequirementsBase; + public array $resourceRequirementsFactor; public array $buildingRequirements; public array $techRequirements; public int $maxLevel; @@ -104,10 +105,15 @@ class Building */ public function getResourceRequirementsForLevel(int $level): array { - return array_map( - fn ($resourceRequirement) => ceil(log($level * 2) * $resourceRequirement * $_ENV['BASE_BUILDING_RESOURCE_REQUIREMENT_FACTOR'] * $level), - $this->resourceRequirements - ); + $resourceRequirements = []; + foreach (['wood', 'clay', 'iron'] as $resourceType) { + $base = $this->resourceRequirementsBase[$resourceType]; + $factor = $this->resourceRequirementsFactor[$resourceType]; + + $resourceRequirements[$resourceType] = $base + ceil(log($level * 2) * $factor * $_ENV['BASE_BUILDING_RESOURCE_REQUIREMENT_FACTOR'] * $level); + } + + return $resourceRequirements; } |