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