summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-13 16:50:41 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-13 16:50:41 +0100
commitee70909782faa66436f5784aab76c403170ed100 (patch)
tree577d05e92dff88ffd770667d26fbe3daae86a4ca
parent104d2281d3bea55f2a835f7f154f3a759421c75a (diff)
downloadmaria-ee70909782faa66436f5784aab76c403170ed100.tar.gz
fix prussia neutrality expiration
-rw-r--r--play.js6
-rw-r--r--rules.js18
2 files changed, 18 insertions, 6 deletions
diff --git a/play.js b/play.js
index be27367..77f7078 100644
--- a/play.js
+++ b/play.js
@@ -345,6 +345,10 @@ function is_two_player() {
return view.flags & F_TWO_PLAYER
}
+function is_saxony_neutral() {
+ return view.saxony > 2 && view.saxony < 5
+}
+
function count_victory_markers_in_country(pow, country) {
let n = 0
map_for_each(view.victory, (vspace, vpow) => {
@@ -1435,6 +1439,8 @@ function on_update() {
}
if (pow === P_PRUSSIA && (view.flags & F_PRUSSIA_NEUTRAL))
banner += " \u2014 Neutral"
+ if (pow === P_SAXONY && is_saxony_neutral())
+ banner += " \u2014 Neutral"
if (pow === P_FRANCE && (view.flags & F_WAR_OF_JENKINS_EAR))
banner += " \u2014 receives 1 TC less"
diff --git a/rules.js b/rules.js
index 76b166c..6a877e2 100644
--- a/rules.js
+++ b/rules.js
@@ -99,6 +99,7 @@ const F_WAR_OF_JENKINS_EAR = 64 // -1 France TC for one turn
const F_SAXONY_TC_ONCE = 128 // only draw TCs once per turn
const F_FRANCE_REDUCED = 256
const F_PRUSSIA_NEUTRAL = 512
+const F_PRUSSIA_NEUTRAL_2 = 65536
const F_MOVE_FLANDERS = 1024
const F_MOVE_DISPUTE = 2048
const F_INTRODUCTORY = 4096
@@ -1406,6 +1407,7 @@ const advanced_sequence_of_play = [
{ power: P_FRANCE, action: goto_france_reduces_military_objectives },
{ power: P_PRUSSIA, action: start_action_stage },
+ { power: P_PRUSSIA, action: goto_prussia_ends_neutrality },
{ power: P_PRUSSIA, action: goto_tactical_cards },
{ power: P_SAXONY, action: goto_tactical_cards, condition: is_saxony_prussian },
{ power: P_PRUSSIA, action: goto_supply },
@@ -1415,7 +1417,6 @@ const advanced_sequence_of_play = [
{ power: P_PRUSSIA, action: end_movement },
{ power: P_PRUSSIA, action: goto_combat },
{ power: P_PRUSSIA, action: end_action_stage },
- { power: P_PRUSSIA, action: goto_prussia_ends_neutrality },
{ power: P_PRUSSIA, action: goto_prussia_annexes_silesia },
{ power: P_AUSTRIA, action: start_action_stage },
@@ -1455,6 +1456,7 @@ const two_player_sequence_of_play = [
{ power: P_FRANCE, action: goto_france_reduces_military_objectives },
{ power: P_PRUSSIA, action: start_action_stage },
+ { power: P_PRUSSIA, action: goto_prussia_ends_neutrality },
{ power: P_PRUSSIA, action: goto_tactical_cards },
{ power: P_SAXONY, action: goto_tactical_cards, condition: is_saxony_prussian },
{ power: P_PRUSSIA, action: goto_supply },
@@ -1464,7 +1466,6 @@ const two_player_sequence_of_play = [
{ power: P_PRUSSIA, action: end_movement },
{ power: P_PRUSSIA, action: goto_combat },
{ power: P_PRUSSIA, action: end_action_stage },
- { power: P_PRUSSIA, action: goto_prussia_ends_neutrality },
{ power: P_PRUSSIA, action: goto_prussia_annexes_silesia },
{ power: P_AUSTRIA, action: start_action_stage },
@@ -2241,13 +2242,12 @@ states.supply_suffer = {
},
piece(p) {
let s = game.pos[p]
- log(`>P${p} at S${s}`)
set_delete(game.supply.suffer, p)
if (is_out_of_supply(p)) {
- //log(`>P${p} at S${s} -2 troops`)
+ log(`>P${p} at S${s} (\u{2212}2)`)
game.troops[p] -= 2
} else {
- //log(`>P${p} at S${s} -1 troop`)
+ log(`>P${p} at S${s} (\u{2212}1)`)
set_out_of_supply(p)
game.troops[p] -= 1
}
@@ -5603,7 +5603,12 @@ function end_saxony_neutral() {
/* PRUSSIA ANNEXES SILESIA */
function goto_prussia_ends_neutrality() {
- game.flags &= ~F_PRUSSIA_NEUTRAL
+ if (game.flags & F_PRUSSIA_NEUTRAL_2) {
+ game.flags &= ~F_PRUSSIA_NEUTRAL_2
+ } else if (game.flags & F_PRUSSIA_NEUTRAL) {
+ game.flags &= ~F_PRUSSIA_NEUTRAL
+ log("Prussian Neutrality ended.")
+ }
next_sequence_of_play()
}
@@ -5674,6 +5679,7 @@ function goto_annex_silesia() {
game.flags |= F_SILESIA_ANNEXED
game.flags |= F_PRUSSIA_NEUTRAL
+ game.flags |= F_PRUSSIA_NEUTRAL_2
// remove all austrian markers in prussia
for (let s of all_prussian_and_silesian_fortresses) {