Passed
Push — master ( 5a7d8c...49f3d4 )
by Paweł
02:50
created

Slash::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Build\Talent\WeaponMastery\ShortSword\Novice;
6
7
use AardsGerds\Game\Build\Attribute\Damage;
8
use AardsGerds\Game\Build\Talent\Effect\EffectCollection;
9
use AardsGerds\Game\Build\Talent\TalentPoints;
10
use AardsGerds\Game\Build\Talent\WeaponMastery\WeaponMastery;
11
use AardsGerds\Game\Build\Talent\WeaponMastery\WeaponMasteryLevel;
12
use AardsGerds\Game\Build\Talent\WeaponMastery\WeaponMasteryTalent;
13
use AardsGerds\Game\Inventory\Weapon\ShortSword\ShortSword;
14
use AardsGerds\Game\Fight\Attack;
15
16
final class Slash implements Attack, WeaponMasteryTalent
17
{
18
    private const DAMAGE_MULTIPLIER = 0.9;
19
20
    public function __construct(
21
        private ShortSword $shortSword,
22
    ) {}
23
24
    public function getDamage(): Damage
25
    {
26
        return new Damage((int) round($this->shortSword->getDamage()->get() * self::DAMAGE_MULTIPLIER));
27
    }
28
29
    public function getEffects(): EffectCollection
30
    {
31
        return new EffectCollection([]);
32
    }
33
34
    public static function getName(): string
35
    {
36
        return 'Slash';
37
    }
38
39
    public static function getDescription(): string
40
    {
41
        return 'Standard slash with sword. Everyone can do it.';
42
    }
43
44
    public static function getRequiredTalentPoints(): TalentPoints
45
    {
46
        return new TalentPoints(1);
47
    }
48
49
    public static function getRequiredWeaponMastery(): WeaponMastery
50
    {
51
        return WeaponMastery::shortSword(WeaponMasteryLevel::novice());
52
    }
53
}
54