From 17db98cbed3cf4cf92b144e3d70920c067bd1cf2 Mon Sep 17 00:00:00 2001 From: Nicolas THIMONIER Date: Wed, 22 Nov 2023 17:27:16 +0100 Subject: [PATCH] fix ball still red after end of match --- api/src/modules/game/pong/Game.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/api/src/modules/game/pong/Game.ts b/api/src/modules/game/pong/Game.ts index 6195917..f5c533d 100644 --- a/api/src/modules/game/pong/Game.ts +++ b/api/src/modules/game/pong/Game.ts @@ -254,25 +254,22 @@ export class Game { let winner: Player | null = null; let loser: Player | null = null; if (this.player1.opponent == null) { - this.player1.socket.emit(GameEvent.Victory); winner = this.player1; loser = this.player2; } else if (this.player2.opponent == null) { - this.player2.socket.emit(GameEvent.Victory); winner = this.player2; loser = this.player1; } else if (this.player1.score >= 8) { - this.player1.socket.emit(GameEvent.Victory); - this.player2.socket.emit(GameEvent.Defeat); winner = this.player1; loser = this.player2; } else if (this.player2.score >= 8) { - this.player1.socket.emit(GameEvent.Defeat); - this.player2.socket.emit(GameEvent.Victory); winner = this.player2; loser = this.player1; } if (winner && loser) { + this.setOfFire(); + winner.socket.emit(GameEvent.Victory); + loser.socket.emit(GameEvent.Defeat); if (winner.socket.data.user.id != loser.socket.data.user.id) { this.gameService.createGame( winner.socket.data.user.login,