summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-17 16:31:50 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-17 16:31:50 +0200
commitd40f4d5eae30fd292ef0bffac7b6479291d5550a (patch)
tree8ca3392682b129ddf4e64b44a205b220b3bf8325
parent71a7bac00a296c5de994fe4d92d0b46d8c01d069 (diff)
downloadmaria-d40f4d5eae30fd292ef0bffac7b6479291d5550a.tar.gz
forbid illegal cross-map retreats
-rw-r--r--rules.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/rules.js b/rules.js
index 5461392..ab7b143 100644
--- a/rules.js
+++ b/rules.js
@@ -2202,6 +2202,17 @@ function search_retreat_distance(from, range) {
return seen
}
+function is_illegal_cross_map_retreat(from, to) {
+ if ((is_flanders_space(from) && is_bohemia_space(to)) || (is_flanders_space(to) && is_bohemia_space(from))) {
+ for (let p of game.selected) {
+ let pow = piece_power[p]
+ if (pow !== P_FRANCE && pow !== P_AUSTRIA)
+ return true
+ }
+ }
+ return false
+}
+
// search all possible retreat paths of given length
function search_retreat_possible_dfs(result, seen, here, range) {
for (let next of data.cities.adjacent[here]) {
@@ -2209,6 +2220,8 @@ function search_retreat_possible_dfs(result, seen, here, range) {
continue
if (has_any_piece(next))
continue
+ if (is_illegal_cross_map_retreat(here, next))
+ continue
if (range === 1) {
set_add(result, next)
} else {