summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-08-18 23:53:06 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-18 23:53:06 +0200
commit522e1dc7f325e7f174980a5dcb114e1fa07fd254 (patch)
tree2dc098d9fc05f1d77c7a5551de0df9130805dd0e
parent10f38ec5aac278113f1c91e5dd0a405931828f59 (diff)
downloadred-flag-over-paris-522e1dc7f325e7f174980a5dcb114e1fa07fd254.tar.gz
Fix some "may" events to make momentum changes optional.
-rw-r--r--events.txt10
-rw-r--r--rules.js56
2 files changed, 58 insertions, 8 deletions
diff --git a/events.txt b/events.txt
index 7be3fff..92a07cc 100644
--- a/events.txt
+++ b/events.txt
@@ -231,9 +231,9 @@ CARD 39 - Léon Gambetta
prompt "Replace up to 1 in Institutional."
replace_up_to 1 INSTITUTIONAL
if (game.active === COMMUNE)
- decrease_prussian_collaboration
+ may_decrease_prussian_collaboration
else
- decrease_revolutionary_momentum
+ may_decrease_revolutionary_momentum
endif
CARD 40 - Elihu Washburne
@@ -306,6 +306,7 @@ CARD 45 - Fighting in Issy Village
CARD 46 - Battle of Mont-Valérien
ops 3 FORTS
+ # TODO: may...
if (game.active === COMMUNE)
decrease_prussian_collaboration
else
@@ -346,6 +347,7 @@ CARD 49 - Pius IX
CARD 50 - Socialist International
ops 2 PUBLIC_OPINION
+ # TODO: may...
if (game.active === COMMUNE)
increase_revolutionary_momentum
else
@@ -373,9 +375,9 @@ CARD 52 - Rise of Republicanism
CARD 53 - Legitimacy
ops 3 POLITICAL
if (game.active === COMMUNE)
- increase_revolutionary_momentum
+ may_increase_revolutionary_momentum
else
- increase_prussian_collaboration
+ may_increase_prussian_collaboration
endif
# C3i Censorship Cards
diff --git a/rules.js b/rules.js
index de5f33e..a96cbf3 100644
--- a/rules.js
+++ b/rules.js
@@ -2758,6 +2758,20 @@ function vm_decrease_prussian_collaboration() {
vm_next()
}
+function vm_may_decrease_revolutionary_momentum() {
+ if (game.red_momentum > 0)
+ game.state = "vm_may_decrease_revolutionary_momentum"
+ else
+ vm_next()
+}
+
+function vm_may_decrease_prussian_collaboration() {
+ if (game.blue_momentum > 0)
+ game.state = "vm_may_decrease_prussian_collaboration"
+ else
+ vm_next()
+}
+
function vm_operand_spaces(x) {
let s = vm_operand(x)
if (typeof s === "number")
@@ -2995,6 +3009,40 @@ states.vm_decrease_prussian_collaboration = {
},
}
+states.vm_may_decrease_revolutionary_momentum = {
+ inactive: "decrease Revolutionary Momentum",
+ prompt() {
+ event_prompt("Decrease Revolutionary Momentum.")
+ view.actions.red_momentum = 1
+ view.actions.pass = 1
+ },
+ red_momentum() {
+ push_undo()
+ decrease_revolutionary_momentum()
+ },
+ pass() {
+ push_undo()
+ vm_next()
+ },
+}
+
+states.vm_may_decrease_prussian_collaboration = {
+ inactive: "decrease Prussian Collaboration",
+ prompt() {
+ event_prompt("Decrease Prussian Collaboration.")
+ view.actions.blue_momentum = 1
+ view.actions.pass = 1
+ },
+ blue_momentum() {
+ push_undo()
+ decrease_prussian_collaboration()
+ },
+ pass() {
+ push_undo()
+ vm_next()
+ },
+}
+
function can_vm_place() {
for (let s of game.vm.spaces)
if (can_place_cube(s, game.vm.removed))
@@ -4292,9 +4340,9 @@ CODE[39] = [ // Léon Gambetta
[ vm_prompt, "Replace up to 1 in Institutional." ],
[ vm_replace_up_to, 1, INSTITUTIONAL ],
[ vm_if, ()=>(game.active === COMMUNE) ],
- [ vm_decrease_prussian_collaboration ],
+ [ vm_may_decrease_prussian_collaboration ],
[ vm_else ],
- [ vm_decrease_revolutionary_momentum ],
+ [ vm_may_decrease_revolutionary_momentum ],
[ vm_endif ],
[ vm_return ],
]
@@ -4458,9 +4506,9 @@ CODE[52] = [ // Rise of Republicanism
CODE[53] = [ // Legitimacy
[ vm_ops, 3, POLITICAL ],
[ vm_if, ()=>(game.active === COMMUNE) ],
- [ vm_increase_revolutionary_momentum ],
+ [ vm_may_increase_revolutionary_momentum ],
[ vm_else ],
- [ vm_increase_prussian_collaboration ],
+ [ vm_may_increase_prussian_collaboration ],
[ vm_endif ],
[ vm_return ],
]