Lines
100.00%
9 / 9
Functions and Methods
100.00%
2 / 2
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Stats | 100.00% | 9 / 9 | 100.00% | 2 / 2 | 10 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| update | 100.00% | 8 / 8 | 100.00% | 1 / 1 | 9 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Core\Game\Attribute\Stat; | |
| 6 | ||
| 7 | use Lorekeeper\Core\Game\Attribute\Stat\Boost\Boost; | |
| 8 | use Lorekeeper\Core\Game\Attribute\Stat\Boost\Boosts; | |
| 9 | use Lorekeeper\Core\Game\Attribute\Stat\Chance\Chance; | |
| 10 | use Lorekeeper\Core\Game\Attribute\Stat\Chance\Chances; | |
| 11 | use Lorekeeper\Core\Game\Attribute\Stat\Power\Power; | |
| 12 | use Lorekeeper\Core\Game\Attribute\Stat\Power\Powers; | |
| 13 | use Lorekeeper\Core\Game\Attribute\Stat\Primary\PrimaryAttribute; | |
| 14 | use Lorekeeper\Core\Game\Attribute\Stat\Primary\PrimaryAttributes; | |
| 15 | use Lorekeeper\Core\Game\Attribute\Stat\Resistance\Resistance; | |
| 16 | use Lorekeeper\Core\Game\Attribute\Stat\Resistance\Resistances; | |
| 17 | ||
| 18 | final class Stats | |
| 19 | { | |
| 20 | /** @mago-expect lint:excessive-parameter-list */ | |
| 21 | public function __construct( | |
| 22 | public private(set) PrimaryAttributes $primary = new PrimaryAttributes(), | |
| 23 | public private(set) Powers $powers = new Powers(), | |
| 24 | public private(set) Chances $chances = new Chances(), | |
| 25 | public private(set) Haste $haste = new Haste(0.0), | |
| 26 | public private(set) CriticalMultiplier $criticalMultiplier = new CriticalMultiplier(1.5), | |
| 27 | public private(set) Resistances $resistances = new Resistances(), | |
| 28 | public private(set) Boosts $boosts = new Boosts(), | |
| 29 | public private(set) HealingIntake $healingIntake = new HealingIntake(1.0), | |
| 30 | ) {} | |
| 31 | ||
| 32 | /** | |
| 33 | * @mago-expect analysis:match-not-exhaustive | |
| 34 | * @mago-expect lint:halstead | |
| 35 | */ | |
| 36 | public function update(Stat $stat): void | |
| 37 | { | |
| 38 | match (true) { | |
| 39 | $stat instanceof PrimaryAttribute => $this->primary->update($stat), | |
| 40 | $stat instanceof Power => $this->powers->update($stat), | |
| 41 | $stat instanceof Chance => $this->chances->update($stat), | |
| 42 | $stat instanceof Resistance => $this->resistances->update($stat), | |
| 43 | $stat instanceof Boost => $this->boosts->update($stat), | |
| 44 | $stat instanceof Haste => $this->haste = $stat, | |
| 45 | $stat instanceof CriticalMultiplier => $this->criticalMultiplier = $stat, | |
| 46 | $stat instanceof HealingIntake => $this->healingIntake = $stat, | |
| 47 | }; | |
| 48 | } | |
| 49 | } |