summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-06-22 20:58:29 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 12:53:17 +0100
commit080e364a2ef15a20ca242bb607cb80caa3ac3648 (patch)
tree95b2f12a467bf023fa78b8795a54b546fbf3d41d /rules.js
parenta61433b1a2b11055b9a3a75d0ce04499be13986d (diff)
downloadhammer-of-the-scots-080e364a2ef15a20ca242bb607cb80caa3ac3648.tar.gz
hammer: End final winter turn early if possible.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/rules.js b/rules.js
index 8aa76c5..c93998d 100644
--- a/rules.js
+++ b/rules.js
@@ -2276,6 +2276,22 @@ function king_can_go_home(current) {
function goto_scottish_king() {
print_turn_log_no_count("Scottish nobles go home:");
+ // We can end winter early if Moray and Wallace are dead or on the map, and Moray is not overstacked
+ if (game.year == game.end_year) {
+ let e = count_english_nobles();
+ let s = count_scottish_nobles();
+ // We have a clear winner.
+ if (s > 7 || e > 7)
+ return goto_game_over();
+ // Moray is dead so there can be no tie.
+ if (game.location[MORAY] == null)
+ return goto_game_over();
+ // Wallace is dead so there can be no tie breaker.
+ if (game.location[WALLACE] == null)
+ return goto_game_over();
+ // A tie is possible, need to continue to disband and build phase...
+ }
+
if (is_on_map(KING) && king_can_go_home(game.location[KING])) {
game.state = 'scottish_king';
game.active = SCOTLAND;