Lines
100.00%
1 / 1
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Resistance | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | 100.00% | 1 / 1 | |||
| effective | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Core\Game\Attribute\Stat\Resistance; | |
| 6 | ||
| 7 | use Lorekeeper\Core\Game\Attribute\Stat\Stat; | |
| 8 | use Lorekeeper\Core\Support\SignedRatio; | |
| 9 | ||
| 10 | abstract readonly class Resistance extends SignedRatio implements Stat | |
| 11 | { | |
| 12 | protected const float CAP = 0.8; | |
| 13 | ||
| 14 | public function effective(): float | |
| 15 | { | |
| 16 | return min($this->value, static::CAP); | |
| 17 | } | |
| 18 | } |