diff --git a/src/core/game/TeamAssignment.ts b/src/core/game/TeamAssignment.ts index 4b09fdeba..a7818ffd4 100644 --- a/src/core/game/TeamAssignment.ts +++ b/src/core/game/TeamAssignment.ts @@ -180,7 +180,10 @@ export function computeClanTeamName(players: PlayerInfo[]): string | null { // Coalition: top two clans cover the majority of humans if (sorted.length >= 2) { const [secondTag, secondCount] = sorted[1]; - if ((topCount + secondCount) / total > 0.5) { + if ( + (topCount + secondCount) / total > 2 / 3 && + secondCount / total >= 0.25 + ) { return `${topTag} / ${secondTag}`; } } diff --git a/tests/TeamAssignment.test.ts b/tests/TeamAssignment.test.ts index a5507cac5..2c73c2983 100644 --- a/tests/TeamAssignment.test.ts +++ b/tests/TeamAssignment.test.ts @@ -218,6 +218,11 @@ describe("computeClanTeamName", () => { expect(computeClanTeamName(players)).toBe("ALPHA / BETA"); }); + it("returns null when three distinct clans each hold one player", () => { + const players = [human("1", "ALPHA"), human("2", "BETA"), human("3", "GAMMA")]; + expect(computeClanTeamName(players)).toBeNull(); + }); + it("returns null when no players have clan tags", () => { const players = [human("1"), human("2"), human("3")]; expect(computeClanTeamName(players)).toBeNull();