diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-11-23 13:33:14 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-11-23 13:54:27 +0100 |
commit | f728a123826e13b085f8d88e2e90e78eee9302e8 (patch) | |
tree | c6d4dbbccb3a74af64dbd019477583f1fa55cffe /rules.js | |
parent | f79213a6f5984a8567fc4e3198281535ca03fe11 (diff) | |
download | maria-f728a123826e13b085f8d88e2e90e78eee9302e8.tar.gz |
Transfer troops required due to OOS troop losses.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -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 |