summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-05-13 01:50:11 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-24 21:06:18 +0200
commitd56fa60b74f7c0606653c10d5cd6850bfdd453ba (patch)
tree7a91a6a653de0cdec10beca6e76d0af9fa85d149
parentc0acefc3616e93c0dad36c9e5bdbe4bf77d97ea3 (diff)
downloadred-flag-over-paris-d56fa60b74f7c0606653c10d5cd6850bfdd453ba.tar.gz
Advance momentum a two-step process.
-rw-r--r--events.txt1
-rw-r--r--rules.js44
2 files changed, 43 insertions, 2 deletions
diff --git a/events.txt b/events.txt
index 467a655..f2e9e3a 100644
--- a/events.txt
+++ b/events.txt
@@ -104,6 +104,7 @@ CARD 14 - Colonel de Lochner
CARD 15 - Jules Favre
increase_prussian_collaboration
+ prompt "Place up to 1 in Republicans"
place_up_to 1 REPUBLICANS
CARD 16 - Hostage Decree
diff --git a/rules.js b/rules.js
index c373642..68c47a4 100644
--- a/rules.js
+++ b/rules.js
@@ -1129,10 +1129,12 @@ states.play_card = {
discard_card(game.what)
if (game.active === COMMUNE) {
log(`Played C${game.what} for Revolutionary Momentum.`)
- advance_revolutionary_momentum(1)
+ advance_revolutionary_momentum1(1)
+ game.state = "advance_revolutionary_momentum_done"
} else {
log(`Played C${game.what} for Prussian Collaboration.`)
- advance_prussian_collaboration(1)
+ advance_prussian_collaboration1(1)
+ game.state = "advance_prussian_collaboration_done"
}
},
red_momentum() {
@@ -1143,6 +1145,26 @@ states.play_card = {
},
}
+states.advance_revolutionary_momentum_done = {
+ prompt() {
+ view.prompt = card_names[game.what] + ": All done."
+ view.actions.done = 1
+ },
+ done() {
+ advance_revolutionary_momentum2(1)
+ },
+}
+
+states.advance_prussian_collaboration_done = {
+ prompt() {
+ view.prompt = card_names[game.what] + ": All done."
+ view.actions.done = 1
+ },
+ done() {
+ advance_prussian_collaboration2(1)
+ },
+}
+
states.play_discard = {
prompt() {
view.prompt = card_names[game.what] + ": Discard a card."
@@ -1203,9 +1225,17 @@ function discard_final() {
// === PLAYER MOMENTUM TRACKS ===
function advance_revolutionary_momentum(x) {
+ advance_revolutionary_momentum1(x)
+ advance_revolutionary_momentum2(x)
+}
+
+function advance_revolutionary_momentum1(x) {
game.red_momentum += x
for (let i = game.red_momentum; i < 3; ++i)
for_each_commune_cube(RED_CUBE_POOL[i], remove_piece_from_play)
+}
+
+function advance_revolutionary_momentum2(x) {
game.momentum_active = game.active
game.active = VERSAILLES
if (x > 0 && game.red_momentum >= 2 && can_place_cube_in_any(INSTITUTIONAL))
@@ -1215,9 +1245,17 @@ function advance_revolutionary_momentum(x) {
}
function advance_prussian_collaboration(x) {
+ advance_prussian_collaboration1(x)
+ advance_prussian_collaboration2(x)
+}
+
+function advance_prussian_collaboration1(x) {
game.blue_momentum += x
for (let i = 0; i < game.blue_momentum; ++i)
for_each_versailles_cube(PRUSSIAN_COLLABORATION[i], remove_piece)
+}
+
+function advance_prussian_collaboration2(x) {
game.momentum_active = game.active
game.active = COMMUNE
if (x > 0 && game.blue_momentum >= 2 && can_place_cube_in_any(PUBLIC_OPINION))
@@ -2138,6 +2176,7 @@ function vm_return() {
states.vm_return = {
prompt() {
event_prompt("All done.")
+ // TODO: or end_event ?
view.actions.done = 1
},
done() {
@@ -3362,6 +3401,7 @@ CODE[14] = [ // Colonel de Lochner
CODE[15] = [ // Jules Favre
[ vm_increase_prussian_collaboration ],
+ [ vm_prompt, "Place up to 1 in Republicans" ],
[ vm_place_up_to, 1, REPUBLICANS ],
[ vm_return ],
]