Passed
Push — master ( dd3471...ff1e5a )
by Jakub
02:42
created

CharacterSpecialSkill::getSkillType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
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
  /** @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 getSkillType(): string {
22 1
    return "special";
23
  }
24
25
  public function getSkill(): SkillSpecial {
26 1
    return $this->skill;
27
  }
28
  
29
  public function getValue(): int {
30 1
    if($this->skill->type === SkillSpecial::TYPE_STUN) {
31 1
      return 0;
32
    }
33 1
    $value = $this->skill->value;
34 1
    $value += $this->skill->valueGrowth * ($this->level - 1);
35 1
    return $value;
36
  }
37
}
38
?>