diff --git a/.husky/pre-commit b/.husky/pre-commit index 99aa617f5..a282f31f5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -5,4 +5,4 @@ export PATH="/usr/local/bin:$HOME/.npm-global/bin:$HOME/.nvm/versions/node/$(node -v)/bin:$PATH" # Then run lint-staged if tests pass -cmd lint-staged +npx lint-staged diff --git a/package-lock.json b/package-lock.json index 89b41aa45..147fd2865 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "howler": "^2.2.4", "intl-messageformat": "^10.7.16", "ip-anonymize": "^0.1.0", - "jose": "^6.0.10", + "jose": "^6.1.0", "js-yaml": "^4.1.0", "nanoid": "^3.3.6", "obscenity": "^0.4.3", @@ -37,7 +37,7 @@ "uuid": "^11.1.0", "winston": "^3.17.0", "ws": "^8.18.0", - "zod": "^4.0.5" + "zod": "^4.1.12" }, "devDependencies": { "@babel/core": "^7.25.2", @@ -14935,9 +14935,9 @@ } }, "node_modules/jose": { - "version": "6.0.11", - "resolved": "https://registry.npmjs.org/jose/-/jose-6.0.11.tgz", - "integrity": "sha512-QxG7EaliDARm1O1S8BGakqncGT9s25bKL1WSf6/oa17Tkqwi8D2ZNglqCF+DsYF88/rV66Q/Q2mFAy697E1DUg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.0.tgz", + "integrity": "sha512-TTQJyoEoKcC1lscpVDCSsVgYzUDg/0Bt3WE//WiTPK6uOCQC2KZS4MpugbMWt/zyjkopgZoXhZuCi00gLudfUA==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/panva" @@ -20854,9 +20854,9 @@ } }, "node_modules/zod": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.0.5.tgz", - "integrity": "sha512-/5UuuRPStvHXu7RS+gmvRf4NXrNxpSllGwDnCBcJZtQsKrviYXm54yDGV2KYNLT5kq0lHGcl7lqWJLgSaG+tgA==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.1.12.tgz", + "integrity": "sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index 88f3e860f..07acb8945 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "howler": "^2.2.4", "intl-messageformat": "^10.7.16", "ip-anonymize": "^0.1.0", - "jose": "^6.0.10", + "jose": "^6.1.0", "js-yaml": "^4.1.0", "nanoid": "^3.3.6", "obscenity": "^0.4.3", @@ -132,7 +132,7 @@ "uuid": "^11.1.0", "winston": "^3.17.0", "ws": "^8.18.0", - "zod": "^4.0.5" + "zod": "^4.1.12" }, "type": "module" } diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 80814f48c..a0df484de 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -843,6 +843,8 @@ export class DefaultConfig implements Config { return maxTroops * 1.5; case Difficulty.Impossible: return maxTroops * 2; + default: + return maxTroops * 1; // Default to Medium difficulty behavior } } diff --git a/src/core/execution/SpawnExecution.ts b/src/core/execution/SpawnExecution.ts index 409eeea86..fbd77cafa 100644 --- a/src/core/execution/SpawnExecution.ts +++ b/src/core/execution/SpawnExecution.ts @@ -1,4 +1,12 @@ -import { Execution, Game, Player, PlayerInfo, PlayerType } from "../game/Game"; +import { + Execution, + Game, + GameMapType, + GameMode, + Player, + PlayerInfo, + PlayerType, +} from "../game/Game"; import { TileRef } from "../game/GameMap"; import { BotExecution } from "./BotExecution"; import { PlayerExecution } from "./PlayerExecution"; @@ -37,15 +45,12 @@ export class SpawnExecution implements Execution { player = this.mg.addPlayer(this.playerInfo); } -<<<<<<< Updated upstream -======= const spawnTile = this.isNukeWarsAndBaikal(player) ? this.findBestNukeWarsSpawn(player) : this.tile; ->>>>>>> Stashed changes player.tiles().forEach((t) => player.relinquish(t)); - getSpawnTiles(this.mg, this.tile).forEach((t) => { + getSpawnTiles(this.mg, spawnTile).forEach((t) => { player.conquer(t); }); @@ -66,7 +71,7 @@ export class SpawnExecution implements Execution { return true; } - private isNukeWarsAndBaikal(player: Player): boolean { + private isNukeWarsAndBaikal(player: Player): boolean { const gc = this.mg.config().gameConfig(); return ( gc.gameMode === GameMode.NukeWars && gc.gameMap === GameMapType.Baikal diff --git a/src/core/game/GameImpl.ts b/src/core/game/GameImpl.ts index e9243b1f2..3758e9e61 100644 --- a/src/core/game/GameImpl.ts +++ b/src/core/game/GameImpl.ts @@ -112,12 +112,9 @@ 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) { @@ -359,7 +356,10 @@ export class GameImpl implements Game { const inited: Execution[] = []; const unInited: Execution[] = []; this.unInitExecs.forEach((e) => { - if (!this.inSpawnPhase() || (e.activeDuringSpawnPhase && e.activeDuringSpawnPhase())) { + if ( + !this.inSpawnPhase() || + (e.activeDuringSpawnPhase && e.activeDuringSpawnPhase()) + ) { e.init(this, this._ticks); inited.push(e); } else { @@ -881,8 +881,8 @@ export class GameImpl implements Game { ): Set { return this._map.bfs(tile, filter); } - toTileUpdate(tile: TileRef): bigint { - return this._map.toTileUpdate(tile); + toTileUpdate(tu: TileUpdate): bigint { + return this._map.toTileUpdate(tu); } updateTile(tu: TileUpdate): TileRef { return this._map.updateTile(tu);