diff --git a/src/core/execution/TradeShipExecution.ts b/src/core/execution/TradeShipExecution.ts index 2e7f63476..c6587ec2a 100644 --- a/src/core/execution/TradeShipExecution.ts +++ b/src/core/execution/TradeShipExecution.ts @@ -65,6 +65,14 @@ export class TradeShipExecution implements Execution { this.wasCaptured = true; } + // If a player captures an other player's port while trading we should delete + // the ship. + if (this._dstPort.owner().id() == this.srcPort.owner().id()) { + this.tradeShip.delete(false); + this.active = false; + return; + } + if ( !this.wasCaptured && (!this._dstPort.isActive() || diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 02341d4b9..c4c2b0cd0 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -539,7 +539,9 @@ export class PlayerImpl implements Player { } canTrade(other: Player): boolean { - return !other.hasEmbargoAgainst(this) && !this.hasEmbargoAgainst(other); + const embargo = + other.hasEmbargoAgainst(this) || this.hasEmbargoAgainst(other); + return !embargo && other.id() != this.id(); } addEmbargo(other: PlayerID): void {