NukeWars: only block MIRV; prevent ships crossing midpoint; bias spawn selection toward midpoint for balance

This commit is contained in:
Restart2008
2025-10-24 20:08:58 -07:00
parent 0e90699c10
commit 4d528548c7
5 changed files with 82 additions and 31 deletions
+15 -11
View File
@@ -930,19 +930,23 @@ export class PlayerImpl implements Player {
return false;
}
// Check spawn zone restrictions in Nuke Wars mode
if (this.mg.config().gameConfig().gameMode === GameMode.NukeWars) {
// During spawn phase, enforce strict spawn zones
if (this.mg.inSpawnPhase() && !this.isInTeamSpawnZone(targetTile)) {
return false;
// Prevent crossing midpoint with ships/boats at any time in Nuke Wars.
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 (!this.isInTeamSpawnZone(targetTile)) return false;
}
// After spawn phase, only allow missiles to cross the midpoint
if (!this.mg.inSpawnPhase() && !this.isInTeamSpawnZone(targetTile)) {
const allowedTypes = [UnitType.AtomBomb, UnitType.HydrogenBomb];
if (!allowedTypes.includes(unitType)) {
return false;
}
// During spawn phase we enforce that regular land spawns happen on-team.
if (this.mg.inSpawnPhase() && !this.isInTeamSpawnZone(targetTile)) {
return false;
}
}
+25 -1
View File
@@ -1,6 +1,6 @@
import { PathFindResultType } from "../pathfinding/AStar";
import { MiniAStar } from "../pathfinding/MiniAStar";
import { Game, Player, UnitType } from "./Game";
import { Game, GameMapType, GameMode, Player, UnitType } from "./Game";
import { andFN, GameMap, manhattanDistFN, TileRef } from "./GameMap";
export function canBuildTransportShip(
@@ -49,6 +49,18 @@ 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;
}
return transportShipSpawn(game, player, dst);
} else {
return false;
@@ -72,6 +84,18 @@ export function canBuildTransportShip(
for (const t of sorted) {
if (game.owner(t) === player) {
// Block cross-midpoint lake deployments in Nuke Wars on Baikal
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 tX = game.x(t);
const tLeft = tX < Math.floor(mapWidth / 2);
if (wantLeft !== tLeft) return false;
}
return transportShipSpawn(game, player, t);
}
}