CharacterSpecialSkill::getSkill()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
ccs 1
cts 1
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace HeroesofAbenez\Combat;
5
6
/**
7
 * Character skill special
8
 *
9
 * @author Jakub Konečný
10
 * @property-read SkillSpecial $skill
11
 * @property-read int $value
12
 */
13 1
final class CharacterSpecialSkill extends BaseCharacterSkill
14
{
15
    public function __construct(SkillSpecial $skill, int $level)
16
    {
17 1
        parent::__construct($skill, $level);
18 1
    }
19
20
    protected function getSkillType(): string
21
    {
22 1
        return "special";
23
    }
24
25
    protected function getSkill(): SkillSpecial
26
    {
27 1
        return $this->skill;
28
    }
29
30
    protected function getValue(): int
31
    {
32 1
        if ($this->skill->type === SkillSpecial::TYPE_STUN) {
33 1
            return 0;
34
        }
35 1
        $value = $this->skill->value;
36 1
        $value += $this->skill->valueGrowth * ($this->level - 1);
37 1
        return $value;
38
    }
39
}
40