Lines
100.00%
4 / 4
Functions and Methods
100.00%
2 / 2
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Haste | 100.00% | 4 / 4 | 100.00% | 2 / 2 | 2 | 100.00% | 1 / 1 | |||
| effective | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| describe | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Core\Game\Attribute\Stat; | |
| 6 | ||
| 7 | use Lorekeeper\Core\Support\Ratio; | |
| 8 | use Override; | |
| 9 | ||
| 10 | final readonly class Haste extends Ratio implements Stat | |
| 11 | { | |
| 12 | private const float CAP = 0.5; | |
| 13 | ||
| 14 | public function effective(): float | |
| 15 | { | |
| 16 | return min($this->value, self::CAP); | |
| 17 | } | |
| 18 | ||
| 19 | #[Override] | |
| 20 | public function describe(): StatDescription | |
| 21 | { | |
| 22 | return new StatDescription( | |
| 23 | 'Haste reduces the cooldown on all of your attacks and spells, including Auto Attack, by a certain percentage (hard capped at 50%).', | |
| 24 | ); | |
| 25 | } | |
| 26 | } |