Passed
Push — master ( 8332b5...06ba98 )
by Paweł
02:52
created

HealthPotion::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Inventory\Alchemy\Potion;
6
7
use AardsGerds\Game\Build\Attribute\Health;
8
use AardsGerds\Game\Inventory\Coin;
9
use AardsGerds\Game\Player\Player;
10
use AardsGerds\Game\Player\PlayerAction;
11
12
final class HealthPotion extends Potion
13
{
14
    public function __construct()
15
    {
16
        parent::__construct(
17
            'Health Potion',
18
            'This herbs combination will regenerate 40 health.',
19
            new Coin(20),
20
            new Coin(50),
21
        );
22
    }
23
24
    public function use(Player $player, PlayerAction $playerAction): void
25
    {
26
        // todo: player maximum health
27
        $player->getHealth()->increaseBy(new Health(40));
28
        $playerAction->tell('You feel better now.');
29
    }
30
}
31