Skip to content

Commit ae0b127

Browse files
committed
Fix isPreGameLeave condition bug
1 parent f20c67c commit ae0b127

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ws/classes/Game.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,10 @@ export default class Game {
414414
const tag = this.players[player.id].tag;
415415

416416
// For ranked duels: if someone leaves during "getready" (countdown before first round),
417-
// cancel the game without ELO penalties - no actual gameplay has happened yet
418-
const isPreGameLeave = this.public && this.duel && this.state === 'getready';
417+
// cancel the game without ELO penalties - no actual gameplay has happened yet.
418+
// curRound is set to 1 at start() and incremented after each round, so curRound <= 1
419+
// ensures we only treat it as pregame during the initial countdown, not between rounds.
420+
const isPreGameLeave = this.public && this.duel && this.state === 'getready' && this.curRound <= 1;
419421
// Track disconnection for ranked duels (only if actual gameplay has started)
420422
if(this.public && this.duel && !isPreGameLeave) {
421423
this.disconnectedPlayer = tag;

0 commit comments

Comments
 (0)