NukeWars: fix transport ship restrictions and structure building during preparation phase

This commit is contained in:
Restart2008
2025-10-24 21:54:42 -07:00
parent 8088a97227
commit 62962eac59
2 changed files with 19 additions and 14 deletions
+18 -2
View File
@@ -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;
}
}
+1 -12
View File
@@ -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;