diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-06-27 17:00:36 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 12:31:29 +0100 |
commit | fcd3c32cb666357443393d8a498271a9b25db1de (patch) | |
tree | 8a861fb542240eb7e9d1410ffb8e890527f9c376 | |
parent | 57668a518552e0c09354f9ee21464737ee2b6aae (diff) | |
download | pax-pamir-fcd3c32cb666357443393d8a498271a9b25db1de.tar.gz |
Don't pause for game over if the player buying the dominance check won.
-rw-r--r-- | rules.js | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -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 = { |