Revert "fix: Implement NukeWars gamemode fixes"

This reverts commit 3e5a1242e4.
This commit is contained in:
Restart2008
2025-10-25 11:25:44 -07:00
parent 85731a32f7
commit 9921e67839
5 changed files with 21 additions and 30 deletions
-1
View File
@@ -89,7 +89,6 @@ export interface Config {
donateTroops(): boolean;
instantBuild(): boolean;
numSpawnPhaseTurns(): number;
numPreparationPhaseTurns(): number;
userSettings(): UserSettings;
playerTeams(): TeamCountConfig;
+3 -1
View File
@@ -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();
}
-1
View File
@@ -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);
+12
View File
@@ -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;
}
+6 -27
View File
@@ -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;