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

Slash   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 8
c 1
b 0
f 0
dl 0
loc 32
ccs 0
cts 12
cp 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getDamage() 0 3 1
A getRequiredWeaponMastery() 0 3 1
A getDescription() 0 3 1
A getRequiredTalentPoints() 0 3 1
A getEffects() 0 3 1
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