This commit is contained in:
evanpelle
2025-12-17 08:38:10 -08:00
parent 58c7cdd46f
commit 03778a722d
126 changed files with 6514 additions and 1010 deletions
+1 -1
View File
@@ -4,9 +4,9 @@ import {
Game,
Player,
PlayerInfo,
PlayerType,
Tick,
} from "../src/core/game/Game";
import { PlayerType } from "../src/core/game/GameUpdates";
import { PseudoRandom } from "../src/core/PseudoRandom";
import { setup } from "./util/Setup";
+2 -1
View File
@@ -1,7 +1,8 @@
import { AllianceRequestExecution } from "../src/core/execution/alliance/AllianceRequestExecution";
import { AllianceRequestReplyExecution } from "../src/core/execution/alliance/AllianceRequestReplyExecution";
import { DonateGoldExecution } from "../src/core/execution/DonateGoldExecution";
import { Game, Player, PlayerType } from "../src/core/game/Game";
import { Game, Player } from "../src/core/game/Game";
import { PlayerType } from "../src/core/game/GameUpdates";
import { playerInfo, setup } from "./util/Setup";
let game: Game;
+2 -1
View File
@@ -1,7 +1,8 @@
import { AllianceExtensionExecution } from "../src/core/execution/alliance/AllianceExtensionExecution";
import { AllianceRequestExecution } from "../src/core/execution/alliance/AllianceRequestExecution";
import { AllianceRequestReplyExecution } from "../src/core/execution/alliance/AllianceRequestReplyExecution";
import { Game, MessageType, Player, PlayerType } from "../src/core/game/Game";
import { Game, Player } from "../src/core/game/Game";
import { MessageType, PlayerType } from "../src/core/game/GameUpdates";
import { playerInfo, setup } from "./util/Setup";
let game: Game;
+2 -1
View File
@@ -1,7 +1,8 @@
import { AllianceRequestExecution } from "../src/core/execution/alliance/AllianceRequestExecution";
import { AllianceRequestReplyExecution } from "../src/core/execution/alliance/AllianceRequestReplyExecution";
import { NukeExecution } from "../src/core/execution/NukeExecution";
import { Game, Player, PlayerType, UnitType } from "../src/core/game/Game";
import { Game, Player } from "../src/core/game/Game";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { playerInfo, setup } from "./util/Setup";
import { constructionExecution } from "./util/utils";
+2 -7
View File
@@ -1,14 +1,9 @@
import { AttackExecution } from "../src/core/execution/AttackExecution";
import { SpawnExecution } from "../src/core/execution/SpawnExecution";
import { TransportShipExecution } from "../src/core/execution/TransportShipExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../src/core/game/Game";
import { TileRef } from "../src/core/game/GameMap";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { setup } from "./util/Setup";
import { TestConfig } from "./util/TestConfig";
import { constructionExecution } from "./util/utils";
+2 -1
View File
@@ -1,6 +1,7 @@
import { AttackExecution } from "../src/core/execution/AttackExecution";
import { SpawnExecution } from "../src/core/execution/SpawnExecution";
import { Game, Player, PlayerInfo, PlayerType } from "../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../src/core/game/Game";
import { PlayerType } from "../src/core/game/GameUpdates";
import { GOLD_INDEX_WAR, GOLD_INDEX_WORK } from "../src/core/StatsSchemas";
import { setup } from "./util/Setup";
+2 -1
View File
@@ -1,5 +1,6 @@
import { BotBehavior } from "../src/core/execution/utils/BotBehavior";
import { Game, Player, PlayerInfo, PlayerType } from "../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../src/core/game/Game";
import { PlayerType } from "../src/core/game/GameUpdates";
import { PseudoRandom } from "../src/core/PseudoRandom";
import { setup } from "./util/Setup";
+2 -8
View File
@@ -1,14 +1,8 @@
import { DeleteUnitExecution } from "../src/core/execution/DeleteUnitExecution";
import { SpawnExecution } from "../src/core/execution/SpawnExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
Unit,
UnitType,
} from "../src/core/game/Game";
import { Game, Player, PlayerInfo, Unit } from "../src/core/game/Game";
import { TileRef } from "../src/core/game/GameMap";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { setup } from "./util/Setup";
import { executeTicks } from "./util/utils";
+4 -10
View File
@@ -3,14 +3,8 @@ import { MarkDisconnectedExecution } from "../src/core/execution/MarkDisconnecte
import { SpawnExecution } from "../src/core/execution/SpawnExecution";
import { TransportShipExecution } from "../src/core/execution/TransportShipExecution";
import { WarshipExecution } from "../src/core/execution/WarshipExecution";
import {
Game,
GameMode,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../src/core/game/Game";
import { Game, GameMode, Player, PlayerInfo } from "../src/core/game/Game";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { toInt } from "../src/core/Util";
import { setup } from "./util/Setup";
import { UseRealAttackLogic } from "./util/TestConfig";
@@ -72,7 +66,7 @@ describe("Disconnected", () => {
test("should include disconnected state in player update", () => {
player1.markDisconnected(true);
const update = player1.toUpdate();
expect(update.isDisconnected).toBe(true);
expect(update.player!.isDisconnected).toBe(true);
});
});
@@ -146,7 +140,7 @@ describe("Disconnected", () => {
player1.markDisconnected(true);
executeTicks(game, 3);
const update = player1.toUpdate();
expect(update.isDisconnected).toBe(true);
expect(update.player!.isDisconnected).toBe(true);
});
});
+2 -1
View File
@@ -1,7 +1,8 @@
import { DonateGoldExecution } from "../src/core/execution/DonateGoldExecution";
import { DonateTroopsExecution } from "../src/core/execution/DonateTroopExecution";
import { SpawnExecution } from "../src/core/execution/SpawnExecution";
import { PlayerInfo, PlayerType } from "../src/core/game/Game";
import { PlayerInfo } from "../src/core/game/Game";
import { PlayerType } from "../src/core/game/GameUpdates";
import { setup } from "./util/Setup";
describe("Donate troops to an ally", () => {
+2 -8
View File
@@ -1,13 +1,7 @@
import { FakeHumanExecution } from "../src/core/execution/FakeHumanExecution";
import { MirvExecution } from "../src/core/execution/MIRVExecution";
import {
Cell,
GameMode,
Nation,
PlayerInfo,
PlayerType,
UnitType,
} from "../src/core/game/Game";
import { Cell, GameMode, Nation, PlayerInfo } from "../src/core/game/Game";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { setup } from "./util/Setup";
import { executeTicks } from "./util/utils";
+1 -1
View File
@@ -1,5 +1,5 @@
import { getMessageTypeClasses, severityColors } from "../src/client/Utils";
import { MessageType } from "../src/core/game/Game";
import { MessageType } from "../src/core/game/GameUpdates";
describe("getMessageTypeClasses", () => {
// Spy on console.warn to track when the default case is hit
+2 -7
View File
@@ -1,14 +1,9 @@
import { NukeExecution } from "../src/core/execution/NukeExecution";
import { SpawnExecution } from "../src/core/execution/SpawnExecution";
import { UpgradeStructureExecution } from "../src/core/execution/UpgradeStructureExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../src/core/game/Game";
import { TileRef } from "../src/core/game/GameMap";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { setup } from "./util/Setup";
import { constructionExecution, executeTicks } from "./util/utils";
+2 -7
View File
@@ -1,10 +1,5 @@
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../src/core/game/Game";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { setup } from "./util/Setup";
let game: Game;
+2 -1
View File
@@ -1,4 +1,5 @@
import { PlayerInfo, PlayerType } from "../src/core/game/Game";
import { PlayerInfo } from "../src/core/game/Game";
import { PlayerType } from "../src/core/game/GameUpdates";
describe("PlayerInfo", () => {
describe("clan", () => {
+2 -7
View File
@@ -1,11 +1,6 @@
import { PortExecution } from "../src/core/execution/PortExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../src/core/game/Game";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { setup } from "./util/Setup";
let game: Game;
+2 -7
View File
@@ -1,13 +1,8 @@
import { DefensePostExecution } from "../src/core/execution/DefensePostExecution";
import { ShellExecution } from "../src/core/execution/ShellExecution";
import { WarshipExecution } from "../src/core/execution/WarshipExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../src/core/game/Game";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { setup } from "./util/Setup";
const coastX = 7;
+2 -7
View File
@@ -1,10 +1,5 @@
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../src/core/game/Game";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { Stats } from "../src/core/game/Stats";
import { StatsImpl } from "../src/core/game/StatsImpl";
import { replacer } from "../src/core/Util";
+2 -6
View File
@@ -1,9 +1,5 @@
import {
ColoredTeams,
Game,
GameMode,
PlayerType,
} from "../src/core/game/Game";
import { ColoredTeams, Game, GameMode } from "../src/core/game/Game";
import { PlayerType } from "../src/core/game/GameUpdates";
import { playerInfo, setup } from "./util/Setup";
let game: Game;
+2 -1
View File
@@ -1,4 +1,5 @@
import { ColoredTeams, PlayerInfo, PlayerType } from "../src/core/game/Game";
import { ColoredTeams, PlayerInfo } from "../src/core/game/Game";
import { PlayerType } from "../src/core/game/GameUpdates";
import { assignTeams } from "../src/core/game/TeamAssignment";
const teams = [ColoredTeams.Red, ColoredTeams.Blue];
+2 -1
View File
@@ -1,5 +1,6 @@
import { SpawnExecution } from "../src/core/execution/SpawnExecution";
import { Player, PlayerInfo, PlayerType } from "../src/core/game/Game";
import { Player, PlayerInfo } from "../src/core/game/Game";
import { PlayerType } from "../src/core/game/GameUpdates";
import { setup } from "./util/Setup";
describe("Territory management", () => {
+2 -1
View File
@@ -1,4 +1,5 @@
import { PlayerInfo, PlayerType, UnitType } from "../src/core/game/Game";
import { PlayerInfo } from "../src/core/game/Game";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { UnitGrid } from "../src/core/game/UnitGrid";
import { setup } from "./util/Setup";
+2 -7
View File
@@ -1,12 +1,7 @@
import { MoveWarshipExecution } from "../src/core/execution/MoveWarshipExecution";
import { WarshipExecution } from "../src/core/execution/WarshipExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../src/core/game/Game";
import { PlayerType, UnitType } from "../src/core/game/GameUpdates";
import { setup } from "./util/Setup";
import { executeTicks } from "./util/utils";
@@ -9,8 +9,8 @@ import {
rootMenuElement,
Slot,
} from "../../../src/client/graphics/layers/RadialMenuElements";
import { UnitType } from "../../../src/core/game/Game";
import { TileRef } from "../../../src/core/game/GameMap";
import { UnitType } from "../../../src/core/game/GameUpdates";
import { GameView, PlayerView } from "../../../src/core/game/GameView";
jest.mock("../../../src/client/Utils", () => ({
+1 -1
View File
@@ -51,7 +51,7 @@ describe("UILayer", () => {
};
const event = { isSelected: true, unit };
ui.drawSelectionBox = jest.fn();
ui["onUnitSelection"](event as UnitSelectionEvent);
ui["onUnitSelection"](event as unknown as UnitSelectionEvent);
expect(ui.drawSelectionBox).toHaveBeenCalledWith(unit);
});
@@ -1,5 +1,6 @@
import { PlayerSpawner } from "../../../../src/core/execution/utils/PlayerSpawner";
import { PlayerInfo, PlayerType } from "../../../../src/core/game/Game";
import { PlayerInfo } from "../../../../src/core/game/Game";
import { PlayerType } from "../../../../src/core/game/GameUpdates";
import { setup } from "../../../util/Setup";
describe("PlayerSpawner", () => {
+2 -7
View File
@@ -1,11 +1,6 @@
import { NukeExecution } from "../../../src/core/execution/NukeExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../../../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../../../src/core/game/Game";
import { PlayerType, UnitType } from "../../../src/core/game/GameUpdates";
import { setup } from "../../util/Setup";
import { TestConfig } from "../../util/TestConfig";
import { executeTicks } from "../../util/utils";
@@ -1,11 +1,6 @@
import { PlayerExecution } from "../../../src/core/execution/PlayerExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../../../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../../../src/core/game/Game";
import { PlayerType, UnitType } from "../../../src/core/game/GameUpdates";
import { setup } from "../../util/Setup";
import { executeTicks } from "../../util/utils";
@@ -2,13 +2,8 @@ import { NukeExecution } from "../../../src/core/execution/NukeExecution";
import { SAMLauncherExecution } from "../../../src/core/execution/SAMLauncherExecution";
import { SpawnExecution } from "../../../src/core/execution/SpawnExecution";
import { UpgradeStructureExecution } from "../../../src/core/execution/UpgradeStructureExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../../../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../../../src/core/game/Game";
import { PlayerType, UnitType } from "../../../src/core/game/GameUpdates";
import { setup } from "../../util/Setup";
import { constructionExecution, executeTicks } from "../../util/utils";
+2 -6
View File
@@ -3,13 +3,9 @@ import { SpawnExecution } from "../../../src/core/execution/SpawnExecution";
//import { TransportShipExecution } from "../../../src/core/execution/TransportShipExecution";
import { AllianceRequestExecution } from "../../../src/core/execution/alliance/AllianceRequestExecution";
import { AllianceRequestReplyExecution } from "../../../src/core/execution/alliance/AllianceRequestReplyExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
} from "../../../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../../../src/core/game/Game";
import { TileRef } from "../../../src/core/game/GameMap";
import { PlayerType } from "../../../src/core/game/GameUpdates";
import { setup } from "../../util/Setup";
let game: Game;
+2 -1
View File
@@ -1,5 +1,6 @@
import { TrainExecution } from "../../../src/core/execution/TrainExecution";
import { Game, Player, Unit, UnitType } from "../../../src/core/game/Game";
import { Game, Player, Unit } from "../../../src/core/game/Game";
import { UnitType } from "../../../src/core/game/GameUpdates";
import { Cluster, TrainStation } from "../../../src/core/game/TrainStation";
jest.mock("../../../src/core/game/Game");
+2 -7
View File
@@ -1,13 +1,8 @@
import { ConstructionExecution } from "../../src/core/execution/ConstructionExecution";
import { NukeExecution } from "../../src/core/execution/NukeExecution";
import { SpawnExecution } from "../../src/core/execution/SpawnExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../../src/core/game/Game";
import { PlayerType, UnitType } from "../../src/core/game/GameUpdates";
import { setup } from "../util/Setup";
describe("Construction economy", () => {
+2 -7
View File
@@ -1,12 +1,7 @@
import { ConstructionExecution } from "../../src/core/execution/ConstructionExecution";
import { SpawnExecution } from "../../src/core/execution/SpawnExecution";
import {
Game,
Player,
PlayerInfo,
PlayerType,
UnitType,
} from "../../src/core/game/Game";
import { Game, Player, PlayerInfo } from "../../src/core/game/Game";
import { PlayerType, UnitType } from "../../src/core/game/GameUpdates";
import { setup } from "../util/Setup";
describe("Hydrogen Bomb and MIRV flows", () => {
+1 -1
View File
@@ -8,9 +8,9 @@ import {
GameMode,
GameType,
PlayerInfo,
PlayerType,
} from "../../src/core/game/Game";
import { createGame } from "../../src/core/game/GameImpl";
import { PlayerType } from "../../src/core/game/GameUpdates";
import {
genTerrainFromBin,
MapManifest,
+2 -7
View File
@@ -1,13 +1,8 @@
import { NukeMagnitude } from "../../src/core/configuration/Config";
import { DefaultConfig } from "../../src/core/configuration/DefaultConfig";
import {
Game,
Player,
TerraNullius,
Tick,
UnitType,
} from "../../src/core/game/Game";
import { Game, Player, TerraNullius, Tick } from "../../src/core/game/Game";
import { TileRef } from "../../src/core/game/GameMap";
import { UnitType } from "../../src/core/game/GameUpdates";
export class TestConfig extends DefaultConfig {
private _proximityBonusPortsNb: number = 0;
+2 -1
View File
@@ -4,7 +4,8 @@
// If you also need execution use function below. Does not work with things not
import { ConstructionExecution } from "../../src/core/execution/ConstructionExecution";
import { Game, Player, UnitType } from "../../src/core/game/Game";
import { Game, Player } from "../../src/core/game/Game";
import { UnitType } from "../../src/core/game/GameUpdates";
// built via UI (e.g.: trade ships)
export function constructionExecution(