From fd1081d39215c9363fae2a98eaf8d4d24017e198 Mon Sep 17 00:00:00 2001 From: Restart2008 Date: Fri, 24 Oct 2025 21:35:05 -0700 Subject: [PATCH] NukeWars: enable transport ships within team zones but prevent crossing midpoint --- src/core/execution/TransportShipExecution.ts | 23 ++++++++++++++++++++ src/core/game/PlayerImpl.ts | 8 ++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/core/execution/TransportShipExecution.ts b/src/core/execution/TransportShipExecution.ts index 913abb817..efa3096b6 100644 --- a/src/core/execution/TransportShipExecution.ts +++ b/src/core/execution/TransportShipExecution.ts @@ -1,6 +1,8 @@ import { Execution, Game, + GameMapType, + GameMode, MessageType, Player, PlayerID, @@ -103,6 +105,27 @@ export class TransportShipExecution implements Execution { return; } + // In Nuke Wars on Baikal, prevent transport ships from crossing the midpoint + const gc = this.mg.config().gameConfig(); + if ( + gc.gameMode === GameMode.NukeWars && + gc.gameMap === GameMapType.Baikal + ) { + const mapWidth = this.mg.width(); + const wantLeft = this.attacker.smallID() % 2 === 1; + const dstX = this.mg.x(this.dst); + const dstLeft = dstX < Math.floor(mapWidth / 2); + if (wantLeft !== dstLeft) { + this.mg.displayMessage( + "Transport ships cannot cross the midpoint in Nuke Wars", + MessageType.ATTACK_FAILED, + this.attacker.id(), + ); + this.active = false; + return; + } + } + const closestTileSrc = this.attacker.canBuild( UnitType.TransportShip, this.dst, diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index e0de8a258..76e1b4ba0 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -930,17 +930,13 @@ export class PlayerImpl implements Player { return false; } - // Prevent crossing midpoint with ships/boats at any time in Nuke Wars. + // In Nuke Wars on Baikal, prevent ships from crossing the midpoint but allow them within team zones const gc = this.mg.config().gameConfig(); if ( gc.gameMode === GameMode.NukeWars && gc.gameMap === GameMapType.Baikal ) { - if ( - unitType === UnitType.TransportShip || - unitType === UnitType.Warship || - unitType === UnitType.TradeShip - ) { + if (unitType === UnitType.Warship || unitType === UnitType.TradeShip) { if (!this.isInTeamSpawnZone(targetTile)) return false; }