Lines
100.00%
6 / 6
Functions and Methods
100.00%
2 / 2
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Boosts | 100.00% | 6 / 6 | 100.00% | 2 / 2 | 7 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| update | 100.00% | 5 / 5 | 100.00% | 1 / 1 | 6 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Core\Game\Attribute\Stat\Boost; | |
| 6 | ||
| 7 | final class Boosts | |
| 8 | { | |
| 9 | public function __construct( | |
| 10 | public private(set) DamageBoost $damage = new DamageBoost(0.0), | |
| 11 | public private(set) PhysicalBoost $physical = new PhysicalBoost(0.0), | |
| 12 | public private(set) MagicalBoost $magical = new MagicalBoost(0.0), | |
| 13 | public private(set) HealingBoost $healing = new HealingBoost(0.0), | |
| 14 | public private(set) DotBoost $dot = new DotBoost(0.0), | |
| 15 | ) {} | |
| 16 | ||
| 17 | /** @mago-expect analysis:match-not-exhaustive */ | |
| 18 | public function update(Boost $stat): void | |
| 19 | { | |
| 20 | match (true) { | |
| 21 | $stat instanceof DamageBoost => $this->damage = $stat, | |
| 22 | $stat instanceof PhysicalBoost => $this->physical = $stat, | |
| 23 | $stat instanceof MagicalBoost => $this->magical = $stat, | |
| 24 | $stat instanceof HealingBoost => $this->healing = $stat, | |
| 25 | $stat instanceof DotBoost => $this->dot = $stat, | |
| 26 | }; | |
| 27 | } | |
| 28 | } |