From 4d5bb7a8359cc0a0a558254547f3d4588f6d4bf3 Mon Sep 17 00:00:00 2001 From: FloPinguin <25036848+FloPinguin@users.noreply.github.com> Date: Fri, 19 Dec 2025 01:20:23 +0100 Subject: [PATCH] =?UTF-8?q?Cleanup=20nations=20(Part=201)=20=F0=9F=A7=B9?= =?UTF-8?q?=20(#2637)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description: 1. Using the wording `"Nation"`, `"FakeHuman"` and `"NPC"` at the same time is confusing. So I renamed every mention of `"FakeHuman"` and `"NPC"` in the entire project to `"Nation"`. Just like they are called ingame. 2. `BotBehavior.ts` was originally intended for sharing the logic between nations and bots. But at the moment, the logic there isn't really shared and it's basically just about attacking. So I renamed `BotBehavior.ts` to `AiAttackBehavior.ts`. I use "Ai" to indicate that this file is used by bots AND nations. 3. Moved `execuction/utils/AllianceBehavior.ts` to `execuction/nation/NationAllianceBehavior.ts` to make sure everybody understands that this file is not about alliances in general. It's just about nations and how they handle alliances. 4. Removed `difficultyModifier` from `DefaultConfig`. It's unused and I think we usually want to finetune the difficulty instead of using that method. 5. Added `assertNever` in all `switch (difficulty)` default cases. ## Please complete the following: - [X] I have added screenshots for all UI updates - [X] I process any text displayed to the user through translateText() and I've added it to the en.json file - [X] I have added relevant tests to the test directory - [X] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: FloPinguin --- src/client/HostLobbyModal.ts | 26 +- src/client/SinglePlayerModal.ts | 22 +- .../graphics/layers/PlayerInfoOverlay.ts | 8 +- src/client/graphics/layers/PlayerPanel.ts | 4 +- src/core/GameRunner.ts | 10 +- src/core/Schemas.ts | 2 +- src/core/configuration/Config.ts | 4 +- src/core/configuration/DefaultConfig.ts | 33 +- src/core/execution/BotExecution.ts | 20 +- src/core/execution/EmojiExecution.ts | 2 +- src/core/execution/ExecutionManager.ts | 6 +- ...keHumanExecution.ts => NationExecution.ts} | 50 +-- .../NationAllianceBehavior.ts} | 28 +- .../{BotBehavior.ts => AiAttackBehavior.ts} | 10 +- src/core/game/Game.ts | 2 +- src/core/game/PlayerImpl.ts | 2 +- src/core/game/TeamAssignment.ts | 4 +- src/server/GameManager.ts | 2 +- src/server/GameServer.ts | 4 +- src/server/MapPlaylist.ts | 2 +- ...avior.test.ts => AiAttackBehavior.test.ts} | 16 +- tests/AllianceBehaviour.test.ts | 16 +- tests/AllianceExtensionExecution.test.ts | 3 +- tests/AllianceRequestExecution.test.ts | 2 +- ...keHumanMIRV.test.ts => NationMIRV.test.ts} | 288 +++++++++--------- tests/util/Setup.ts | 2 +- 26 files changed, 290 insertions(+), 278 deletions(-) rename src/core/execution/{FakeHumanExecution.ts => NationExecution.ts} (95%) rename src/core/execution/{utils/AllianceBehavior.ts => nation/NationAllianceBehavior.ts} (93%) rename src/core/execution/utils/{BotBehavior.ts => AiAttackBehavior.ts} (98%) rename tests/{BotBehavior.test.ts => AiAttackBehavior.test.ts} (91%) rename tests/{FakeHumanMIRV.test.ts => NationMIRV.test.ts} (67%) diff --git a/src/client/HostLobbyModal.ts b/src/client/HostLobbyModal.ts index 8948b64dc..87e24ef37 100644 --- a/src/client/HostLobbyModal.ts +++ b/src/client/HostLobbyModal.ts @@ -38,7 +38,7 @@ export class HostLobbyModal extends LitElement { }; @state() private selectedMap: GameMapType = GameMapType.World; @state() private selectedDifficulty: Difficulty = Difficulty.Medium; - @state() private disableNPCs = false; + @state() private disableNations = false; @state() private gameMode: GameMode = GameMode.FFA; @state() private teamCount: TeamCountConfig = 2; @state() private bots: number = 400; @@ -358,17 +358,17 @@ export class HostLobbyModal extends LitElement { ) ? html`