Lines 100.00% 4 / 4
Functions and Methods 100.00% 3 / 3
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
LevelAtLeast 100.00% 4 / 4 100.00% 3 / 3 3 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 describe 100.00% 1 / 1 100.00% 1 / 1 1
 holds 100.00% 2 / 2 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Lorekeeper\Bot\Steps\Checks;
6
7use Generator;
8use Lorekeeper\Bot\Steps\Check;
9use Lorekeeper\Bot\Steps\StepScript;
10use Lorekeeper\Core\Player\PlayerLevel;
11use Override;
12
13final readonly class LevelAtLeast implements Check
14{
15    public function __construct(
16        public PlayerLevel $level,
17    ) {}
18
19    #[Override]
20    public function describe(): string
21    {
22        return "Level {$this->level->value} or higher";
23    }
24
25    #[Override]
26    public function holds(StepScript $bot): Generator
27    {
28        yield from [];
29
30        return $bot->me()->hero()->level->value >= $this->level->value;
31    }
32}