mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 17:26:42 +00:00
Quads fix (#1356)
## Description: Add missing code that was meant to go in #1347 ## 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:
@@ -2,6 +2,7 @@ import { JWK } from "jose";
|
||||
import { z } from "zod/v4";
|
||||
import {
|
||||
Difficulty,
|
||||
Duos,
|
||||
Game,
|
||||
GameMapType,
|
||||
GameMode,
|
||||
@@ -10,9 +11,11 @@ import {
|
||||
Player,
|
||||
PlayerInfo,
|
||||
PlayerType,
|
||||
Quads,
|
||||
TerrainType,
|
||||
TerraNullius,
|
||||
Tick,
|
||||
Trios,
|
||||
UnitInfo,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
@@ -172,8 +175,20 @@ export abstract class DefaultServerConfig implements ServerConfig {
|
||||
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 (typeof numPlayerTeams === "number") {
|
||||
p -= p % numPlayerTeams;
|
||||
if (numPlayerTeams === undefined) return p;
|
||||
switch (numPlayerTeams) {
|
||||
case Duos:
|
||||
p -= p % 2;
|
||||
break;
|
||||
case Trios:
|
||||
p -= p % 3;
|
||||
break;
|
||||
case Quads:
|
||||
p -= p % 4;
|
||||
break;
|
||||
default:
|
||||
p -= p % numPlayerTeams;
|
||||
break;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,6 @@ export class DevServerConfig extends DefaultServerConfig {
|
||||
return 5 * 1000;
|
||||
}
|
||||
|
||||
lobbyMaxPlayers(): number {
|
||||
return Math.random() < 0.5 ? 2 : 3;
|
||||
}
|
||||
|
||||
samWarheadHittingChance(): number {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user