From f700c53154d7cd45212e83824ca4df30f650b299 Mon Sep 17 00:00:00 2001 From: Loymdayddaud <145969603+TheGiraffe3@users.noreply.github.com> Date: Sat, 3 May 2025 00:01:10 +0300 Subject: [PATCH] change team order to Red, Blue, Yellow, Green, Teal, Orange, Purple (#615) ## Description: Changes the team order to Red, Blue, Yellow, Green, Orange, Purple, Teal instead of what it originally was (Red, Blue, Teal, Purple, Yellow, Orange, Green) Teal and Blue look similar, so I think it's better to move them further apart. Instead, the primary colors are chosen first. Fixes #614 In the long run, I think it would be nice to have the teams randomly chosen from available colors and not always in the same order - e.g. a three-team game isn't always Red, Blue, and Yellow, it could be any mix of the colors. However, my programming skills aren't great enough to do that. ## Please complete the following: - [x] I have added screenshots for all UI updates - [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 ## Please put your Discord username so you can be contacted if a bug or regression is found: Spartan Oligarchy/Loymdayddaud --- src/core/game/GameImpl.ts | 8 ++++---- tests/TeamAssignment.test.ts | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/core/game/GameImpl.ts b/src/core/game/GameImpl.ts index ccf269688..96da4b611 100644 --- a/src/core/game/GameImpl.ts +++ b/src/core/game/GameImpl.ts @@ -108,11 +108,11 @@ export class GameImpl implements Game { const numPlayerTeams = this._config.playerTeams() as number; if (numPlayerTeams < 2) throw new Error(`Too few teams: ${numPlayerTeams}`); - if (numPlayerTeams >= 3) this.playerTeams.push(ColoredTeams.Teal); - if (numPlayerTeams >= 4) this.playerTeams.push(ColoredTeams.Purple); - if (numPlayerTeams >= 5) this.playerTeams.push(ColoredTeams.Yellow); + if (numPlayerTeams >= 3) this.playerTeams.push(ColoredTeams.Yellow); + if (numPlayerTeams >= 4) this.playerTeams.push(ColoredTeams.Green); + if (numPlayerTeams >= 5) this.playerTeams.push(ColoredTeams.Purple); if (numPlayerTeams >= 6) this.playerTeams.push(ColoredTeams.Orange); - if (numPlayerTeams >= 7) this.playerTeams.push(ColoredTeams.Green); + if (numPlayerTeams >= 7) this.playerTeams.push(ColoredTeams.Teal); if (numPlayerTeams >= 8) throw new Error(`Too many teams: ${numPlayerTeams}`); } diff --git a/tests/TeamAssignment.test.ts b/tests/TeamAssignment.test.ts index 331af56ef..33dace65d 100644 --- a/tests/TeamAssignment.test.ts +++ b/tests/TeamAssignment.test.ts @@ -143,11 +143,11 @@ describe("assignTeams", () => { const result = assignTeams(players, [ ColoredTeams.Red, ColoredTeams.Blue, - ColoredTeams.Teal, - ColoredTeams.Purple, ColoredTeams.Yellow, - ColoredTeams.Orange, ColoredTeams.Green, + ColoredTeams.Purple, + ColoredTeams.Orange, + ColoredTeams.Teal, ]); expect(result.get(players[0])).toEqual(ColoredTeams.Red); @@ -155,14 +155,14 @@ describe("assignTeams", () => { expect(result.get(players[2])).toEqual("kicked"); expect(result.get(players[3])).toEqual(ColoredTeams.Blue); expect(result.get(players[4])).toEqual(ColoredTeams.Blue); - expect(result.get(players[5])).toEqual(ColoredTeams.Teal); - expect(result.get(players[6])).toEqual(ColoredTeams.Purple); - expect(result.get(players[7])).toEqual(ColoredTeams.Yellow); + expect(result.get(players[5])).toEqual(ColoredTeams.Yellow); + expect(result.get(players[6])).toEqual(ColoredTeams.Green); + expect(result.get(players[7])).toEqual(ColoredTeams.Purple); expect(result.get(players[8])).toEqual(ColoredTeams.Orange); - expect(result.get(players[9])).toEqual(ColoredTeams.Green); - expect(result.get(players[10])).toEqual(ColoredTeams.Teal); - expect(result.get(players[11])).toEqual(ColoredTeams.Purple); - expect(result.get(players[12])).toEqual(ColoredTeams.Yellow); + expect(result.get(players[9])).toEqual(ColoredTeams.Teal); + expect(result.get(players[10])).toEqual(ColoredTeams.Yellow); + expect(result.get(players[11])).toEqual(ColoredTeams.Green); + expect(result.get(players[12])).toEqual(ColoredTeams.Purple); expect(result.get(players[13])).toEqual(ColoredTeams.Orange); }); });