mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-27 00:42:43 +00:00
Option to disable alliances + 2 new modifiers for variety 😄 (#3392)
## Description:
Rex had this idea: "It would be funny to have an option in private
lobbies to disable alliances."
I added it as an option.
Now people can choose to live in constant fear of their neighbors 😆
Also added two new public game modifiers for variety (only for the
special rotation):
- Alliances disabled (low probability)
- x2 gold multiplier (low probability)
Would be nice to squeeze this into v30, last minute?
## 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
## Please put your Discord username so you can be contacted if a bug or
regression is found:
FloPinguin
This commit is contained in:
@@ -157,6 +157,9 @@ export class GameServer {
|
||||
if (gameConfig.startingGold !== undefined) {
|
||||
this.gameConfig.startingGold = gameConfig.startingGold;
|
||||
}
|
||||
if (gameConfig.disableAlliances !== undefined) {
|
||||
this.gameConfig.disableAlliances = gameConfig.disableAlliances;
|
||||
}
|
||||
}
|
||||
|
||||
private isKicked(clientID: ClientID): boolean {
|
||||
|
||||
@@ -103,7 +103,9 @@ type ModifierKey =
|
||||
| "isCrowded"
|
||||
| "isHardNations"
|
||||
| "startingGold"
|
||||
| "startingGoldHigh";
|
||||
| "startingGoldHigh"
|
||||
| "goldMultiplier"
|
||||
| "isAlliancesDisabled";
|
||||
|
||||
// Each entry represents one "ticket" in the pool. More tickets = higher chance of selection.
|
||||
const SPECIAL_MODIFIER_POOL: ModifierKey[] = [
|
||||
@@ -113,6 +115,8 @@ const SPECIAL_MODIFIER_POOL: ModifierKey[] = [
|
||||
...Array<ModifierKey>(1).fill("isHardNations"),
|
||||
...Array<ModifierKey>(8).fill("startingGold"),
|
||||
...Array<ModifierKey>(1).fill("startingGoldHigh"),
|
||||
...Array<ModifierKey>(1).fill("goldMultiplier"),
|
||||
...Array<ModifierKey>(1).fill("isAlliancesDisabled"),
|
||||
];
|
||||
|
||||
// Modifiers that cannot be active at the same time.
|
||||
@@ -197,6 +201,7 @@ export class MapPlaylist {
|
||||
isCrowded,
|
||||
isHardNations,
|
||||
startingGold,
|
||||
isAlliancesDisabled: false,
|
||||
},
|
||||
startingGold,
|
||||
difficulty: isHardNations ? Difficulty.Hard : Difficulty.Medium,
|
||||
@@ -263,7 +268,14 @@ export class MapPlaylist {
|
||||
undefined,
|
||||
poolCountReduction,
|
||||
);
|
||||
let { isCrowded, startingGold, isCompact, isRandomSpawn } = poolResult;
|
||||
let {
|
||||
isCrowded,
|
||||
startingGold,
|
||||
isCompact,
|
||||
isRandomSpawn,
|
||||
goldMultiplier,
|
||||
isAlliancesDisabled,
|
||||
} = poolResult;
|
||||
let isHardNations =
|
||||
hardNationsFromIndependentRoll ?? poolResult.isHardNations;
|
||||
|
||||
@@ -280,7 +292,9 @@ export class MapPlaylist {
|
||||
!isRandomSpawn &&
|
||||
!isCompact &&
|
||||
!isHardNations &&
|
||||
startingGold === undefined
|
||||
startingGold === undefined &&
|
||||
goldMultiplier === undefined &&
|
||||
!isAlliancesDisabled
|
||||
) {
|
||||
excludedModifiers.push("isCrowded");
|
||||
const fallback = this.getRandomSpecialGameModifiers(
|
||||
@@ -288,7 +302,13 @@ export class MapPlaylist {
|
||||
1,
|
||||
poolCountReduction,
|
||||
);
|
||||
({ isRandomSpawn, isCompact, startingGold } = fallback);
|
||||
({
|
||||
isRandomSpawn,
|
||||
isCompact,
|
||||
startingGold,
|
||||
goldMultiplier,
|
||||
isAlliancesDisabled,
|
||||
} = fallback);
|
||||
isHardNations =
|
||||
hardNationsFromIndependentRoll ?? fallback.isHardNations;
|
||||
}
|
||||
@@ -321,8 +341,12 @@ export class MapPlaylist {
|
||||
isCrowded,
|
||||
isHardNations,
|
||||
startingGold,
|
||||
goldMultiplier,
|
||||
isAlliancesDisabled,
|
||||
},
|
||||
startingGold,
|
||||
goldMultiplier,
|
||||
disableAlliances: isAlliancesDisabled,
|
||||
difficulty: isHardNations ? Difficulty.Hard : Difficulty.Medium,
|
||||
infiniteGold: false,
|
||||
infiniteTroops: false,
|
||||
@@ -482,6 +506,7 @@ export class MapPlaylist {
|
||||
playerTeams === HumansVsNations
|
||||
? Math.random() < HARD_NATIONS_HVN_PROBABILITY
|
||||
: Math.random() < 0.025, // 2.5% chance
|
||||
isAlliancesDisabled: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -530,6 +555,8 @@ export class MapPlaylist {
|
||||
: selected.has("startingGold")
|
||||
? 5_000_000
|
||||
: undefined,
|
||||
goldMultiplier: selected.has("goldMultiplier") ? 2 : undefined,
|
||||
isAlliancesDisabled: selected.has("isAlliancesDisabled"),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user