summaryrefslogtreecommitdiff
path: root/rules.js
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 /rules.js
parent10f38ec5aac278113f1c91e5dd0a405931828f59 (diff)
downloadred-flag-over-paris-522e1dc7f325e7f174980a5dcb114e1fa07fd254.tar.gz
Fix some "may" events to make momentum changes optional.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js56
1 files changed, 52 insertions, 4 deletions
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 ],
]