Passed
Push — master ( f2d70f...ce79d3 )
by Jakub
02:17
created

CharacterSpecialSkill::getValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
crap 2
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
class CharacterSpecialSkill extends BaseCharacterSkill {
14
  /** @var SkillSpecial */
15
  protected $skill;
16
  
17
  public function __construct(SkillSpecial $skill, int $level) {
18 1
    parent::__construct($skill, $level);
19 1
  }
20
  
21
  public function getSkill(): SkillSpecial {
22 1
    return $this->skill;
23
  }
24
  
25
  public function getValue(): int {
26 1
    if($this->skill->type === \HeroesofAbenez\Combat\SkillSpecial::TYPE_STUN) {
27 1
      return 0;
28
    }
29 1
    $value = $this->skill->value;
30 1
    $value += $this->skill->valueGrowth * ($this->level - 1);
31 1
    return $value;
32
  }
33
}
34
?>