Passed
Push — master ( fa53c0...9478ec )
by Paweł
02:37
created

WeaponMastery::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Build\Talent\WeaponMastery;
6
7
use AardsGerds\Game\Build\Talent\Talent;
8
use AardsGerds\Game\Build\Talent\TalentPoints;
9
use AardsGerds\Game\Inventory\Weapon\WeaponType;
10
11
final class WeaponMastery implements Talent, \Stringable
12
{
13 1
    private function __construct(
14
        private WeaponType $type,
15
        private WeaponMasteryLevel $level,
16 1
    ) {}
17
18 1
    public static function shortSword(WeaponMasteryLevel $level): self
19
    {
20 1
        return new self(WeaponType::shortSword(), $level);
21
    }
22
23 1
    public static function greatSword(WeaponMasteryLevel $level): self
24
    {
25 1
        return new self(WeaponType::greatSword(), $level);
26
    }
27
28
    public static function bow(WeaponMasteryLevel $level): self
29
    {
30
        return new self(WeaponType::bow(), $level);
31
    }
32
33
    public static function getName(): string
34
    {
35
        return 'Weapon Mastery';
36
    }
37
38
    public static function getDescription(): string
39
    {
40
        return 'Talent of weapon fighting.';
41
    }
42
43
    public static function getRequiredTalentPoints(): TalentPoints
44
    {
45
        return new TalentPoints(4);
46
    }
47
48 1
    public function getType(): WeaponType
49
    {
50 1
        return $this->type;
51
    }
52
53 1
    public function getLevel(): WeaponMasteryLevel
54
    {
55 1
        return $this->level;
56
    }
57
58
    public function __toString(): string
59
    {
60
        return "Mastery at {$this->type}: {$this->level}";
61
    }
62
}