From dca9c8152bf351497d9c465050e56f79c8307076 Mon Sep 17 00:00:00 2001 From: Restart2008 Date: Sat, 25 Oct 2025 15:55:16 -0700 Subject: [PATCH] fix(nukewars): Refine bot behavior and fix prep timer visibility This commit addresses further issues and clarifications for the Nuke Wars game mode. Key fixes include: - Bot Behavior in Nuke Wars: Modified `FakeHumanExecution.ts` to ensure bots in Nuke Wars can target and launch nuclear weapons against other bots, treating Nuke Wars consistently as a 2-team game. This resolves the previous ambiguity regarding bot interactions in this game mode. - Preparation Timer Visibility: Fixed the "NukeWarsPrepTimer not found" console error by ensuring the `NukeWarsPrepTimer` custom element is correctly imported and defined in `src/client/Main.ts` before it is queried by `GameRenderer.ts`. This should make the preparation timer visible at the top of the screen. --- src/client/Main.ts | 3 ++- src/core/execution/FakeHumanExecution.ts | 4 +++- static/index.html | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/client/Main.ts b/src/client/Main.ts index c7cf0f270..dc7462d34 100644 --- a/src/client/Main.ts +++ b/src/client/Main.ts @@ -42,8 +42,9 @@ import "./components/NewsButton"; import { NewsButton } from "./components/NewsButton"; import "./components/baseComponents/Button"; import "./components/baseComponents/Modal"; +import "./graphics/layers/NukeWarsPrepTimer"; +import "./graphics/layers/PlayerInfoOverlay"; import { getUserMe, isLoggedIn } from "./jwt"; -import "./styles.css"; declare global { interface Window { diff --git a/src/core/execution/FakeHumanExecution.ts b/src/core/execution/FakeHumanExecution.ts index 3b8a7e94d..72c23a6c9 100644 --- a/src/core/execution/FakeHumanExecution.ts +++ b/src/core/execution/FakeHumanExecution.ts @@ -2,6 +2,7 @@ import { Cell, Execution, Game, + GameMode, Gold, Nation, Player, @@ -262,7 +263,8 @@ export class FakeHumanExecution implements Execution { if ( silos.length === 0 || this.player.gold() < this.cost(UnitType.AtomBomb) || - other.type() === PlayerType.Bot || + (this.mg.config().gameConfig().gameMode !== GameMode.NukeWars && + other.type() === PlayerType.Bot) || this.player.isOnSameTeam(other) ) { return; diff --git a/static/index.html b/static/index.html index 52b055fae..6771389b2 100644 --- a/static/index.html +++ b/static/index.html @@ -133,7 +133,7 @@ gtag("config", "G-WQGQQ8RDN4"); - +