smrealms /
smr
We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | class DummyPlayer extends AbstractSmrPlayer { |
||
| 4 | |||
| 5 | protected readonly int $accountID; |
||
| 6 | protected readonly int $gameID; |
||
| 7 | |||
| 8 | public function __construct(string $playerName, int $experience = 1000, int $shipTypeID = 60) { |
||
| 9 | $this->accountID = 0; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 10 | $this->gameID = 0; |
||
|
0 ignored issues
–
show
|
|||
| 11 | $this->playerName = $playerName; |
||
| 12 | $this->experience = $experience; |
||
| 13 | $this->shipID = $shipTypeID; |
||
| 14 | $this->dead = false; |
||
| 15 | $this->setConstantProperties(); |
||
| 16 | } |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Sets properties that are needed for combat, but do not need to |
||
| 20 | * be stored in the database. |
||
| 21 | */ |
||
| 22 | protected function setConstantProperties(): void { |
||
| 23 | $this->playerID = 0; |
||
| 24 | $this->turns = 0; |
||
| 25 | $this->alignment = 0; |
||
| 26 | $this->underAttack = false; |
||
| 27 | $this->npc = true; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function __sleep() { |
||
| 31 | return ['playerName', 'experience', 'shipID', 'dead', 'accountID', 'gameID']; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function __wakeup() { |
||
| 35 | $this->setConstantProperties(); |
||
| 36 | } |
||
| 37 | |||
| 38 | public function increaseHOF(float $amount, array $typeList, string $visibility): void {} |
||
| 39 | |||
| 40 | public function killPlayerByPlayer(AbstractSmrPlayer $killer): array { |
||
| 41 | $this->dead = true; |
||
| 42 | return ['DeadExp' => 0, 'KillerCredits' => 0, 'KillerExp' => 0]; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function getShip(bool $forceUpdate = false): DummyShip { |
||
| 46 | return DummyShip::getCachedDummyShip($this->playerName); |
||
| 47 | } |
||
| 48 | |||
| 49 | } |
||
| 50 |