summaryrefslogtreecommitdiff
path: root/tools/gendata.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gendata.js')
-rw-r--r--tools/gendata.js488
1 files changed, 488 insertions, 0 deletions
diff --git a/tools/gendata.js b/tools/gendata.js
new file mode 100644
index 0000000..72379ec
--- /dev/null
+++ b/tools/gendata.js
@@ -0,0 +1,488 @@
+"use strict"
+
+const fs = require("fs")
+
+let data = JSON.parse(fs.readFileSync("tools/data.json", "utf-8"))
+
+function make_index_from_list(list) {
+ let map = {}
+ for (let i = 0; i < list.length; ++i)
+ map[list[i]] = i
+ return map
+}
+
+/* GENERALS */
+
+data.generals = [
+ { name: "Arnold", owner: "American", strategy: 1, battle: 3, agility: 2, bonus: false },
+ { name: "Gates", owner: "American", strategy: 2, battle: 2, agility: 1, bonus: false },
+ { name: "Greene", owner: "American", strategy: 1, battle: 4, agility: 2, bonus: true },
+ { name: "Lafayette", owner: "American", strategy: 1, battle: 2, agility: 1, bonus: false },
+ { name: "Lee", owner: "American", strategy: 2, battle: 1, agility: 1, bonus: false },
+ { name: "Lincoln", owner: "American", strategy: 2, battle: 1, agility: 1, bonus: false },
+ { name: "Washington", owner: "American", strategy: 1, battle: 5, agility: 2, bonus: true },
+
+ { name: "Rochambeau", owner: "French", strategy: 2, battle: 4, agility: 2, bonus: false },
+
+ { name: "Burgoyne", owner: "British", strategy: 2, battle: 2, agility: 1, bonus: false },
+ { name: "Carleton", owner: "British", strategy: 3, battle: 3, agility: 2, bonus: false },
+ { name: "Clinton", owner: "British", strategy: 3, battle: 4, agility: 2, bonus: false },
+ { name: "Cornwallis", owner: "British", strategy: 2, battle: 4, agility: 2, bonus: false },
+ { name: "Howe", owner: "British", strategy: 3, battle: 6, agility: 3, bonus: false },
+]
+
+data.general_index = make_index_from_list(data.generals.map(x=>x.name))
+
+/* COLONIES */
+
+data.colony_name = [ "Canada", "NH", "NY", "MA", "CT", "RI", "PA", "NJ", "MD", "DE", "VA", "NC", "SC", "GA" ]
+
+const Canada = 0
+const NH = 1
+const NY = 2
+const MA = 3
+const CT = 4
+const RI = 5
+const PA = 6
+const NJ = 7
+const MD = 8
+const DE = 9
+const VA = 10
+const NC = 11
+const SC = 12
+const GA = 13
+
+/* CARDS */
+
+const CARD_3_OPS = { title: "3 OPS", type: "ops", count: 3 }
+const CARD_2_OPS = { title: "2 OPS", type: "ops", count: 2 }
+const CARD_1_OPS = { title: "1 OPS", type: "ops", count: 1 }
+
+data.cards = [
+ null,
+
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+ CARD_3_OPS,
+
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+ CARD_2_OPS,
+
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+ CARD_1_OPS,
+
+ /* 67 */
+ {
+ title: "Minor Campaign",
+ type: "campaign",
+ count: 2,
+ },
+
+ /* 68 */
+ {
+ title: "Minor Campaign",
+ type: "campaign",
+ count: 2,
+ },
+
+ /* 69 */
+ {
+ title: "Minor Campaign",
+ type: "campaign",
+ count: 2,
+ },
+
+ /* 70 */
+ {
+ title: "Major Campaign",
+ type: "campaign",
+ count: 3,
+ },
+
+ /* 71 */
+ {
+ full_title: "North's Government Falls - The War Ends in 1779",
+ title: "The War Ends in 1779",
+ type: "mandatory-event",
+ event: "the_war_ends",
+ year: 1779,
+ },
+
+ /* 72 */
+ {
+ full_title: "North's Government Falls - The War Ends in 1780",
+ title: "The War Ends in 1780",
+ type: "mandatory-event",
+ event: "the_war_ends",
+ year: 1780,
+ },
+
+ /* 73 */
+ {
+ full_title: "North's Government Falls - The War Ends in 1781",
+ title: "The War Ends in 1781",
+ type: "mandatory-event",
+ event: "the_war_ends",
+ year: 1781,
+ },
+
+ /* 74 */
+ {
+ full_title: "North's Government Falls - The War Ends in 1782",
+ title: "The War Ends in 1782",
+ type: "mandatory-event",
+ event: "the_war_ends",
+ year: 1782,
+ },
+
+ /* 75 */
+ {
+ full_title: "North's Government Falls - The War Ends in 1783",
+ title: "The War Ends in 1783",
+ type: "mandatory-event",
+ event: "the_war_ends",
+ year: 1783,
+ },
+
+ /* 76 */
+ {
+ title: "Henry Know Continental Artillery Commander",
+ type: "american-battle",
+ },
+
+ /* 77 */
+ {
+ title: "Jane McCrea Indian Atrocity Sparks Outrage",
+ type: "american-event",
+ event: "place_american_pc",
+ count: 2,
+ once: true,
+ },
+
+ /* 78 */
+ {
+ title: "Iroquois Uprising!",
+ type: "british-event",
+ event: "remove_american_pc_from_non_port",
+ where: [ NH, NY, PA ],
+ count: 2,
+ },
+
+ /* 79 */
+ {
+ title: "Joseph Brant Leads an Iroquois Raid",
+ type: "british-event",
+ event: "remove_american_pc_from_non_port",
+ where: [ NH, NY, PA ],
+ count: 2,
+ },
+
+ /* 80 */
+ {
+ title: "Lt. Colonel Simcoe's Queen's Rangers",
+ type: "british-event",
+ event: "remove_american_pc_within_two_spaces_of_a_british_general",
+ count: 2,
+ },
+
+ /* 81 */
+ {
+ title: "D'Estaing Sails for the Caribbean",
+ type: "british-event",
+ when: "after_french_alliance",
+ event: "remove_french_navy",
+ },
+
+ /* 82 */
+ {
+ title: "Banastre Tarleton's Waxhaws Massacre",
+ type: "british-event-or-battle",
+ event: "remove_american_cu",
+ },
+
+ /* 83 */
+ {
+ title: "Lord George Germaine Offers Royal Amnesty",
+ type: "british-event",
+ event: "remove_american_pc",
+ count: 2,
+ },
+
+ /* 84 */
+ {
+ title: "George Rogers Clark Leads a Western Offensive",
+ type: "american-event",
+ event: "remove_random_british_card",
+ },
+
+ /* 85 */
+ {
+ title: "Don Bernardo Galvez Captures Pensacola",
+ type: "american-event",
+ when: "european_war_in_effect",
+ event: "remove_british_cu",
+ count: 2,
+ },
+
+ /* 86 */
+ {
+ title: "Baron von Steuben Trains the Continental Army",
+ type: "american-event",
+ event: "baron_von_steuben_trains_the_continental_army",
+ },
+
+ /* 87 */
+ {
+ title: "Lord North Offers a Royal Amnesty",
+ type: "british-event",
+ event: "remove_american_pc",
+ count: 4,
+ once: true,
+ },
+
+ /* 88 */
+ {
+ title: "The Swamp Fox, Francis Marion",
+ type: "american-event",
+ event: "remove_british_pc_from",
+ where: [ NC, SC, GA ],
+ count: 2,
+ },
+
+ /* 89 */
+ {
+ title: "The Gamecock: Thomas Sumter",
+ type: "american-event",
+ event: "remove_british_pc_from",
+ where: [ NC, SC, GA ],
+ count: 2,
+ },
+
+ /* 90 */
+ {
+ title: "Josiah Martin Rallies North Carolina Loyalists",
+ type: "british-event",
+ event: "remove_american_pc_from",
+ where: [ NC ],
+ count: 2,
+ },
+
+ /* 91 */
+ {
+ title: 'Thomas Paine Publishes Pamphlets "Common Sense" and "The American Crisis"',
+ type: "american-event",
+ event: "place_american_pc_in",
+ where: [ NH, NY, MA, CT, RI, PA, NJ, MD, DE, VA, NC, SC, GA ],
+ count: 3,
+ once: true,
+ },
+
+ /* 92 */
+ {
+ title: "Nathan Hale, American Martyr",
+ type: "american-event",
+ event: "place_american_pc",
+ count: 2,
+ once: true,
+ },
+
+ /* 93 */
+ {
+ title: "John Glover's Marblehead Regiment",
+ type: "american-event",
+ event: "john_glovers_marblehead_regiment",
+ },
+
+ /* 94 */
+ {
+ title: "Pennsylvania and New Jersey Line Mutinies",
+ type: "british-event",
+ event: "pennsylvania_and_new_jersey_line_mutinies",
+ },
+
+ /* 95 */
+ {
+ title: "William Pitt Urges Peace Talks",
+ type: "british-event",
+ when: "before_french_alliance",
+ event: "remove_american_pc",
+ count: 2,
+ reshuffle: "if_played",
+ },
+
+ /* 96 */
+ {
+ title: "Hortelez et Cie: Clandestine French and Spanish Aid",
+ type: "american-event",
+ when: "before_french_alliance",
+ event: "advance_french_alliance",
+ reshuffle: "if_discarded",
+ count: 2,
+ },
+
+ /* 97 */
+ {
+ title: "Admiral Suffren Wins a Naval Victory",
+ type: "american-event",
+ when: "after_french_alliance",
+ event: "remove_random_british_card",
+ },
+
+ /* 98 */
+ {
+ title: '"Mad" Anthony Wayne',
+ type: "american-battle",
+ },
+
+ /* 99 */
+ {
+ title: "Declaration of Independence",
+ type: "mandatory-event",
+ event: "declaration_of_independence",
+ once: true,
+ reshuffle: "if_played",
+ tournament: true,
+ },
+
+ /* 100 */
+ {
+ title: "Benedict Arnold's Treason Undermines the Patriot Cause",
+ type: "british-battle",
+ event: "remove_benedict_arnold",
+ once: true,
+ },
+
+ /* 101 */
+ {
+ title: "Benjamin Franklin: Minister to France",
+ type: "mandatory-event",
+ event: "advance_french_alliance",
+ count: 4,
+ once: true,
+ tournament: true,
+ },
+
+ /* 102 */
+ {
+ title: "Admiral Rodney Captures St. Eustatius",
+ type: "british-event",
+ event: "remove_random_american_card",
+ when: "european_war_in_effect",
+ once: true,
+ },
+
+ /* 103 */
+ {
+ title: "Thaddeus Kosciuszco Constructs Engineering Works",
+ type: "american-battle",
+ },
+
+ /* 104 */
+ {
+ title: "Light Horse Harry Lee",
+ type: "american-battle",
+ },
+
+ /* 105 */
+ {
+ title: "Morgan's Riflemen",
+ type: "american-battle",
+ },
+
+ /* 106 */
+ {
+ title: "John Paul Jones' Shipping Raids",
+ type: "american-event",
+ event: "remove_random_british_card",
+ },
+
+ /* 107 */
+ {
+ title: "British Light Infantry",
+ type: "british-battle",
+ },
+
+ /* 108 */
+ {
+ title: "Lord Sandwich Coastal Raids",
+ type: "british-event",
+ event: "lord_sandwich_coastal_raids",
+ },
+
+ /* 109 */
+ {
+ title: "Edward Bancroft, British Double Agent",
+ type: "british-event",
+ event: "remove_random_american_card",
+ },
+
+ /* 110 */
+ {
+ title: "Hessian Infantry Bayonet Charge",
+ type: "british-battle",
+ },
+]
+
+/* OUTPUT */
+
+console.log("const data = " + JSON.stringify(data,0,'\t'))
+console.log("if (typeof module === 'object') module.exports = data")