summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-05-07 17:51:58 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-24 21:06:18 +0200
commit23576f10dea881fe483287760af97b20666c6d16 (patch)
tree1a31062a1f0e32e629b220500f13c16b8cf4be40
parent2381a17e3af7ea6d2f899568dfae11b7cdf805c7 (diff)
downloadred-flag-over-paris-23576f10dea881fe483287760af97b20666c6d16.tar.gz
Event script source and compiler.
-rw-r--r--events.txt306
-rw-r--r--tools/gencode.js62
2 files changed, 368 insertions, 0 deletions
diff --git a/events.txt b/events.txt
new file mode 100644
index 0000000..1d1446f
--- /dev/null
+++ b/events.txt
@@ -0,0 +1,306 @@
+# Note - must AND/OR take at least one of the choices?
+
+# Versailles Cards
+
+CARD 1 - Jules Ducatel
+ if (game.round === 4)
+ goto "reveal_commune_hand"
+ else
+ goto "reveal_commune_objective"
+ endif
+ ops 1 MILITARY
+
+CARD 2 - The Murder of Vincenzini
+ increase_revolutionary_momentum
+ remove_up_to 3 POLITICAL
+
+CARD 3 - Brassardiers
+ replace 1 (where_present(MILITARY))
+
+CARD 4 - Jules Ferry
+ switch ["place","replace"]
+ case "place"
+ place_up_to 2 REPUBLICANS
+ case "replace"
+ replace 1 NATIONAL_ASSEMBLY
+ endswitch
+
+CARD 5 - Le Figaro
+ switch ["place","replace"]
+ case "place"
+ place_up_to 2 PRESS
+ case "replace"
+ replace 1 PUBLIC_OPINION
+ endswitch
+
+CARD 6 - Général Louis Valentin
+ # remove_different_up_to 2 (where_present(PARIS))
+ goto "general_louis_valentin"
+
+CARD 7 - Général Espivent
+ remove_up_to 2 SOCIAL_MOVEMENTS
+
+CARD 8 - Les Amis de l'Ordre
+ place 2 PARIS
+
+CARD 9 - Socialist Newspaper Ban
+ increase_revolutionary_momentum
+ remove_up_to 2 PRESS
+ # forbid Le Reveil from being played
+ asm game.snb=1
+
+CARD 10 - Fortification of Mont-Valérien
+ place_up_to 1 MONT_VALERIEN
+ if (is_control(MONT_VALERIEN))
+ may_place_disc MONT_VALERIEN
+ endif
+
+CARD 11 - Adolphe Thiers
+ increase_prussian_collaboration
+ place_up_to 2 ROYALISTS
+
+CARD 12 - Otto von Bismarck
+ # must remove own cube from National Assembly
+ remove_own NATIONAL_ASSEMBLY
+ increase_prussian_collaboration
+ ops 2 MILITARY
+
+CARD 13 - Général Ernest de Cissey
+ ops 4 FORT_D_ISSY
+
+CARD 14 - Colonel de Lochner
+ switch ["mont_valerien","butte_montmartre"]
+ case "mont_valerien"
+ ops 3 MONT_VALERIEN
+ case "butte_montmartre"
+ ops 3 BUTTE_MONTMARTRE
+ endswitch
+
+CARD 15 - Jules Favre
+ increase_prussian_collaboration
+ place_up_to 1 REPUBLICANS
+
+CARD 16 - Hostage Decree
+ remove 20 CATHOLIC_CHURCH
+
+CARD 17 - Maréchal Macmahon
+ ops 4 PARIS
+
+# Commune Cards
+
+CARD 18 - Paule Minck
+ replace 1 (where_present(MILITARY))
+
+CARD 19 - Walery Wroblewski
+ # NOTE: exact
+ place_disc (where_present(PARIS))
+
+CARD 20 - Banque de France
+ decrease_revolutionary_momentum
+ place_up_to 1 PARIS
+ may_place_disc PARIS
+
+CARD 21 - Le Réveil
+ # must not have played Socialist Newspaper Ban
+ increase_revolutionary_momentum
+ place_up_to 1 PRESS
+
+CARD 22 - Execution of Generals
+ increase_prussian_collaboration
+ replace_up_to 2 (where_present(PARIS))
+
+CARD 23 - Les Cantinières
+ place_removed_up_to 2 (where_present(MILITARY))
+
+CARD 24 - Eugène Protot
+ ops 3 INSTITUTIONAL
+
+CARD 25 - Paul Cluseret
+ ops 2 PARIS
+
+CARD 26 - Gaston Crémieux
+ increase_revolutionary_momentum
+ place_up_to 2 SOCIAL_MOVEMENTS
+
+CARD 27 - Luise Michel
+ increase_revolutionary_momentum
+ switch ["public_opinion","paris"]
+ case "public_opinion"
+ ops 1 PUBLIC_OPINION
+ case "paris"
+ ops 1 PARIS
+ endswitch
+
+CARD 28 - Jaroslav Dombrowski
+ place_up_to 1 PARIS
+ may_place_disc PARIS
+
+CARD 29 - Raoul Rigault
+ increase_revolutionary_momentum
+ move_up_to 2 CATHOLIC_CHURCH PARIS
+
+CARD 30 - Karl Marx
+ goto "karl_marx"
+
+CARD 31 - Blanquists
+ increase_revolutionary_momentum
+ ops 2 MILITARY
+
+CARD 32 - Général Lullier
+ ops 4 CHATEAU_DE_VINCENNES
+
+CARD 33 - Jules Vallès
+ increase_revolutionary_momentum
+ ops 2 PUBLIC_OPINION
+
+CARD 34 - Charles Delescluze
+ switch ["military","political"]
+ case "military"
+ ops 3 MILITARY
+ case "political"
+ ops 3 POLITICAL
+ endswitch
+
+# Neutral Cards
+
+CARD 35 - Conciliation
+ move_between_up_to 2 PUBLIC_OPINION PARIS
+
+CARD 36 - Georges Clemenceau
+ move_up_to 3 PARIS INSTITUTIONAL
+
+CARD 37 - Archbishop Georges Darboy
+ move_up_to 4 ANY CATHOLIC_CHURCH
+
+CARD 38 - Victor Hugo
+ # must have initiative
+ # must decrease both player momentums
+ decrease_revolutionary_momentum
+ decrease_prussian_collaboration
+ ops 4 PUBLIC_OPINION
+
+CARD 39 - Léon Gambetta
+ # must have initiative
+ replace_up_to 1 INSTITUTIONAL
+ if (game.active === COMMUNE)
+ decrease_prussian_collaboration
+ else
+ decrease_revolutionary_momentum
+ endif
+
+CARD 40 - Elihu Washburne
+ # must have initiative
+ if (game.active === COMMUNE)
+ increase_revolutionary_momentum
+ else
+ increase_prussian_collaboration
+ endif
+ ops 2 INSTITUTIONAL
+
+CARD 41 - Freemason Parade
+ # must have initiative
+ goto "freemason_parade"
+ switch ["place","replace"]
+ case "place"
+ place_up_to 2 INSTITUTIONAL
+ case "replace"
+ replace 1 INSTITUTIONAL
+ endswitch
+
+# Objective Cards
+
+CARD 42 - Paris Cannons
+ switch ["momentum","ops"]
+ case "momentum"
+ if (game.active === COMMUNE)
+ increase_revolutionary_momentum
+ else
+ increase_prussian_collaboration
+ endif
+ case "ops"
+ ops 3 PARIS
+ endswitch
+
+CARD 43 - Aux Barricades!
+ ops 2 PARIS
+ player COMMUNE
+ may_place_disc BUTTE_AUX_CAILLES
+
+CARD 44 - Commune's Stronghold
+ switch ["ops","remove"]
+ case "ops"
+ ops 2 MILITARY
+ case "remove"
+ remove 1 ANY
+ endswitch
+
+CARD 45 - Fighting in Issy Village
+ ops 2 FORTS
+ player VERSAILLES
+ may_place_disc FORT_D_ISSY
+
+CARD 46 - Battle of Mont-Valérien
+ ops 3 FORTS
+ if (game.current === COMMUNE)
+ decrease_prussian_collaboration
+ else
+ increase_prussian_collaboration
+ endif
+
+CARD 47 - Raid on Château de Vincennes
+ switch ["ops","remove"]
+ case "ops"
+ ops 2 MILITARY
+ case "remove"
+ remove 1 ANY
+ endswitch
+
+CARD 48 - Revolution in the Press
+ switch ["ops","replace"]
+ case "ops"
+ ops 3 PUBLIC_OPINION
+ case "replace"
+ replace 1 ANY
+ endswitch
+
+CARD 49 - Pius IX
+ switch ["replace","remove"]
+ case "replace"
+ # SPECIAL
+ replace_different 2 POLITICAL
+ case "remove"
+ remove 1 ANY
+ endswitch
+
+CARD 50 - Socialist International
+ ops 2 PUBLIC_OPINION
+ if (game.current === COMMUNE)
+ increase_revolutionary_momentum
+ else
+ decrease_revolutionary_momentum
+ endif
+
+CARD 51 - Royalists Dissension
+ switch ["ops","remove"]
+ case "ops"
+ ops 2 INSTITUTIONAL
+ case "remove"
+ remove 1 ANY
+ endswitch
+
+CARD 52 - Rise of Republicanism
+ switch ["ops","replace"]
+ case "ops"
+ ops 3 INSTITUTIONAL
+ case "replace"
+ replace 1 MILITARY
+ endswitch
+
+CARD 53 - Legitimacy
+ ops 3 POLITICAL
+ if (game.active === COMMUNE)
+ increase_revolutionary_momentum
+ else
+ increase_prussian_collaboration
+ endif
+
diff --git a/tools/gencode.js b/tools/gencode.js
new file mode 100644
index 0000000..90215d5
--- /dev/null
+++ b/tools/gencode.js
@@ -0,0 +1,62 @@
+"use strict"
+
+let fs = require("fs")
+
+let pc = 0
+let CODE = Array(54).fill(0)
+
+function emit(line) {
+ ++pc
+ line[0] = "vm_" + line[0]
+ for (let i = 1; i < line.length; ++i) {
+ if (typeof line[i] === "string") {
+ if (line[i] === "all")
+ line[i] = 999
+ if (line[i][0] === "(" && !line[i].match(/\)=>/))
+ line[i] = "()=>" + line[i]
+ if (line[i][0] === "`")
+ line[i] = "()=>" + line[i]
+ }
+ }
+ console.log("\t[ " + line.join(", ") + " ],")
+}
+
+console.log("const CODE = []")
+let first = false
+
+for (let line of fs.readFileSync("events.txt", "utf-8").split("\n")) {
+ line = line.trim()
+ if (line.length === 0 || line[0] === "#")
+ continue
+ if (line === "EOF")
+ break
+ line = line.split(" ")
+ switch (line[0]) {
+ case "CARD":
+ if (first++) {
+ emit(["return"])
+ console.log("]")
+ }
+ console.log("")
+ console.log("CODE[" + line[1] + "] = [ // " + line.slice(3).join(" "))
+ break
+
+ case "log":
+ case "prompt":
+ emit([ line[0], line.slice(1).join(" ") ])
+ break
+
+ case "asm":
+ case "if":
+ case "while":
+ emit([ line[0], "()=>" + line.slice(1).join(" ") ])
+ break
+
+ default:
+ emit(line)
+ break
+ }
+}
+
+emit(["return"])
+console.log("]")