summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js47
1 files changed, 42 insertions, 5 deletions
diff --git a/rules.js b/rules.js
index 8cd9109..7343c2a 100644
--- a/rules.js
+++ b/rules.js
@@ -2032,6 +2032,28 @@ states.movement_flanders_next = {
},
}
+function has_moved_any_pieces() {
+ if (game.power === P_AUSTRIA && !(game.flags & F_MOVE_FLANDERS))
+ return has_moved_any_bohemia_pieces()
+ for (let p of all_controlled_generals(game.power))
+ if (set_has(game.moved, p))
+ return true
+ for (let p of all_controlled_trains(game.power))
+ if (set_has(game.moved, p))
+ return true
+ return false
+}
+
+function has_moved_any_bohemia_pieces() {
+ for (let p of all_controlled_generals(game.power))
+ if (is_bohemia_space(game.pos[p]) && set_has(game.moved, p))
+ return true
+ for (let p of all_controlled_trains(game.power))
+ if (is_bohemia_space(game.pos[p]) && set_has(game.moved, p))
+ return true
+ return false
+}
+
states.movement = {
inactive: "move",
prompt() {
@@ -2066,7 +2088,9 @@ states.movement = {
}
}
- if (done_trains && done_generals)
+ if (game.power === P_AUSTRIA && (game.flags & F_MOVE_FLANDERS))
+ prompt("Move one piece on the Flanders map.")
+ else if (done_trains && done_generals)
prompt("Movement done.")
else if (done_generals && !done_trains)
prompt("Move your supply trains.")
@@ -2075,10 +2099,17 @@ states.movement = {
else
prompt("Move your generals and supply trains.")
- if (game.moved.length === 0)
- view.actions.confirm_end_movement = 1
- else
- view.actions.end_movement = 1
+ if (game.power === P_AUSTRIA && (game.flags & F_MOVE_FLANDERS)) {
+ if (!has_moved_any_pieces())
+ view.actions.confirm_end_flanders = 1
+ else
+ view.actions.end_flanders = 1
+ } else {
+ if (!has_moved_any_pieces())
+ view.actions.confirm_end_movement = 1
+ else
+ view.actions.end_movement = 1
+ }
},
re_enter() {
push_undo()
@@ -2108,6 +2139,12 @@ states.movement = {
game.state = "move_general"
}
},
+ confirm_end_flanders() {
+ this.end_flanders()
+ },
+ end_flanders() {
+ this.end_movement()
+ },
confirm_end_movement() {
this.end_movement()
},