mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-25 09:34:36 +00:00
feat: Implement NukeWars spawn logic and update dependencies
- Updates `jose` and `zod` dependencies. - Adds a default case to the bot troop multiplier in `DefaultConfig.ts`. - Implements NukeWars specific spawn logic in `SpawnExecution.ts`. - Adjusts team population for NukeWars mode in `GameImpl.ts`. - Resolves merge conflicts.
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
Generated
+8
-8
@@ -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"
|
||||
|
||||
+2
-2
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<TileRef> {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user