From 02b74077d1fdca2759a6fd86cd5967ace07adddc Mon Sep 17 00:00:00 2001 From: Scott Anderson <662325+scottanderson@users.noreply.github.com> Date: Mon, 14 Apr 2025 21:00:23 -0400 Subject: [PATCH] TransportShipExecution --- src/core/execution/TransportShipExecution.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/core/execution/TransportShipExecution.ts b/src/core/execution/TransportShipExecution.ts index 18ca01e75..b160229a0 100644 --- a/src/core/execution/TransportShipExecution.ts +++ b/src/core/execution/TransportShipExecution.ts @@ -55,7 +55,7 @@ export class TransportShipExecution implements Execution { this.active = false; return; } - if (this.targetID != null && !mg.hasPlayer(this.targetID)) { + if (this.targetID !== null && !mg.hasPlayer(this.targetID)) { console.warn(`TransportShipExecution: target ${this.targetID} not found`); this.active = false; return; @@ -90,13 +90,16 @@ export class TransportShipExecution implements Execution { return; } - if (this.targetID == null || this.targetID == this.mg.terraNullius().id()) { + if ( + this.targetID === null || + this.targetID === this.mg.terraNullius().id() + ) { this.target = mg.terraNullius(); } else { this.target = mg.player(this.targetID); } - if (this.troops == null) { + if (this.troops === null) { this.troops = this.mg .config() .boatAttackAmount(this.attacker, this.target); @@ -105,7 +108,7 @@ export class TransportShipExecution implements Execution { this.troops = Math.min(this.troops, this.attacker.troops()); this.dst = targetTransportTile(this.mg, this.ref); - if (this.dst == null) { + if (this.dst === null) { consolex.warn( `${this.attacker} cannot send ship to ${this.target}, cannot find attack tile`, ); @@ -113,7 +116,7 @@ export class TransportShipExecution implements Execution { return; } const src = this.attacker.canBuild(UnitType.TransportShip, this.dst); - if (src == false) { + if (src === false) { consolex.warn(`can't build transport ship`); this.active = false; return; @@ -129,7 +132,7 @@ export class TransportShipExecution implements Execution { } tick(ticks: number) { - if (this.dst == null) { + if (this.dst === null) { this.active = false; return; } @@ -148,7 +151,7 @@ export class TransportShipExecution implements Execution { const result = this.pathFinder.nextTile(this.boat.tile(), this.dst); switch (result.type) { case PathFindResultType.Completed: - if (this.mg.owner(this.dst) == this.attacker) { + if (this.mg.owner(this.dst) === this.attacker) { this.attacker.addTroops(this.troops); this.boat.delete(false); this.active = false;