From 87a96e1e8b9c41a2a14c5bcd896bec92f49ece27 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 9 May 2022 20:26:57 +0200 Subject: Only clear board after successful dominance check. --- rules.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index c2f6585..f90a266 100644 --- a/rules.js +++ b/rules.js @@ -2644,14 +2644,9 @@ function do_dominance_check() { } // Clear the board. - for (let i = 0; i < 36; ++i) - game.pieces[i] = 0; - - // Prince Akbar Khan - if (any_player_has_insurrection()) { - log(`Insurrection placed two Afghan armies in Kabul.`); - game.pieces[0] = Kabul; - game.pieces[1] = Kabul; + if (success) { + for (let i = 0; i < 36; ++i) + game.pieces[i] = 0; } // Check instant victory @@ -2665,6 +2660,14 @@ function do_dominance_check() { game.events = {}; for (let p = 0; p < game.players.length; ++p) game.players[p].events = {}; + + // Prince Akbar Khan + if (any_player_has_insurrection()) { + // TODO: maybe move existing pieces if not successful + log(`Insurrection placed two Afghan armies in Kabul.`); + game.pieces[0] = Kabul; + game.pieces[1] = Kabul; + } } function vp_tie(pp) { -- cgit v1.2.3