From f728a123826e13b085f8d88e2e90e78eee9302e8 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 23 Nov 2024 13:33:14 +0100 Subject: Transfer troops required due to OOS troop losses. --- rules.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 7cb23f7..b03ce2f 100644 --- a/rules.js +++ b/rules.js @@ -2246,6 +2246,19 @@ states.supply_restore = { }, } +function remove_one_troop(p) { + if (game.troops[p] === 1) { + for (let x of all_power_generals[game.power]) { + if (game.pos[x] === game.pos[p] && game.troops[x] > 1) { + game.troops[x] -- + return + } + } + } + if (game.troops[p] > 0) + game.troops[p] -- +} + states.supply_suffer = { inactive: "supply", prompt() { @@ -2258,11 +2271,12 @@ states.supply_suffer = { set_delete(game.supply.suffer, p) if (is_out_of_supply(p)) { log(`>P${p} at S${s} (-2)`) - game.troops[p] -= 2 + remove_one_troop(p) + remove_one_troop(p) } else { log(`>P${p} at S${s} (-1)`) set_out_of_supply(p) - game.troops[p] -= 1 + remove_one_troop(p) } if (game.troops[p] <= 0) { eliminate_general(p, true) @@ -5074,6 +5088,8 @@ function is_saxony_austrian_ally() { } function should_shift_saxony_after_battle(n) { + if (is_intro()) + return false if (n > 0 && game.saxony < 5) { if (game.loser_power === P_PRUSSIA) return true @@ -5084,6 +5100,8 @@ function should_shift_saxony_after_battle(n) { } function should_saxony_shift_after_supply(pow) { + if (is_intro()) + return false if (game.saxony < 5) { if (pow === P_PRUSSIA) return true -- cgit v1.2.3