| Total Complexity | 8 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 92.86% |
| Changes | 4 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 18 | 1 | abstract class BaseCharacterSkill |
|
| 19 | { |
||
| 20 | use \Nette\SmartObject; |
||
| 21 | |||
| 22 | protected int $level; |
||
| 23 | protected int $cooldown = 0; |
||
| 24 | |||
| 25 | 1 | public function __construct(protected BaseSkill $skill, int $level) |
|
| 26 | { |
||
| 27 | 1 | $this->setLevel($level); |
|
| 28 | 1 | $this->resetCooldown(); |
|
| 29 | 1 | } |
|
| 30 | |||
| 31 | abstract protected function getSkillType(): string; |
||
| 32 | |||
| 33 | protected function getLevel(): int |
||
| 36 | } |
||
| 37 | |||
| 38 | protected function getCooldown(): int |
||
| 39 | { |
||
| 40 | return $this->cooldown; |
||
| 41 | } |
||
| 42 | |||
| 43 | protected function setLevel(int $level): void |
||
| 44 | { |
||
| 45 | 1 | $this->level = Numbers::range($level, 0, $this->skill->levels); |
|
| 46 | 1 | } |
|
| 47 | |||
| 48 | protected function isUsable(): bool |
||
| 49 | { |
||
| 50 | 1 | return ($this->cooldown < 1); |
|
| 51 | } |
||
| 52 | |||
| 53 | public function resetCooldown(): void |
||
| 56 | 1 | } |
|
| 57 | |||
| 58 | public function decreaseCooldown(): void |
||
| 62 | } |
||
| 63 | 1 | } |
|
| 65 |