Passed
Push — master ( 4cb590...954430 )
by Paweł
03:52
created

Slash::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
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\Fight\MeleeAttack;
14
use AardsGerds\Game\Inventory\Weapon\Weapon;
15
16
final class Slash implements MeleeAttack, WeaponMasteryTalent
17
{
18
    private const DAMAGE_MULTIPLIER = 0.9;
19
20
    public function getDamage(Weapon $weapon): Damage
21
    {
22
        return new Damage((int) round($weapon->getDamage()->get() * self::DAMAGE_MULTIPLIER));
23
    }
24
25
    public function getEffects(): EffectCollection
26
    {
27
        return new EffectCollection([]);
28
    }
29
30
    public static function getName(): string
31
    {
32
        return 'Slash';
33
    }
34
35
    public static function getDescription(): string
36
    {
37
        return 'Standard slash with sword. Everyone can do it.';
38
    }
39
40
    public static function getRequiredTalentPoints(): TalentPoints
41
    {
42
        return new TalentPoints(1);
43
    }
44
45
    public static function getRequiredWeaponMastery(): WeaponMastery
46
    {
47
        return WeaponMastery::shortSword(WeaponMasteryLevel::novice());
48
    }
49
}
50