CharacterSpecialSkill::getValue()   A
last analyzed

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