summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-05-09 20:26:57 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:31:29 +0100
commit87a96e1e8b9c41a2a14c5bcd896bec92f49ece27 (patch)
treead870f79a2c86454a2f5f314efb772a67346b289 /rules.js
parent8126ceb4758f3b78c7e84b180a5d9b07f864d16b (diff)
downloadpax-pamir-87a96e1e8b9c41a2a14c5bcd896bec92f49ece27.tar.gz
Only clear board after successful dominance check.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js19
1 files changed, 11 insertions, 8 deletions
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) {