Passed
Push — master ( f4ac78...d70f6f )
by Paweł
03:02
created

EtherumPotion::consume()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 6
ccs 0
cts 4
cp 0
rs 10
cc 1
nc 1
nop 2
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\Etherum;
8
use AardsGerds\Game\Inventory\Coin;
9
use AardsGerds\Game\Player\Player;
10
use AardsGerds\Game\Player\PlayerAction;
11
12
final class EtherumPotion extends Potion
13
{
14
    public function __construct()
15
    {
16
        parent::__construct(
17
            'Etherum Potion',
18
            'Alcohol solution with little Etherum in it. 
19
            This potion will grant you 1 Etherum, or kill you if you underestimate it.',
20
            new Coin(100),
21
            new Coin(200),
22
        );
23
    }
24
25
    public function consume(Player $player, PlayerAction $playerAction): void
26
    {
27
        $player->increaseEtherum(new Etherum(1));
28
        $player->getInventory()->remove($this);
29
30
        $playerAction->tell('Whoah, what the heck was that...');
31
    }
32
}
33