diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-11-05 22:52:51 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-11-06 01:45:34 +0100 |
commit | 2d5bf7aca72ba2758f49c36b0bc3e71710dff073 (patch) | |
tree | 8b19229cee6a13c6adc44299b307a33e97058f96 /rules.js | |
parent | c4f5d9bb3e550ba8d13725cc1aeb0da2b27274b2 (diff) | |
download | maria-2d5bf7aca72ba2758f49c36b0bc3e71710dff073.tar.gz |
Clean up Saxony defection returning to previous state.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 42 |
1 files changed, 25 insertions, 17 deletions
@@ -4637,8 +4637,6 @@ function end_politics() { } } - game.stage = 100 // hack for saxony's defection return - goto_adjust_political_tracks() } @@ -4932,9 +4930,9 @@ states.saxony_shift_battle = { // Saxony defection if (save_saxony < 3 && is_saxony_neutral()) - goto_saxony_becomes_neutral() + goto_saxony_becomes_neutral("combat") else if (save_saxony < 5 && is_saxony_austrian_ally()) - goto_saxony_becomes_austrian_ally() + goto_saxony_becomes_austrian_ally("combat") else next_combat() }, @@ -4962,9 +4960,9 @@ states.saxony_shift_supply = { // Saxony defection if (save_saxony < 3 && is_saxony_neutral()) - goto_saxony_becomes_neutral() + goto_saxony_becomes_neutral("supply") else if (save_saxony < 5 && is_saxony_austrian_ally()) - goto_saxony_becomes_austrian_ally() + goto_saxony_becomes_austrian_ally("supply") else resume_supply() }, @@ -5024,9 +5022,9 @@ function goto_saxony_defection() { delete game.save_saxony if (save_saxony < 3 && is_saxony_neutral()) - goto_saxony_becomes_neutral() + goto_saxony_becomes_neutral("political") else if (save_saxony < 5 && is_saxony_austrian_ally()) - goto_saxony_becomes_austrian_ally() + goto_saxony_becomes_austrian_ally("political") end_adjust_political_tracks() } @@ -5152,7 +5150,9 @@ function power_has_any_piece_in_list(pow, list) { return true } -function goto_saxony_becomes_neutral() { +function goto_saxony_becomes_neutral(reason) { + game.saxony_reason = reason + set_active_to_power(P_SAXONY) log_br() @@ -5256,7 +5256,9 @@ states.saxony_return_home = { }, } -function goto_saxony_becomes_austrian_ally() { +function goto_saxony_becomes_austrian_ally(reason) { + game.saxony_reason = reason + set_active_to_power(P_SAXONY) log_br() @@ -5297,29 +5299,36 @@ states.saxony_move_general = { } function end_saxony_neutral() { + let reason = game.saxony_reason + delete game.saxony_reason + game.selected = -1 // Silesia annexed! - if (game.stage > 100) { - game.stage -= 100 + if (reason === "silesia") { goto_annex_silesia_return_austrian_pieces() return } // Political Card event shift - if (game.stage === 100) { + if (reason === "political") { end_adjust_political_tracks() return } // Out of Supply shift - if (game.supply) { + if (reason === "supply") { end_supply() return } // Battle Victory shift - next_combat() + if (reason === "combat") { + next_combat() + return + } + + throw "IMPOSSIBLE" } /* PRUSSIA ANNEXES SILESIA */ @@ -5422,9 +5431,8 @@ function goto_annex_silesia() { if (is_saxony_prussian()) { log("Saxony shifted to neutral.") - game.stage += 100 game.saxony = 3 - goto_saxony_becomes_neutral() + goto_saxony_becomes_neutral("silesia") return } |