summaryrefslogtreecommitdiff
path: root/src/Model/Building/Storage.php
blob: de2df92b831824a64ea084727fd1b793e6b6a41e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

namespace App\Model\Building;

use App\Model\Building;
use App\Model\Village;

class Storage extends Building
{
  public int $buildTimeFactor = 1;
  public int $maxLevel = 25;

  public array $resourceRequirements = [
    'wood' => 1.0,
    'clay' => 1.0,
    'iron' => 1.0,
  ];

  public function getCapacity(): int
  {
    return $this->level * $_ENV['BASE_STORAGE_CAPACITY_FACTOR'];
  }

  public function getResourceCapacity(string $resourceType): int
  {
    $p = Village::getStorageConfig($this->villageId)->$resourceType / 100;

    return ceil($this->getCapacity() * $p);
  }
}