| Total Complexity | 11 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 89.47% |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 1 | abstract class BaseCharacterSkill { |
|
| 18 | 1 | use \Nette\SmartObject; |
|
| 19 | |||
| 20 | /** @var BaseSkill */ |
||
| 21 | protected $skill; |
||
| 22 | /** @var int */ |
||
| 23 | protected $level; |
||
| 24 | /** @var int */ |
||
| 25 | protected $cooldown = 0; |
||
| 26 | |||
| 27 | public function __construct(BaseSkill $skill, int $level) { |
||
| 28 | 1 | $this->skill = $skill; |
|
| 29 | 1 | $this->setLevel($level); |
|
| 30 | 1 | } |
|
| 31 | |||
| 32 | public function getLevel(): int { |
||
| 34 | } |
||
| 35 | |||
| 36 | public function getCooldown(): int { |
||
| 37 | return $this->cooldown; |
||
| 38 | } |
||
| 39 | |||
| 40 | public function setLevel(int $level) { |
||
| 41 | 1 | $this->level = Numbers::range($level, 1, $this->skill->levels); |
|
| 42 | 1 | } |
|
| 43 | |||
| 44 | public function getSkillType(): string { |
||
| 45 | 1 | if($this->skill instanceof SkillAttack) { |
|
| 46 | 1 | return "attack"; |
|
| 47 | 1 | } elseif($this->skill instanceof SkillSpecial) { |
|
| 48 | 1 | return "special"; |
|
| 49 | } |
||
| 50 | return ""; |
||
| 51 | } |
||
| 52 | |||
| 53 | public function canUse(): bool { |
||
| 54 | 1 | return ($this->cooldown < 1); |
|
| 55 | } |
||
| 56 | |||
| 57 | public function resetCooldown(): void { |
||
| 59 | 1 | } |
|
| 60 | |||
| 61 | public function decreaseCooldown(): void { |
||
| 64 | } |
||
| 65 | 1 | } |
|
| 66 | } |
||
| 67 | ?> |