From fcd3c32cb666357443393d8a498271a9b25db1de Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 27 Jun 2022 17:00:36 +0200 Subject: Don't pause for game over if the player buying the dominance check won. --- rules.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/rules.js b/rules.js index d4cb017..3df00d2 100644 --- a/rules.js +++ b/rules.js @@ -3004,28 +3004,30 @@ function vp_tie(pp) { function compute_victory() { let vps = game.players.map((pp,i) => [vp_tie(pp),i]).sort((a,b)=>b[0]-a[0]) + let is_winner = false let result = [] - for (let i = 0; i < vps.length; ++i) - if (vps[i][0] === vps[0][0]) + for (let i = 0; i < vps.length; ++i) { + if (vps[i][0] === vps[0][0]) { result.push(player_names[vps[i][1]]) + if (vps[i][1] === game.active) + is_winner = true + } + } game.result = result.join(", ") game.victory = result.join(" and ") + " won!" logbr() log(game.victory) + return is_winner } function goto_pause_game_over() { - compute_victory() - if (game.undo && game.undo.length > 0) + let is_winner = compute_victory() + if (game.undo && game.undo.length > 0 && !is_winner) { game.state = 'pause_game_over' - else + } else { game.state = 'game_over' -} - -function goto_game_over() { - compute_victory() - game.state = 'game_over' - game.active = 5 + game.active = 5 + } } states.pause_game_over = { -- cgit v1.2.3