|
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
|
|
|
use JetBrains\PhpStorm\Immutable; |
|
16
|
|
|
|
|
17
|
|
|
#[Immutable] |
|
18
|
|
|
final class Slash implements MeleeAttack, WeaponMasteryTalent |
|
19
|
|
|
{ |
|
20
|
|
|
private const MIN_DAMAGE_MULTIPLIER = 80; |
|
21
|
|
|
private const MAX_DAMAGE_MULTIPLIER = 110; |
|
22
|
|
|
|
|
23
|
3 |
|
public function getDamage(Weapon $weapon): Damage |
|
24
|
|
|
{ |
|
25
|
3 |
|
$damageMultiplier = rand(self::MIN_DAMAGE_MULTIPLIER, self::MAX_DAMAGE_MULTIPLIER) / 100; |
|
26
|
|
|
|
|
27
|
3 |
|
return new Damage((int) round($weapon->getDamage()->get() * $damageMultiplier)); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
3 |
|
public function getEffects(): EffectCollection |
|
31
|
|
|
{ |
|
32
|
3 |
|
return new EffectCollection([]); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
3 |
|
public static function getName(): string |
|
36
|
|
|
{ |
|
37
|
3 |
|
return 'Slash'; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public static function getDescription(): string |
|
41
|
|
|
{ |
|
42
|
|
|
return 'Standard slash with sword. Everyone can do it.'; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public static function getRequiredTalentPoints(): TalentPoints |
|
46
|
|
|
{ |
|
47
|
|
|
return new TalentPoints(1); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public static function getRequiredWeaponMastery(): WeaponMastery |
|
51
|
|
|
{ |
|
52
|
|
|
return WeaponMastery::shortSword(WeaponMasteryLevel::novice()); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
3 |
|
public function __toString(): string |
|
56
|
|
|
{ |
|
57
|
3 |
|
return self::getName(); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|