diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-08-22 22:02:32 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-08-22 22:03:02 +0200 |
commit | 6a9a9b806f7307ba5e191bcf8a566f335646b8d3 (patch) | |
tree | b9c534d757058c528e0ee6f07d5fd64195408dd3 | |
parent | a1ca3a906f87764a3dfa160d7133e1030b40c2d9 (diff) | |
download | washingtons-war-6a9a9b806f7307ba5e191bcf8a566f335646b8d3.tar.gz |
Fix victory check.
-rw-r--r-- | rules.js | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -4494,17 +4494,28 @@ function automatic_victory() { function norths_government_falls() { let n_american = 0 - for (let c = 0; c <= 13; ++c) + let n_british = 0 + for (let c = 0; c <= 13; ++c) { if (get_colony_control(c) === PC_AMERICAN) ++n_american + if (get_colony_control(c) === PC_BRITISH) + ++n_british + } - if (n_american >= 7) - game.result = P_AMERICA - else + if (n_british >= 6) { game.result = P_BRITAIN + } else { + if (n_american >= 7) + game.result = P_AMERICA + else + game.result = P_BRITAIN + } log("=! Game Over") - game.victory = "North's Government Falls: " + game.result + " Victory!" + if (game.result === P_AMERICA) + game.victory = "North's Government Falls:\nAmerican victory!" + else + game.victory = "North's Government Falls:\nBritish victory!" game.active = "None" game.state = "game_over" |