From 9926d6955fb30e9e17312ffeacfc21a4766d8208 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 9 May 2024 18:08:00 +0200 Subject: fix dead end on john_glovers_marblehead_regiment --- rules.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'rules.js') diff --git a/rules.js b/rules.js index f027463..94ca4ef 100644 --- a/rules.js +++ b/rules.js @@ -329,6 +329,9 @@ function can_play_event(c) { case 'after_french_alliance': return game.french_alliance_triggered; case 'european_war_in_effect': return game.european_war; } + switch (card.event) { + case 'john_glovers_marblehead_regiment': return has_general_on_map(); + } return true; } @@ -701,6 +704,27 @@ function count_friendly_generals(where) { return count; } +function has_general_on_map() { + if (game.active == BRITISH) + return has_british_general_on_map(); + else + return has_american_general_on_map(); +} + +function has_british_general_on_map() { + for (let g of BRITISH_GENERALS) + if (is_general_on_map(g)) + return true; + return false; +} + +function has_american_general_on_map() { + for (let g of AMERICAN_GENERALS) + if (is_general_on_map(g)) + return true; + return false; +} + function can_activate_general(c) { if (game.active == BRITISH) return can_activate_british_general(c); -- cgit v1.2.3