summaryrefslogtreecommitdiff
path: root/src/Model/Building/ResourceGenerator.php
blob: 5f1a6bb0a875699a1dbaa92b0fe5bb9004c2434b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

namespace App\Model\Building;

use App\Model\Building;
use App\Model\Unit;

class ResourceGenerator extends Building
{
  public string $resourceType;

  public function getResourceIncrementor(): int
  {
    $amountResiding = Unit::getAmountResiding($this->unitType, $this->villageId);

    return (int)ceil(
      log(
        ($this->level * $amountResiding) + 1
      ) * $_ENV['BASE_RESOURCE_GENERATION_FACTOR']
    );
  }
}