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