Passed
Push — master ( a55f22...56813c )
by Paweł
02:35
created

Player::getAttributePoints()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Player;
6
7
use AardsGerds\Game\Build\Attribute\AttributePoints;
8
use AardsGerds\Game\Build\Attribute\Etherum;
9
use AardsGerds\Game\Build\Attribute\Health;
10
use AardsGerds\Game\Build\Attribute\Strength;
11
use AardsGerds\Game\Build\Experience;
12
use AardsGerds\Game\Build\LevelProgress;
13
use AardsGerds\Game\Build\Talent\TalentCollection;
14
use AardsGerds\Game\Build\Talent\TalentPoints;
15
use AardsGerds\Game\Entity\Entity;
16
use AardsGerds\Game\Inventory\Weapon\Weapon;
17
18
final class Player extends Entity
19
{
20
    public function __construct(
21
        string $name,
22
        Health $health,
23
        Etherum $etherum,
24
        Strength $strength,
25
        TalentCollection $talentCollection,
26
        ?Weapon $weapon,
27
        private LevelProgress $levelProgress,
28
        private AttributePoints $attributePoints,
29
        private TalentPoints $talentPoints,
30
    ) {
31
        parent::__construct(
32
            $name,
33
            $health,
34
            $etherum,
35
            $strength,
36
            $talentCollection,
37
            $weapon,
38
        );
39
    }
40
41
    public function getLevelProgress(): LevelProgress
42
    {
43
        return $this->levelProgress;
44
    }
45
46
    public function increaseExperience(Experience $experience): void
47
    {
48
        $this->levelProgress->increase($experience, $this);
49
    }
50
51
    public function getAttributePoints(): AttributePoints
52
    {
53
        return $this->attributePoints;
54
    }
55
56
    public function getTalentPoints(): TalentPoints
57
    {
58
        return $this->talentPoints;
59
    }
60
}
61