From 15d6b224ad27bb269e5e2e2e1ab324e9f81efc7e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 14 Nov 2024 18:28:01 +0100 Subject: transfer troops before sending expeditionary corps --- rules.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'rules.js') 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 -- cgit v1.2.3