diff --git a/public/views/mp/rushroyale.html b/public/views/mp/rushroyale.html
index 5ec5f57a..8c0ab802 100644
--- a/public/views/mp/rushroyale.html
+++ b/public/views/mp/rushroyale.html
@@ -495,7 +495,10 @@
toId = setTimeout(endCycle, duration * 1000);
}
+ let endingCycle = false;
+
function endCycle() {
+ endingCycle = true;
// figure out who to kick
const num_kicked = kickPlayer();
@@ -507,13 +510,25 @@
// round is over
reset();
}
+
+ endingCycle = false;
}
- function kickPlayer() {
+ function kickPlayer(topOutPlayer) {
const { sorted_players, active_players } = getSortedPlayers();
let cut_idx;
+ // special handling for top out players to ensure the winner is shown
+ if (topOutPlayer) {
+ if (active_players.length === 1) {
+ active_players[0].game?.end();
+ active_players[0].playWinnerAnimation();
+ reset();
+ }
+ return;
+ }
+
if (active_players.length >= 2) {
// grab all the tail players with the same score
const lastPlayer = peek(active_players);
@@ -668,7 +683,10 @@
this.dom.full_node.classList.add('eliminated');
this.dom.rank_node.classList.add('eliminated');
- updateScore();
+ if (!endingCycle) {
+ updateScore();
+ kickPlayer(this);
+ }
};
player._playWinnerAnimation = player.playWinnerAnimation;
@@ -705,8 +723,6 @@
}
};
- // player.onGameOver();
-
players.push(player);
});