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
ManaAbove 100.00% 3 / 3 100.00% 2 / 2 2 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 allows 100.00% 2 / 2 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Lorekeeper\Bot\Abilities\Fight\Rule;
6
7use Lorekeeper\Core\Game\Attribute\Vitals;
8use Override;
9
10final readonly class ManaAbove implements SkillRule
11{
12    public function __construct(
13        private int $percent,
14    ) {}
15
16    #[Override]
17    public function allows(Vitals $vitals): bool
18    {
19        $mana = $vitals->mana;
20
21        return ($mana->current->value * 100) > ($mana->maximum->value * $this->percent);
22    }
23}