diff --git a/resources/lang/en.json b/resources/lang/en.json index 8f76aadd4..62acedfb9 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -1255,6 +1255,7 @@ "disable_alliances_label": "Alliances", "doomsday_clock": "Doomsday Clock", "doomsday_clock_label": "Doomsday Clock", + "doomsday_clock_with_speed": "Doomsday Clock: {speed}", "gold_multiplier": "x{amount} Gold Multiplier", "hard_nations": "Hard Nations", "nukes_disabled": "Nukes Disabled", diff --git a/src/client/GameModeSelector.ts b/src/client/GameModeSelector.ts index 56b2b2528..fe7742502 100644 --- a/src/client/GameModeSelector.ts +++ b/src/client/GameModeSelector.ts @@ -329,6 +329,7 @@ export class GameModeSelector extends LitElement { const modifierLabels = getModifierLabels( lobby.gameConfig?.publicGameModifiers, + lobby.gameConfig?.doomsdayClock?.speed, ); // Sort by length for visual consistency (shorter labels first) if (modifierLabels.length > 1) { diff --git a/src/client/JoinLobbyModal.ts b/src/client/JoinLobbyModal.ts index b0362d39c..844ba7091 100644 --- a/src/client/JoinLobbyModal.ts +++ b/src/client/JoinLobbyModal.ts @@ -640,6 +640,22 @@ export class JoinLobbyModal extends BaseModal { .value=${translateText("common.enabled")} >`, ); + if (c.doomsdayClock?.enabled) + cards.push( + html``, + ); + if (c.anonymizeNames) + cards.push( + html``, + ); if ((isTeam && !c.donateGold) || (!isTeam && c.donateGold)) cards.push( html` + return getActiveModifiers(modifiers, doomsdayClockSpeed).map((m) => translateText(m.badgeKey, m.badgeParams), ); } diff --git a/tests/client/DoomsdayModifierBadge.test.ts b/tests/client/DoomsdayModifierBadge.test.ts index 1a1057e8f..34023b85d 100644 --- a/tests/client/DoomsdayModifierBadge.test.ts +++ b/tests/client/DoomsdayModifierBadge.test.ts @@ -12,6 +12,17 @@ describe("doomsday clock public modifier", () => { expect(mods[0].labelKey).toBe("public_game_modifier.doomsday_clock_label"); }); + it("names the preset when a speed is provided", () => { + const mods = getActiveModifiers({ isDoomsdayClock: true }, "fast"); + expect(mods).toHaveLength(1); + expect(mods[0].badgeKey).toBe( + "public_game_modifier.doomsday_clock_with_speed", + ); + expect(mods[0].labelKey).toBe("public_game_modifier.doomsday_clock_label"); + // The speed is resolved to its translated label and passed as a badge param. + expect(mods[0].badgeParams?.speed).toBeDefined(); + }); + it("omits the badge when the modifier is absent", () => { expect(getActiveModifiers({})).toHaveLength(0); expect(getActiveModifiers(undefined)).toHaveLength(0);