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

CharacterSpecialSkill   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 19
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A getSkill() 0 2 1
A getValue() 0 7 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
?>