summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-12-06 00:05:14 +0100
committerTor Andersson <tor@ccxvii.net>2024-12-06 00:06:34 +0100
commit14b8222d7059df64234bd92ee627b6f6b4ff051d (patch)
tree4316162c6c02861fbc6ba112686950810af27679 /rules.js
parenta70c6713d58552e6937604f053d59d04667be17c (diff)
downloadmaria-14b8222d7059df64234bd92ee627b6f6b4ff051d.tar.gz
Remove from combat generals that move home when Saxony becomes neutral.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index 647c996..71ac755 100644
--- a/rules.js
+++ b/rules.js
@@ -3734,6 +3734,12 @@ function end_recruit() {
/* COMBAT (CHOOSE TARGETS) */
+function remove_from_combat(p) {
+ let s = game.pos[p]
+ if (game.combat)
+ game.combat = map_filter(game.combat, (atk, def) => atk !== s && def !== s)
+}
+
function goto_combat() {
let from = []
let to = []
@@ -5627,6 +5633,8 @@ states.saxony_return_foreign_where = {
gen_action_space(s)
},
space(s) {
+ if (is_general(game.selected))
+ remove_from_combat(game.selected)
log(">P" + game.selected + " to S" + s)
enter_piece_at(game.selected, s)
game.selected = -1
@@ -5654,6 +5662,8 @@ states.saxony_return_home = {
view.actions.next = 1
},
piece(p) {
+ if (is_general(p))
+ remove_from_combat(p)
let s = setup_piece_position[p]
game.pos[p] = s
log(">P" + p + " to S" + s)
@@ -5699,6 +5709,7 @@ states.saxony_move_general = {
gen_action_space(s)
},
space(s) {
+ remove_from_combat(game.selected)
log(">P" + game.selected + " to S" + s)
enter_piece_at(game.selected, s)
end_saxony_neutral()
@@ -5977,7 +5988,7 @@ states.silesia_enter_prussian_train = {
states.silesia_done = {
inactive: "annex Silesia",
prompt() {
- prompt("Silesian annexation done.")
+ prompt("Silesian annexion done.")
view.actions.next = 1
},
next() {