summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-28 11:41:42 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-28 23:33:22 +0100
commitdfc5632eef35ed36a5b1f400292c2739802d85f0 (patch)
tree15b0125350fb170fcdab038979e703991aa5b1fd /rules.js
parent0d9f011545370e0122c82c4182177f4a1e698c2d (diff)
downloadmaria-dfc5632eef35ed36a5b1f400292c2739802d85f0.tar.gz
fix retroactive conquest in 2p scenario
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/rules.js b/rules.js
index 00d6ebe..ca83974 100644
--- a/rules.js
+++ b/rules.js
@@ -4362,24 +4362,28 @@ function log_conquest(conq) {
}
}
-function goto_retroactive_conquest() {
- delete game.combat
-
- let conq = []
-
- map_for_each(game.retro, function (s, pow) {
- if (pow === game.power && is_enemy_controlled_fortress(s)) {
+function apply_retroactive_conquest(conq, major) {
+ map_for_each(game.retro, function (s, other) {
+ if (other === major && is_enemy_controlled_fortress(s)) {
if (!is_protected_from_conquest(s)) {
- set_control_of_fortress(s, pow)
+ set_control_of_fortress(s, other)
conq.push(s)
}
}
})
+ game.retro = map_filter(game.retro, (_,other) => other !== major)
+}
- game.retro = map_filter(game.retro, (_,pow) => pow !== game.power)
-
+function goto_retroactive_conquest() {
+ delete game.combat
+ let conq = []
+ if (is_two_player() && !is_intro() && (game.power === P_PRAGMATIC || game.power === P_AUSTRIA)) {
+ apply_retroactive_conquest(conq, P_AUSTRIA)
+ apply_retroactive_conquest(conq, P_PRAGMATIC)
+ } else {
+ apply_retroactive_conquest(conq, game.power)
+ }
log_conquest(conq)
-
next_sequence_of_play()
}