Remove random modifiers from normal (FFA/team) games, keep hard nations for HvN

This commit is contained in:
FloPinguin
2026-03-13 15:37:10 +01:00
parent 3013133d08
commit 3e1e3116dc
+12 -70
View File
@@ -146,81 +146,39 @@ export class MapPlaylist {
const playerTeams =
mode === GameMode.Team ? this.getTeamCount(map) : undefined;
const modifiers = this.getRandomPublicGameModifiers(playerTeams);
const { startingGold } = modifiers;
let { isCompact, isRandomSpawn, isCrowded, isHardNations } = modifiers;
const isHardNations =
playerTeams === HumansVsNations &&
Math.random() < HARD_NATIONS_HVN_PROBABILITY;
// Duos, Trios, and Quads should not get random spawn (as it defeats the purpose)
if (
playerTeams === Duos ||
playerTeams === Trios ||
playerTeams === Quads
) {
isRandomSpawn = false;
}
// Hard nations modifier only applies when nations are present
if (mode === GameMode.Team && playerTeams !== HumansVsNations) {
isHardNations = false;
}
// Check if compact map would leave every team with at least 2 players
if (
isCompact &&
mode === GameMode.Team &&
!(await this.supportsCompactMapForTeams(map, playerTeams!))
) {
isCompact = false;
}
// Crowded modifier: if the map's biggest player count (first number of calculateMapPlayerCounts) is 60 or lower (small maps),
// set player count to MAX_PLAYER_COUNT (or 60 if compact map is also enabled)
let crowdedMaxPlayers: number | undefined;
if (isCrowded) {
crowdedMaxPlayers = await this.getCrowdedMaxPlayers(map, isCompact);
if (crowdedMaxPlayers === undefined) {
isCrowded = false;
} else {
crowdedMaxPlayers = this.adjustForTeams(crowdedMaxPlayers, playerTeams);
}
}
// Create the default public game config (from your GameManager)
return {
donateGold: mode === GameMode.Team,
donateTroops: mode === GameMode.Team,
gameMap: map,
maxPlayers:
crowdedMaxPlayers ??
(await this.lobbyMaxPlayers(map, mode, playerTeams, isCompact)),
maxPlayers: await this.lobbyMaxPlayers(map, mode, playerTeams, false),
gameType: GameType.Public,
gameMapSize: isCompact ? GameMapSize.Compact : GameMapSize.Normal,
gameMapSize: GameMapSize.Normal,
publicGameModifiers: {
isCompact,
isRandomSpawn,
isCrowded,
isCompact: false,
isRandomSpawn: false,
isCrowded: false,
isHardNations,
startingGold,
startingGold: undefined,
isAlliancesDisabled: false,
},
startingGold,
difficulty: isHardNations ? Difficulty.Hard : Difficulty.Medium,
infiniteGold: false,
infiniteTroops: false,
maxTimerValue: undefined,
instantBuild: false,
randomSpawn: isRandomSpawn,
randomSpawn: false,
nations:
mode === GameMode.Team && playerTeams !== HumansVsNations
? "disabled"
: "default",
gameMode: mode,
playerTeams,
bots: isCompact ? 100 : 400,
spawnImmunityDuration: this.getSpawnImmunityDuration(
playerTeams,
startingGold,
),
bots: 400,
spawnImmunityDuration: this.getSpawnImmunityDuration(playerTeams),
disabledUnits: [],
} satisfies GameConfig;
}
@@ -494,22 +452,6 @@ export class MapPlaylist {
return TEAM_WEIGHTS[0].config;
}
private getRandomPublicGameModifiers(
playerTeams?: TeamCountConfig,
): PublicGameModifiers {
return {
isRandomSpawn: Math.random() < 0.05, // 5% chance
isCompact: Math.random() < 0.05, // 5% chance
isCrowded: Math.random() < 0.05, // 5% chance
startingGold: Math.random() < 0.05 ? 5_000_000 : undefined, // 5% chance
isHardNations:
playerTeams === HumansVsNations
? Math.random() < HARD_NATIONS_HVN_PROBABILITY
: Math.random() < 0.025, // 2.5% chance
isAlliancesDisabled: false,
};
}
private getRandomSpecialGameModifiers(
excludedModifiers: ModifierKey[] = [],
count?: number,