summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js42
1 files changed, 25 insertions, 17 deletions
diff --git a/rules.js b/rules.js
index 2402b3a..3718544 100644
--- a/rules.js
+++ b/rules.js
@@ -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
}