Lines
100.00%
3 / 3
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| allows | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | ||
| 10 | final 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 | } |