summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-05-07 19:55:16 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-24 21:06:18 +0200
commit2b711de811295cdf79b8d8cb4b3be77faa41df15 (patch)
tree55d273c44264352ef5bfe7f506557d0b00bbdc42 /rules.js
parenta35c243e4a11ee2932f83380e337a21ea82be497 (diff)
downloadred-flag-over-paris-2b711de811295cdf79b8d8cb4b3be77faa41df15.tar.gz
Event Prompts.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js49
1 files changed, 40 insertions, 9 deletions
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 ],