summaryrefslogtreecommitdiff
path: root/src/Model/Building.php
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-01-08 15:10:10 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-01-08 15:10:10 +0100
commit82875448c485d26375ed6dea4e64e940f6e10f74 (patch)
treeff2580447429309824e7d64401ad75e7f756e45e /src/Model/Building.php
parentb21316248572cb27ed1f504529ad6680a473022e (diff)
gemini
Diffstat (limited to 'src/Model/Building.php')
-rw-r--r--src/Model/Building.php16
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;
}