fix display of active player when a player plays his last card while other players...
authorGeoffrey Allott <geoffrey@allott.email>
Sun, 2 Jul 2023 21:46:18 +0000 (22:46 +0100)
committerGeoffrey Allott <geoffrey@allott.email>
Sun, 2 Jul 2023 21:46:18 +0000 (22:46 +0100)
site/modules/cribbage.js

index c3ce18f902e870ceec5c9ae6ff8d7eb1435691a6..10710f665dd780c659648ef0ef8c33c41e0d283a 100644 (file)
@@ -268,7 +268,7 @@ export class Cribbage extends GameWithChat {
                         image:this.card_image(user_action.username, user_action.action.card),
                     });
                 }
-                if (this.count === 31) {
+                if (this.count === 31 || this.passed.size === [...this.hands.values()].filter(hand => hand.length > 0).length) {
                     this.clear_pegging();
                 }
                 this.active = this.player_after(user_action.username, username => !this.passed.has(username) && this.hands.has(username) && this.hands.get(username).length > 0);