summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-25 18:56:58 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-27 01:12:25 +0100
commite71fadb28d65f19e35d055e5c2ee4f5ccacfd086 (patch)
tree923d57d242444923fb96104d03041b4d92fbb340 /rules.js
parent8b3c51144cfa1f124026f3da2b5b68b0cde5f608 (diff)
downloadmaria-e71fadb28d65f19e35d055e5c2ee4f5ccacfd086.tar.gz
fix force march check
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/rules.js b/rules.js
index 5e54a70..b720f79 100644
--- a/rules.js
+++ b/rules.js
@@ -2726,6 +2726,18 @@ function can_move_general_to(p, from, to) {
return true
}
+function can_force_march_to(p, here, next) {
+ if (is_enemy_controlled_fortress(next))
+ return false
+ if (has_enemy_piece(next))
+ return false
+ if (is_adjacent_to_enemy_piece(next))
+ return false
+ if (!can_move_general_to(p, here, next))
+ return false
+ return true
+}
+
function move_general_to(to, is_force_march) {
let pow = game.power
let who = game.selected
@@ -2844,7 +2856,7 @@ states.move_supply_train = {
function can_force_march(who, here) {
for (let next of data.cities.main_roads[here])
- if (can_move_general_to(who, here, next))
+ if (can_force_march_to(who, here, next))
return true
return false
}
@@ -2937,13 +2949,7 @@ function search_force_march(p, came_from, start, range) {
for (let next of data.cities.main_roads[here]) {
if (set_has(seen, next))
continue
- if (is_enemy_controlled_fortress(next))
- continue
- if (has_enemy_piece(next))
- continue
- if (is_adjacent_to_enemy_piece(next))
- continue
- if (!can_move_general_to(p, here, next))
+ if (!can_force_march_to(p, here, next))
continue
if (came_from)
map_set(came_from, next, here)
@@ -4783,6 +4789,7 @@ states.political_card_discard_or_execute = {
discard() {
push_undo()
log("Discarded with no effect.")
+ array_remove_item(game.political, game.pc)
game.state = "political_card_done"
},
}
@@ -6507,7 +6514,7 @@ states.reject_deal = {
view.actions.undo = 0
},
resume() {
- next_reject_cancel_subsidy()
+ next_reject_deal()
},
}