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

EtherumPotion   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 19
ccs 0
cts 11
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A consume() 0 6 1
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