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
HealthBelow 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 HealthBelow implements SkillRule
11{
12    public function __construct(
13        private int $percent,
14    ) {}
15
16    #[Override]
17    public function allows(Vitals $vitals): bool
18    {
19        $health = $vitals->health;
20
21        return ($health->current->value * 100) < ($health->maximum->value * $this->percent);
22    }
23}