From 62962eac59c0781afcda0cbf0c70c1dcea6bdc00 Mon Sep 17 00:00:00 2001 From: Restart2008 Date: Fri, 24 Oct 2025 21:54:42 -0700 Subject: [PATCH] NukeWars: fix transport ship restrictions and structure building during preparation phase --- src/core/game/PlayerImpl.ts | 20 ++++++++++++++++++-- src/core/game/TransportShipUtils.ts | 13 +------------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 13d884c32..2a0c050e9 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -937,12 +937,28 @@ export class PlayerImpl implements Player { gc.gameMap === GameMapType.Baikal ) { // Ships must stay on their team's side - if (unitType === UnitType.Warship || unitType === UnitType.TradeShip) { - if (!this.isInTeamSpawnZone(targetTile)) return false; + if ( + unitType === UnitType.Warship || + unitType === UnitType.TradeShip || + unitType === UnitType.TransportShip + ) { + if (!this.isInTeamSpawnZone(targetTile)) { + this.mg.displayMessage( + "Ships cannot cross the midpoint in Nuke Wars", + MessageType.ATTACK_FAILED, + this.id(), + ); + return false; + } } // During preparation phase, only build in own territory if (this.mg.inPreparationPhase() && !this.isInTeamSpawnZone(targetTile)) { + this.mg.displayMessage( + "During preparation phase, you can only build in your own territory", + MessageType.ATTACK_FAILED, + this.id(), + ); return false; } } diff --git a/src/core/game/TransportShipUtils.ts b/src/core/game/TransportShipUtils.ts index f0bc25b8e..b93be3333 100644 --- a/src/core/game/TransportShipUtils.ts +++ b/src/core/game/TransportShipUtils.ts @@ -49,18 +49,7 @@ export function canBuildTransportShip( } if (myPlayerBordersOcean && otherPlayerBordersOcean) { - // In Nuke Wars on Baikal, ensure transport source/destination are on same half. - const gc = game.config().gameConfig(); - if ( - gc.gameMode === GameMode.NukeWars && - gc.gameMap === GameMapType.Baikal - ) { - const mapWidth = game.width(); - const wantLeft = player.smallID() % 2 === 1; - const dstX = game.x(dst); - const dstLeft = dstX < Math.floor(mapWidth / 2); - if (wantLeft !== dstLeft) return false; - } + // Note: Nuke Wars midpoint restrictions are now handled in PlayerImpl.canBuild return transportShipSpawn(game, player, dst); } else { return false;