From 9921e678393d3dec5e133dd243229b3a9a5077b0 Mon Sep 17 00:00:00 2001 From: Restart2008 Date: Sat, 25 Oct 2025 11:25:44 -0700 Subject: [PATCH] Revert "fix: Implement NukeWars gamemode fixes" This reverts commit 3e5a1242e4e586688fe9f730783524cd030723ea. --- src/core/configuration/Config.ts | 1 - src/core/configuration/DefaultConfig.ts | 4 ++- src/core/game/Game.ts | 1 - src/core/game/GameImpl.ts | 12 +++++++++ src/core/game/PlayerImpl.ts | 33 +++++-------------------- 5 files changed, 21 insertions(+), 30 deletions(-) diff --git a/src/core/configuration/Config.ts b/src/core/configuration/Config.ts index 134e68967..965f7c9bb 100644 --- a/src/core/configuration/Config.ts +++ b/src/core/configuration/Config.ts @@ -89,7 +89,6 @@ export interface Config { donateTroops(): boolean; instantBuild(): boolean; numSpawnPhaseTurns(): number; - numPreparationPhaseTurns(): number; userSettings(): UserSettings; playerTeams(): TeamCountConfig; diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index efa79a2c9..1d2679cf6 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -622,6 +622,8 @@ export class DefaultConfig implements Config { numSpawnPhaseTurns(): number { return this._gameConfig.gameType === GameType.Singleplayer ? 100 : 300; } +<<<<<<< Updated upstream +======= numPreparationPhaseTurns(): number { if (this._gameConfig.gameMode === GameMode.NukeWars) { @@ -629,7 +631,7 @@ export class DefaultConfig implements Config { } return 0; } - +>>>>>>> Stashed changes numBots(): number { return this.bots(); } diff --git a/src/core/game/Game.ts b/src/core/game/Game.ts index 6c4c2f773..21aa78e91 100644 --- a/src/core/game/Game.ts +++ b/src/core/game/Game.ts @@ -151,7 +151,6 @@ export const isGameType = (value: unknown): value is GameType => export enum GameMode { FFA = "Free For All", Team = "Team", - NukeWars = "Nuke Wars" } export const isGameMode = (value: unknown): value is GameMode => isEnumValue(GameMode, value); diff --git a/src/core/game/GameImpl.ts b/src/core/game/GameImpl.ts index b49e7779e..2ab9e10de 100644 --- a/src/core/game/GameImpl.ts +++ b/src/core/game/GameImpl.ts @@ -96,7 +96,12 @@ export class GameImpl implements Game { this._width = _map.width(); this._height = _map.height(); this.unitGrid = new UnitGrid(this._map); +<<<<<<< Updated upstream + + if (_config.gameConfig().gameMode === GameMode.Team) { +======= if (this.isTeamBasedGame()) { +>>>>>>> Stashed changes this.populateTeams(); } this.addPlayers(); @@ -109,9 +114,12 @@ export class GameImpl implements Game { private populateTeams() { let numPlayerTeams = this._config.playerTeams(); +<<<<<<< Updated upstream +======= if (this._config.gameConfig().gameMode === GameMode.NukeWars) { numPlayerTeams = 2; } +>>>>>>> Stashed changes if (typeof numPlayerTeams !== "number") { const players = this._humans.length + this._nations.length; switch (numPlayerTeams) { @@ -330,11 +338,15 @@ export class GameImpl implements Game { return this._ticks <= this.config().numSpawnPhaseTurns(); } +<<<<<<< Updated upstream +======= inPreparationPhase(): boolean { const spawn = this.config().numSpawnPhaseTurns(); const prep = this.config().numPreparationPhaseTurns(); return this._ticks > spawn && this._ticks <= spawn + prep; } + +>>>>>>> Stashed changes ticks(): number { return this._ticks; } diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 0d4bf00dc..cd79bc850 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -950,22 +950,6 @@ export class PlayerImpl implements Player { ); } - private isInTeamSpawnZone(tile: TileRef): boolean { - const team = this.team(); - if (!team) return false; - - // Simple geometric split: - // Team 1 gets left half (x < width/2) - // Team 2 gets right half (x >= width/2) - const x = this.mg.x(tile); - const mapWidth = this.mg.width(); - const midpoint = Math.floor(mapWidth / 2); - - // Team 1 gets left half, Team 2 gets right half - const isTeam1 = team === this.mg.teams()[0]; - return isTeam1 ? x < midpoint : x >= midpoint; - } - private canBuildShipNukeWars( unitType: UnitType, targetTile: TileRef, @@ -990,17 +974,6 @@ export class PlayerImpl implements Player { } private canBuildNukeNukeWars(unitType: UnitType): boolean { - // Always block MIRVs in NukeWars - if (unitType === UnitType.MIRV) { - this.mg.displayMessage( - "MIRVs are not allowed in Nuke Wars mode", - MessageType.ATTACK_FAILED, - this.id(), - ); - return false; - } - - // Block nuclear weapons during preparation phase if ( (unitType === UnitType.AtomBomb || unitType === UnitType.HydrogenBomb) && this.mg.inPreparationPhase() @@ -1025,6 +998,8 @@ export class PlayerImpl implements Player { return false; } +<<<<<<< Updated upstream +======= if (this.isNukeWarsAndBaikal()) { if (!this.canBuildShipNukeWars(unitType, targetTile)) { return false; @@ -1042,6 +1017,7 @@ export class PlayerImpl implements Player { } } +>>>>>>> Stashed changes const cost = this.mg.unitInfo(unitType).cost(this); if (!this.isAlive() || this.gold() < cost) { return false; @@ -1055,9 +1031,12 @@ export class PlayerImpl implements Player { return this.nukeSpawn(targetTile); case UnitType.AtomBomb: case UnitType.HydrogenBomb: +<<<<<<< Updated upstream +======= if (this.isNukeWars() && !this.canBuildNukeNukeWars(unitType)) { return false; } +>>>>>>> Stashed changes return this.nukeSpawn(targetTile); case UnitType.MIRVWarhead: return targetTile;