summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-14 18:28:01 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-14 18:28:01 +0100
commit15d6b224ad27bb269e5e2e2e1ab324e9f81efc7e (patch)
treec804525f1bbb1489612a34a90d23d4d40b257996 /rules.js
parentad25fb8977c221c0913a48cce6e98f59ae8aaa50 (diff)
downloadmaria-15d6b224ad27bb269e5e2e2e1ab324e9f81efc7e.tar.gz
transfer troops before sending expeditionary corps
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index c53c6bf..852e6a1 100644
--- a/rules.js
+++ b/rules.js
@@ -5262,6 +5262,15 @@ states.send_expeditionary_corps = {
piece(p) {
push_undo()
+ game.selected = p
+
+ // transfer troops to other stacked general if possible
+ let take = count_unstacked_take()
+ let give = count_stacked_give()
+ let xfer = Math.min(take, give)
+ if (xfer > 0)
+ give_troops(xfer)
+
let s = off_map_box(game.power)
log(`Expeditionary corps P${p} from S${game.pos[p]} to S${s}.`)
game.pos[p] = s
@@ -5271,7 +5280,6 @@ states.send_expeditionary_corps = {
pool: [],
used: [],
}
- game.selected = p
game.state = "recruit_for_expeditionary_corps"
} else {
game.state = "send_expeditionary_corps_done"
@@ -5286,6 +5294,7 @@ states.send_expeditionary_corps_done = {
view.actions.next = 1
},
next() {
+ game.selected = -1
if (game.power === P_PRAGMATIC)
next_execute_political_card()
else