Lines 100.00% 3 / 3
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
Hero 100.00% 3 / 3 100.00% 2 / 2 2 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 up 100.00% 2 / 2 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Lorekeeper\Core\Player\Hero;
6
7use Lorekeeper\Core\Game\Level\Experience;
8use Lorekeeper\Core\Player\Hero\Class\HeroClass;
9use Lorekeeper\Core\Player\Hero\Inventory\HeroInventory;
10use Lorekeeper\Core\Player\Player;
11use Lorekeeper\Core\Player\PlayerLevel;
12use Lorekeeper\Core\Player\PlayerName;
13use Lorekeeper\Core\Player\PlayerSpawnId;
14
15final class Hero extends Player
16{
17    /** @mago-expect lint:excessive-parameter-list */
18    public function __construct(
19        PlayerSpawnId $spawnId,
20        PlayerName $name,
21        PlayerLevel $level,
22        public readonly HeroAttributes $attributes,
23        public readonly HeroClass $class,
24        public readonly HeroProgression $progression,
25        public readonly HeroInventory $inventory,
26        public readonly HeroSettings $settings = new HeroSettings(),
27    ) {
28        parent::__construct($spawnId, $name, $level, $attributes->vitals);
29    }
30
31    public function up(Experience $toNext): void
32    {
33        $this->level = $this->level->up();
34        $this->progression->level->next($toNext);
35    }
36}