summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-03-20 23:09:24 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 11:54:52 +0100
commit0831b131690929ac4104c52b8047605c870f2301 (patch)
tree08ee55e88da81893ebdb8ea027a4466f7eaba575
parentfa73f2edd6c803656c22595b919fa278a5e8387e (diff)
downloadwilderness-war-0831b131690929ac4104c52b8047605c870f2301.tar.gz
Check if "Call out militias" can have an effect before allowing play.
-rw-r--r--rules.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/rules.js b/rules.js
index 18a35fb..9ce1162 100644
--- a/rules.js
+++ b/rules.js
@@ -7798,6 +7798,18 @@ states.restore_regular_or_light_infantry_units = {
}
events.call_out_militias = {
+ can_play() {
+ if (game.active === FRANCE) {
+ for (let p = first_french_militia; p <= last_french_militia; ++p)
+ if (is_piece_unused(p) || is_unit_reduced(p))
+ return true;
+ } else {
+ for (let p = first_british_militia; p <= last_british_militia; ++p)
+ if (is_piece_unused(p) || is_unit_reduced(p))
+ return true;
+ }
+ return false;
+ },
play() {
game.state = 'call_out_militias';
game.count = 2;