Total Complexity | 9 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | 1 | final class CharacterAttackSkill extends BaseCharacterSkill |
|
15 | { |
||
16 | public function __construct(SkillAttack $skill, int $level) |
||
17 | { |
||
18 | 1 | parent::__construct($skill, $level); |
|
19 | 1 | } |
|
20 | |||
21 | protected function getSkillType(): string |
||
22 | { |
||
23 | 1 | return "attack"; |
|
24 | } |
||
25 | |||
26 | /** |
||
27 | * @return SkillAttack |
||
28 | */ |
||
29 | protected function getSkill(): SkillAttack |
||
30 | { |
||
31 | 1 | return $this->skill; |
|
32 | } |
||
33 | |||
34 | protected function getDamage(): int |
||
35 | { |
||
36 | 1 | $damage = 0; |
|
37 | 1 | if (str_ends_with($this->skill->baseDamage, "%")) { |
|
38 | 1 | $damage += (int) $this->skill->baseDamage; |
|
39 | } |
||
40 | 1 | if (str_ends_with($this->skill->damageGrowth, "%")) { |
|
41 | 1 | $damage += (int) $this->skill->damageGrowth * ($this->level - 1); |
|
42 | } |
||
43 | 1 | return $damage; |
|
44 | } |
||
45 | |||
46 | protected function getHitRate(): int |
||
52 | } |
||
53 | } |
||
54 |