mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-17 15:00:00 +00:00
Quads (#1347)
## Description: - Add trios and quads - Add translations for duos, trios, quads - Add duos, trios, quads to the public lobby rotation - Increase the frequency of team games   ## 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 - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { Colord } from "colord";
|
||||
import { JWK } from "jose";
|
||||
import { GameConfig, GameID } from "../Schemas";
|
||||
import { GameConfig, GameID, TeamCountConfig } from "../Schemas";
|
||||
import {
|
||||
Difficulty,
|
||||
Duos,
|
||||
Game,
|
||||
GameMapType,
|
||||
GameMode,
|
||||
@@ -32,7 +31,7 @@ export interface ServerConfig {
|
||||
lobbyMaxPlayers(
|
||||
map: GameMapType,
|
||||
mode: GameMode,
|
||||
numPlayerTeams: number | undefined,
|
||||
numPlayerTeams: TeamCountConfig | undefined,
|
||||
): number;
|
||||
numWorkers(): number;
|
||||
workerIndex(gameID: GameID): number;
|
||||
@@ -87,7 +86,7 @@ export interface Config {
|
||||
instantBuild(): boolean;
|
||||
numSpawnPhaseTurns(): number;
|
||||
userSettings(): UserSettings;
|
||||
playerTeams(): number | typeof Duos;
|
||||
playerTeams(): TeamCountConfig;
|
||||
|
||||
startManpower(playerInfo: PlayerInfo): number;
|
||||
populationIncreaseRate(player: Player | PlayerView): number;
|
||||
|
||||
@@ -2,7 +2,6 @@ import { JWK } from "jose";
|
||||
import { z } from "zod/v4";
|
||||
import {
|
||||
Difficulty,
|
||||
Duos,
|
||||
Game,
|
||||
GameMapType,
|
||||
GameMode,
|
||||
@@ -20,7 +19,7 @@ import {
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { PlayerView } from "../game/GameView";
|
||||
import { UserSettings } from "../game/UserSettings";
|
||||
import { GameConfig, GameID } from "../Schemas";
|
||||
import { GameConfig, GameID, TeamCountConfig } from "../Schemas";
|
||||
import { assertNever, simpleHash, within } from "../Util";
|
||||
import { Config, GameEnv, NukeMagnitude, ServerConfig, Theme } from "./Config";
|
||||
import { PastelTheme } from "./PastelTheme";
|
||||
@@ -167,13 +166,13 @@ export abstract class DefaultServerConfig implements ServerConfig {
|
||||
lobbyMaxPlayers(
|
||||
map: GameMapType,
|
||||
mode: GameMode,
|
||||
numPlayerTeams: number | undefined,
|
||||
numPlayerTeams: TeamCountConfig | undefined,
|
||||
): number {
|
||||
const [l, m, s] = numPlayersConfig[map] ?? [50, 30, 20];
|
||||
const r = Math.random();
|
||||
const base = r < 0.3 ? l : r < 0.6 ? m : s;
|
||||
let p = Math.min(mode === GameMode.Team ? Math.ceil(base * 1.5) : base, l);
|
||||
if (numPlayerTeams !== undefined) {
|
||||
if (typeof numPlayerTeams === "number") {
|
||||
p -= p % numPlayerTeams;
|
||||
}
|
||||
return p;
|
||||
@@ -279,7 +278,7 @@ export class DefaultConfig implements Config {
|
||||
defensePostDefenseBonus(): number {
|
||||
return 5;
|
||||
}
|
||||
playerTeams(): number | typeof Duos {
|
||||
playerTeams(): TeamCountConfig {
|
||||
return this._gameConfig.playerTeams ?? 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user