Total Complexity | 9 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 56.25% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | trait SpacecraftStateTrait |
||
9 | { |
||
10 | use SpacecraftTrait; |
||
11 | use SpacecraftSystemExistenceTrait; |
||
12 | |||
13 | 2 | public function isWarped(): bool |
|
14 | { |
||
15 | 2 | return $this->getThis()->getWarpDriveState(); |
|
16 | } |
||
17 | |||
18 | public function isUnderRepair(): bool |
||
19 | { |
||
20 | return $this->getThis()->getState() === SpacecraftStateEnum::REPAIR_ACTIVE |
||
21 | || $this->getThis()->getState() === SpacecraftStateEnum::REPAIR_PASSIVE; |
||
22 | } |
||
23 | |||
24 | public function getHealthPercentage(): float |
||
25 | { |
||
26 | $self = $this->getThis(); |
||
27 | return ($self->getHull() + $self->getShield()) |
||
28 | / ($self->getMaxHull() + $self->getMaxShield(true)) * 100; |
||
29 | } |
||
30 | |||
31 | 1 | public function isTractoring(): bool |
|
32 | { |
||
33 | 1 | return $this->getThis()->getTractoredShip() !== null; |
|
34 | } |
||
35 | |||
36 | 1 | public function isWarpPossible(): bool |
|
37 | { |
||
38 | 1 | return $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::WARPDRIVE) && $this->getSystem() === null; |
|
|
|||
39 | } |
||
40 | |||
41 | 1 | public function displayNbsActions(): bool |
|
45 | } |
||
46 | } |
||
47 |