From d56fa60b74f7c0606653c10d5cd6850bfdd453ba Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 13 May 2023 01:50:11 +0200 Subject: Advance momentum a two-step process. --- rules.js | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'rules.js') 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 ], ] -- cgit v1.2.3