From 2b711de811295cdf79b8d8cb4b3be77faa41df15 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 7 May 2023 19:55:16 +0200 Subject: Event Prompts. --- events.txt | 24 ++++++++++++++++++++++-- rules.js | 49 ++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/events.txt b/events.txt index 75a61b1..6ffdc66 100644 --- a/events.txt +++ b/events.txt @@ -18,6 +18,7 @@ CARD 3 - Brassardiers replace 1 (where_present(MILITARY)) CARD 4 - Jules Ferry + prompt "Place up to 2 in Republicans or replace 1 in National Assembly." switch ["place","replace"] case "place" place_up_to 2 REPUBLICANS @@ -26,6 +27,7 @@ CARD 4 - Jules Ferry endswitch CARD 5 - Le Figaro + prompt "Place up to 2 in Press or replace 1 in Public Opinion." switch ["place","replace"] case "place" place_up_to 2 PRESS @@ -70,6 +72,7 @@ CARD 13 - Général Ernest de Cissey CARD 14 - Colonel de Lochner if (is_versailles_control(MONT_VALERIEN)) + prompt "Use 3 Operation Points in Mont-Valérien or Butte Montmartre." switch ["mont_valerien","butte_montmartre"] case "mont_valerien" ops 3 MONT_VALERIEN @@ -128,6 +131,7 @@ CARD 26 - Gaston Crémieux CARD 27 - Luise Michel increase_revolutionary_momentum + prompt "Use 1 Operations Point in Public Opinion or Paris." switch ["public_opinion","paris"] case "public_opinion" ops 1 PUBLIC_OPINION @@ -158,17 +162,25 @@ CARD 33 - Jules Vallès ops 2 PUBLIC_OPINION CARD 34 - Charles Delescluze + prompt "Use 3 Operations Point in Military or 1 in Political." switch ["military","political"] case "military" ops 3 MILITARY case "political" - ops 3 POLITICAL + ops 1 POLITICAL endswitch # Neutral Cards CARD 35 - Conciliation - move_between_up_to 2 PUBLIC_OPINION PARIS + # move_between_up_to 2 PUBLIC_OPINION PARIS + prompt "Move up to 2 from Public Opinion or Paris to the other." + switch ["public_opinion","paris"] + case "public_opinion" + move_up_to 2 PUBLIC_OPINION PARIS + case "paris" + move_up_to 2 PARIS PUBLIC_OPINION + endswitch CARD 36 - Georges Clemenceau move_up_to 3 PARIS INSTITUTIONAL @@ -204,6 +216,7 @@ CARD 40 - Elihu Washburne CARD 41 - Freemason Parade # must have initiative goto "freemason_parade" + prompt "Place up to 2 or replace 1 in Institutional." switch ["place","replace"] case "place" place_up_to 2 INSTITUTIONAL @@ -214,6 +227,7 @@ CARD 41 - Freemason Parade # Objective Cards CARD 42 - Paris Cannons + prompt "Use 3 Operations Points in Paris or increase your Player Momentum." switch ["momentum","ops"] case "momentum" if (game.active === COMMUNE) @@ -231,6 +245,7 @@ CARD 43 - Aux Barricades! may_place_disc BUTTE_AUX_CAILLES CARD 44 - Commune's Stronghold + prompt "Use 2 Operations Points in Military or remove 1 from any space." switch ["ops","remove"] case "ops" ops 2 MILITARY @@ -252,6 +267,7 @@ CARD 46 - Battle of Mont-Valérien endif CARD 47 - Raid on Château de Vincennes + prompt "Use 2 Operations Points in Military or remove 1 from any space." switch ["ops","remove"] case "ops" ops 2 MILITARY @@ -260,6 +276,7 @@ CARD 47 - Raid on Château de Vincennes endswitch CARD 48 - Revolution in the Press + prompt "Use 3 Operations Points in Public Opinion or replace 1 in any space." switch ["ops","replace"] case "ops" ops 3 PUBLIC_OPINION @@ -268,6 +285,7 @@ CARD 48 - Revolution in the Press endswitch CARD 49 - Pius IX + prompt "Replace in 2 differet Political or remove 1 from any space." switch ["replace","remove"] case "replace" # SPECIAL @@ -285,6 +303,7 @@ CARD 50 - Socialist International endif CARD 51 - Royalists Dissension + prompt "Use 2 Operations Points in Institutional or remove 1 from any space." switch ["ops","remove"] case "ops" ops 2 INSTITUTIONAL @@ -293,6 +312,7 @@ CARD 51 - Royalists Dissension endswitch CARD 52 - Rise of Republicanism + prompt "Use 3 Operations Points in Institutional or replace 1 in Military." switch ["ops","replace"] case "ops" ops 3 INSTITUTIONAL diff --git a/rules.js b/rules.js index 1b4cb65..1c58754 100644 --- a/rules.js +++ b/rules.js @@ -1,6 +1,9 @@ "use strict" -// TODO: no card menu +// TODO: clean up push/clear_undo +// TODO: clean up prompts +// TODO: event prompts +// TODO: add logging const COMMUNE = "Commune"; const VERSAILLES = "Versailles"; @@ -2023,6 +2026,11 @@ function vm_asm() { vm_next() } +function vm_prompt() { + game.vm.prompt = game.vm.ip + vm_next() +} + function vm_goto() { game.state = vm_operand(1) } @@ -2554,12 +2562,16 @@ states.vm_move_between = { for_each_friendly_cube(s, gen_action_piece) } else { game.selected_cube = game.who - for (let s of game.vm.a) - if (s !== game.pieces[game.who] && count_friendly_cubes(s) < 4) - gen_action_space(s) - for (let s of game.vm.b) - if (s !== game.pieces[game.who] && count_friendly_cubes(s) < 4) - gen_action_space(s) + let from = game.pieces[game.who] + if (game.vm.a.includes(from)) { + for (let s of game.vm.b) + if (count_friendly_cubes(s) < 4) + gen_action_space(s) + } else { + for (let s of game.vm.a) + if (count_friendly_cubes(s) < 4) + gen_action_space(s) + } } }, piece(p) { @@ -3158,6 +3170,7 @@ CODE[3] = [ // Brassardiers ] CODE[4] = [ // Jules Ferry + [ vm_prompt, "Place up to 2 in Republicans or replace 1 in National Assembly." ], [ vm_switch, ["place","replace"] ], [ vm_case, "place" ], [ vm_place_up_to, 2, REPUBLICANS ], @@ -3168,6 +3181,7 @@ CODE[4] = [ // Jules Ferry ] CODE[5] = [ // Le Figaro + [ vm_prompt, "Place up to 2 in Press or replace 1 in Public Opinion." ], [ vm_switch, ["place","replace"] ], [ vm_case, "place" ], [ vm_place_up_to, 2, PRESS ], @@ -3227,6 +3241,7 @@ CODE[13] = [ // Général Ernest de Cissey CODE[14] = [ // Colonel de Lochner [ vm_if, ()=>(is_versailles_control(MONT_VALERIEN)) ], + [ vm_prompt, "Use 3 Operation Points in Mont-Valérien or Butte Montmartre." ], [ vm_switch, ["mont_valerien","butte_montmartre"] ], [ vm_case, "mont_valerien" ], [ vm_ops, 3, MONT_VALERIEN ], @@ -3307,6 +3322,7 @@ CODE[26] = [ // Gaston Crémieux CODE[27] = [ // Luise Michel [ vm_increase_revolutionary_momentum ], + [ vm_prompt, "Use 1 Operations Point in Public Opinion or Paris." ], [ vm_switch, ["public_opinion","paris"] ], [ vm_case, "public_opinion" ], [ vm_ops, 1, PUBLIC_OPINION ], @@ -3351,17 +3367,24 @@ CODE[33] = [ // Jules Vallès ] CODE[34] = [ // Charles Delescluze + [ vm_prompt, "Use 3 Operations Point in Military or 1 in Political." ], [ vm_switch, ["military","political"] ], [ vm_case, "military" ], [ vm_ops, 3, MILITARY ], [ vm_case, "political" ], - [ vm_ops, 3, POLITICAL ], + [ vm_ops, 1, POLITICAL ], [ vm_endswitch ], [ vm_return ], ] CODE[35] = [ // Conciliation - [ vm_move_between_up_to, 2, PUBLIC_OPINION, PARIS ], + [ vm_prompt, "Move up to 2 from Public Opinion or Paris to the other." ], + [ vm_switch, ["public_opinion","paris"] ], + [ vm_case, "public_opinion" ], + [ vm_move_up_to, 2, PUBLIC_OPINION, PARIS ], + [ vm_case, "paris" ], + [ vm_move_up_to, 2, PARIS, PUBLIC_OPINION ], + [ vm_endswitch ], [ vm_return ], ] @@ -3404,6 +3427,7 @@ CODE[40] = [ // Elihu Washburne CODE[41] = [ // Freemason Parade [ vm_goto, "freemason_parade" ], + [ vm_prompt, "Place up to 2 or replace 1 in Institutional." ], [ vm_switch, ["place","replace"] ], [ vm_case, "place" ], [ vm_place_up_to, 2, INSTITUTIONAL ], @@ -3414,6 +3438,7 @@ CODE[41] = [ // Freemason Parade ] CODE[42] = [ // Paris Cannons + [ vm_prompt, "Use 3 Operations Points in Paris or increase your Player Momentum." ], [ vm_switch, ["momentum","ops"] ], [ vm_case, "momentum" ], [ vm_if, ()=>(game.active === COMMUNE) ], @@ -3435,6 +3460,7 @@ CODE[43] = [ // Aux Barricades! ] CODE[44] = [ // Commune's Stronghold + [ vm_prompt, "Use 2 Operations Points in Military or remove 1 from any space." ], [ vm_switch, ["ops","remove"] ], [ vm_case, "ops" ], [ vm_ops, 2, MILITARY ], @@ -3462,6 +3488,7 @@ CODE[46] = [ // Battle of Mont-Valérien ] CODE[47] = [ // Raid on Château de Vincennes + [ vm_prompt, "Use 2 Operations Points in Military or remove 1 from any space." ], [ vm_switch, ["ops","remove"] ], [ vm_case, "ops" ], [ vm_ops, 2, MILITARY ], @@ -3472,6 +3499,7 @@ CODE[47] = [ // Raid on Château de Vincennes ] CODE[48] = [ // Revolution in the Press + [ vm_prompt, "Use 3 Operations Points in Public Opinion or replace 1 in any space." ], [ vm_switch, ["ops","replace"] ], [ vm_case, "ops" ], [ vm_ops, 3, PUBLIC_OPINION ], @@ -3482,6 +3510,7 @@ CODE[48] = [ // Revolution in the Press ] CODE[49] = [ // Pius IX + [ vm_prompt, "Replace in 2 differet Political or remove 1 from any space." ], [ vm_switch, ["replace","remove"] ], [ vm_case, "replace" ], [ vm_replace_different, 2, POLITICAL ], @@ -3502,6 +3531,7 @@ CODE[50] = [ // Socialist International ] CODE[51] = [ // Royalists Dissension + [ vm_prompt, "Use 2 Operations Points in Institutional or remove 1 from any space." ], [ vm_switch, ["ops","remove"] ], [ vm_case, "ops" ], [ vm_ops, 2, INSTITUTIONAL ], @@ -3512,6 +3542,7 @@ CODE[51] = [ // Royalists Dissension ] CODE[52] = [ // Rise of Republicanism + [ vm_prompt, "Use 3 Operations Points in Institutional or replace 1 in Military." ], [ vm_switch, ["ops","replace"] ], [ vm_case, "ops" ], [ vm_ops, 3, INSTITUTIONAL ], -- cgit v1.2.3