diff options
-rw-r--r-- | data.js | 2 | ||||
-rw-r--r-- | play.js | 13 | ||||
-rw-r--r-- | rules.js | 229 | ||||
-rw-r--r-- | tools/gendata.js | 58 |
4 files changed, 250 insertions, 52 deletions
@@ -1,2 +1,2 @@ -const data = {"locations":{},"areas":[{"loc":0,"id":"NONE","name":"None"},{"loc":1,"id":"DEPLOY","name":"Deployment"},{"loc":2,"id":"ELIMINATED","name":"Eliminated"},{"loc":3,"id":"FRANCE","name":"France","type":4,"zone":null,"x":1690.3,"y":244.8,"w":94,"h":94},{"loc":4,"id":"TUNISIA","name":"Tunisia","type":4,"zone":"TUNISIA","x":2499.9,"y":1667.6,"w":94,"h":94},{"loc":5,"id":"MOROCCO","name":"Morocco","type":4,"zone":"MOROCCO","x":109,"y":1765,"w":94,"h":94},{"loc":6,"id":"I-1","name":"Barika","type":1,"zone":"I","x":1708.1,"y":1117.9},{"loc":7,"id":"I-2","name":"Batna","type":3,"zone":"I","x":2185.6,"y":1390.9},{"loc":8,"id":"I-3","name":"Biskra","type":3,"zone":"I","x":1853.6,"y":1620.9},{"loc":9,"id":"I-4","name":"Tebessa","type":1,"zone":"I","x":2299.6,"y":1120.9},{"loc":10,"id":"CONSTANTINE","name":"Constantine","type":2,"zone":"II","x":2066.6,"y":315.8},{"loc":11,"id":"II-1","name":"Setif","type":1,"zone":"II","x":1917.6,"y":800.8},{"loc":12,"id":"II-2","name":"Phillippeville","type":1,"zone":"II","x":2200.6,"y":584.9},{"loc":13,"id":"II-3","name":"Souk Ahras","type":1,"zone":"II","x":2347.6,"y":848.9},{"loc":14,"id":"III-1","name":"Tizi Ouzou","type":1,"zone":"III","x":1473.6,"y":578.9},{"loc":15,"id":"III-2","name":"Bordj Bou Arreridj","type":1,"zone":"III","x":1465.6,"y":832.9},{"loc":16,"id":"III-3","name":"Bougie","type":1,"zone":"III","x":1703.6,"y":616.9},{"loc":17,"id":"ALGIERS","name":"Algiers","type":2,"zone":"IV","x":1185.6,"y":346.8},{"loc":18,"id":"IV-1","name":"Medea","type":1,"zone":"IV","x":1212,"y":727},{"loc":19,"id":"IV-2","name":"Orleansville","type":1,"zone":"IV","x":982,"y":780.2},{"loc":20,"id":"ORAN","name":"Oran","type":2,"zone":"V","x":430.6,"y":588.8},{"loc":21,"id":"V-1","name":"Mecheria","type":3,"zone":"V","x":234,"y":1485.7},{"loc":22,"id":"V-2","name":"Tlemcen","type":1,"zone":"V","x":173,"y":1140.9},{"loc":23,"id":"V-3","name":"Sidi Bel Abbes","type":1,"zone":"V","x":476,"y":1038},{"loc":24,"id":"V-4","name":"Mostaganem","type":1,"zone":"V","x":741,"y":863.9},{"loc":25,"id":"V-5","name":"Saida","type":3,"zone":"V","x":501,"y":1419.1},{"loc":26,"id":"V-6","name":"Mascara","type":3,"zone":"V","x":785,"y":1302.9},{"loc":27,"id":"V-7","name":"Ain Sefra","type":3,"zone":"V","x":752,"y":1670.9},{"loc":28,"id":"V-8","name":"Laghouat","type":3,"zone":"V","x":1191,"y":1615.6},{"loc":29,"id":"VI-1","name":"Sidi Aissa","type":3,"zone":"VI","x":1385,"y":1186},{"loc":30,"id":"VI-2","name":"Ain Qussera","type":1,"zone":"VI","x":1070.6,"y":1235.6}],"zone_areas":{"TUNISIA":[4],"MOROCCO":[5],"I":[6,7,8,9],"II":[10,11,12,13],"III":[14,15,16],"IV":[17,18,19],"V":[20,21,22,23,24,25,26,27,28],"VI":[29,30]},"adjecents":{"undefined":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]},"units":[{"side":1,"type":0,"class":"fr_xx_2"},{"side":1,"type":0,"class":"fr_xx_4"},{"side":1,"type":0,"class":"fr_xx_9"},{"side":1,"type":0,"class":"fr_xx_12"},{"side":1,"type":0,"class":"fr_xx_13"},{"side":1,"type":0,"class":"fr_xx_14"},{"side":1,"type":0,"class":"fr_xx_19"},{"side":1,"type":0,"class":"fr_xx_20"},{"side":1,"type":0,"class":"fr_xx_21"},{"side":1,"type":0,"class":"fr_xx_29"},{"side":1,"type":0,"class":"fr_xx_27"},{"side":1,"type":0,"class":"fr_xx_25"},{"side":1,"type":0,"class":"fr_xx_7"},{"side":1,"type":1,"class":"fr_x"},{"side":1,"type":1,"class":"fr_x"},{"side":1,"type":1,"class":"fr_x"},{"side":1,"type":1,"class":"fr_x"},{"side":1,"type":2,"class":"fr_elite_x_para"},{"side":1,"type":2,"class":"fr_elite_x_para"},{"side":1,"type":2,"class":"fr_elite_x_para"},{"side":1,"type":2,"class":"fr_elite_x_inf"},{"side":1,"type":2,"class":"fr_elite_x_marine"},{"side":1,"type":2,"class":"fr_elite_x_marine"},{"side":1,"type":2,"class":"fr_elite_x_marine"},{"side":1,"type":3,"class":"alg_x"},{"side":1,"type":3,"class":"alg_x"},{"side":1,"type":3,"class":"alg_x"},{"side":1,"type":3,"class":"alg_x"},{"side":1,"type":3,"class":"alg_x"},{"side":1,"type":3,"class":"alg_x"},{"side":1,"type":4,"class":"alg_police"},{"side":1,"type":4,"class":"alg_police"},{"side":1,"type":4,"class":"alg_police"},{"side":1,"type":4,"class":"alg_police"},{"side":1,"type":4,"class":"alg_police"},{"side":1,"type":4,"class":"alg_police"},{"side":1,"type":4,"class":"alg_police"},{"side":1,"type":4,"class":"alg_police"},{"side":1,"type":4,"class":"alg_police"},{"side":1,"type":4,"class":"alg_police"},{"side":0,"type":5,"class":"fln_failek"},{"side":0,"type":5,"class":"fln_failek"},{"side":0,"type":5,"class":"fln_failek"},{"side":0,"type":5,"class":"fln_failek"},{"side":0,"type":5,"class":"fln_failek"},{"side":0,"type":5,"class":"fln_failek"},{"side":0,"type":5,"class":"fln_failek"},{"side":0,"type":5,"class":"fln_failek"},{"side":0,"type":5,"class":"fln_failek"},{"side":0,"type":5,"class":"fln_failek"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":6,"class":"fln_band"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":7,"class":"fln_cadre"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"},{"side":0,"type":8,"class":"fln_front"}]} +const data = {"locations":{},"areas":[{"loc":0,"id":"NONE","name":"None"},{"loc":1,"id":"DEPLOY","name":"Deployment"},{"loc":2,"id":"ELIMINATED","name":"Eliminated"},{"loc":3,"id":"FRANCE","name":"France","type":4,"zone":null,"x":1690.3,"y":244.8,"w":94,"h":94},{"loc":4,"id":"TUNISIA","name":"Tunisia","type":4,"zone":"TUNISIA","x":2499.9,"y":1667.6,"w":94,"h":94},{"loc":5,"id":"MOROCCO","name":"Morocco","type":4,"zone":"MOROCCO","x":109,"y":1765,"w":94,"h":94},{"loc":6,"id":"I-1","name":"Barika","type":1,"zone":"I","x":1708.1,"y":1117.9},{"loc":7,"id":"I-2","name":"Batna","type":3,"zone":"I","x":2185.6,"y":1390.9},{"loc":8,"id":"I-3","name":"Biskra","type":3,"zone":"I","x":1853.6,"y":1620.9},{"loc":9,"id":"I-4","name":"Tebessa","type":1,"zone":"I","x":2299.6,"y":1120.9},{"loc":10,"id":"CONSTANTINE","name":"Constantine","type":2,"zone":"II","x":2066.6,"y":315.8},{"loc":11,"id":"II-1","name":"Setif","type":1,"zone":"II","x":1917.6,"y":800.8},{"loc":12,"id":"II-2","name":"Phillippeville","type":1,"zone":"II","x":2200.6,"y":584.9},{"loc":13,"id":"II-3","name":"Souk Ahras","type":1,"zone":"II","x":2347.6,"y":848.9},{"loc":14,"id":"III-1","name":"Tizi Ouzou","type":1,"zone":"III","x":1473.6,"y":578.9},{"loc":15,"id":"III-2","name":"Bordj Bou Arreridj","type":1,"zone":"III","x":1465.6,"y":832.9},{"loc":16,"id":"III-3","name":"Bougie","type":1,"zone":"III","x":1703.6,"y":616.9},{"loc":17,"id":"ALGIERS","name":"Algiers","type":2,"zone":"IV","x":1185.6,"y":346.8},{"loc":18,"id":"IV-1","name":"Medea","type":1,"zone":"IV","x":1212,"y":727},{"loc":19,"id":"IV-2","name":"Orleansville","type":1,"zone":"IV","x":982,"y":780.2},{"loc":20,"id":"ORAN","name":"Oran","type":2,"zone":"V","x":430.6,"y":588.8},{"loc":21,"id":"V-1","name":"Mecheria","type":3,"zone":"V","x":234,"y":1485.7},{"loc":22,"id":"V-2","name":"Tlemcen","type":1,"zone":"V","x":173,"y":1140.9},{"loc":23,"id":"V-3","name":"Sidi Bel Abbes","type":1,"zone":"V","x":476,"y":1038},{"loc":24,"id":"V-4","name":"Mostaganem","type":1,"zone":"V","x":741,"y":863.9},{"loc":25,"id":"V-5","name":"Saida","type":3,"zone":"V","x":501,"y":1419.1},{"loc":26,"id":"V-6","name":"Mascara","type":3,"zone":"V","x":785,"y":1302.9},{"loc":27,"id":"V-7","name":"Ain Sefra","type":3,"zone":"V","x":752,"y":1670.9},{"loc":28,"id":"V-8","name":"Laghouat","type":3,"zone":"V","x":1191,"y":1615.6},{"loc":29,"id":"VI-1","name":"Sidi Aissa","type":3,"zone":"VI","x":1385,"y":1186},{"loc":30,"id":"VI-2","name":"Ain Qussera","type":1,"zone":"VI","x":1070.6,"y":1235.6}],"zone_areas":{"TUNISIA":[4],"MOROCCO":[5],"I":[6,7,8,9],"II":[10,11,12,13],"III":[14,15,16],"IV":[17,18,19],"V":[20,21,22,23,24,25,26,27,28],"VI":[29,30]},"adjecents":{"undefined":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]},"units":[{"side":1,"type":0,"name":"French 2nd division","class":"fr_xx_2"},{"side":1,"type":0,"name":"French 4th division","class":"fr_xx_4"},{"side":1,"type":0,"name":"French 9th division","class":"fr_xx_9"},{"side":1,"type":0,"name":"French 12th division","class":"fr_xx_12"},{"side":1,"type":0,"name":"French 13th division","class":"fr_xx_13"},{"side":1,"type":0,"name":"French 14th division","class":"fr_xx_14"},{"side":1,"type":0,"name":"French 19th division","class":"fr_xx_19"},{"side":1,"type":0,"name":"French 20th division","class":"fr_xx_20"},{"side":1,"type":0,"name":"French 21th division","class":"fr_xx_21"},{"side":1,"type":0,"name":"French 29th division","class":"fr_xx_29"},{"side":1,"type":0,"name":"French 27th division","class":"fr_xx_27"},{"side":1,"type":0,"name":"French 5th division","class":"fr_xx_5"},{"side":1,"type":0,"name":"French 7th division","class":"fr_xx_7"},{"side":1,"type":1,"name":"French brigade","class":"fr_x"},{"side":1,"type":1,"name":"French brigade","class":"fr_x"},{"side":1,"type":1,"name":"French brigade","class":"fr_x"},{"side":1,"type":1,"name":"French brigade","class":"fr_x"},{"side":1,"type":2,"name":"French elite brigade","class":"fr_elite_x_para"},{"side":1,"type":2,"name":"French elite brigade","class":"fr_elite_x_para"},{"side":1,"type":2,"name":"French elite brigade","class":"fr_elite_x_para"},{"side":1,"type":2,"name":"French elite brigade","class":"fr_elite_x_inf"},{"side":1,"type":2,"name":"French elite brigade","class":"fr_elite_x_marine"},{"side":1,"type":2,"name":"French elite brigade","class":"fr_elite_x_marine"},{"side":1,"type":2,"name":"French elite brigade","class":"fr_elite_x_marine"},{"side":1,"type":3,"name":"Algerian brigade","class":"alg_x"},{"side":1,"type":3,"name":"Algerian brigade","class":"alg_x"},{"side":1,"type":3,"name":"Algerian brigade","class":"alg_x"},{"side":1,"type":3,"name":"Algerian brigade","class":"alg_x"},{"side":1,"type":3,"name":"Algerian brigade","class":"alg_x"},{"side":1,"type":3,"name":"Algerian brigade","class":"alg_x"},{"side":1,"type":4,"name":"Police","class":"alg_police"},{"side":1,"type":4,"name":"Police","class":"alg_police"},{"side":1,"type":4,"name":"Police","class":"alg_police"},{"side":1,"type":4,"name":"Police","class":"alg_police"},{"side":1,"type":4,"name":"Police","class":"alg_police"},{"side":1,"type":4,"name":"Police","class":"alg_police"},{"side":1,"type":4,"name":"Police","class":"alg_police"},{"side":1,"type":4,"name":"Police","class":"alg_police"},{"side":1,"type":4,"name":"Police","class":"alg_police"},{"side":1,"type":4,"name":"Police","class":"alg_police"},{"side":0,"type":5,"name":"Failek","class":"fln_failek"},{"side":0,"type":5,"name":"Failek","class":"fln_failek"},{"side":0,"type":5,"name":"Failek","class":"fln_failek"},{"side":0,"type":5,"name":"Failek","class":"fln_failek"},{"side":0,"type":5,"name":"Failek","class":"fln_failek"},{"side":0,"type":5,"name":"Failek","class":"fln_failek"},{"side":0,"type":5,"name":"Failek","class":"fln_failek"},{"side":0,"type":5,"name":"Failek","class":"fln_failek"},{"side":0,"type":5,"name":"Failek","class":"fln_failek"},{"side":0,"type":5,"name":"Failek","class":"fln_failek"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":6,"name":"Band","class":"fln_band"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":7,"name":"Cadre","class":"fln_cadre"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"},{"side":0,"type":8,"name":"Front","class":"fln_front"}]} if (typeof module !== 'undefined') module.exports = data @@ -405,11 +405,14 @@ function on_update() { // eslint-disable-line no-unused-vars action_button("activation", "Activation") action_button("acquire_assets", "Acquire assets") - action_button("acquire_air_point", "+1 Air Point") - action_button("acquire_helo_point", "+1 Helo Point") - action_button("acquire_naval_point", "+1 Naval Point") - action_button("mobilize_border_zone", "Mobilize Border Zone") - action_button("improve_border_zone", "Improve Border Zone") + action_button("acquire_air_point", "+1 Air") + action_button("acquire_helo_point", "+1 Helo") + action_button("acquire_naval_point", "+1 Naval") + action_button("mobilize_border_zone", "Mobilize Border") + action_button("improve_border_zone", "Improve Border") + action_button("activate_border_zone", "Activate Border") + action_button("remove", "Remove") + action_button("activate", "Activate") action_button("end_reinforcement", "End reinforcement") action_button("done", "Done") @@ -35,6 +35,7 @@ const CADRE = 7 const FRONT = 8 // Free deployment holding box +const FREE = 0 const DEPLOY = 1 const ELIMINATED = 2 @@ -292,6 +293,10 @@ function is_area_remote(l) { return areas[l].type === REMOTE } +function is_area_algerian(l) { + return areas[l].type !== COUNTRY +} + // #endregion // #region UNIT STATE @@ -429,6 +434,10 @@ function is_fln_unit(u) { return units[u].side === FLN } +function is_algerian_unit(u) { + return units[u].type === AL_X +} + function is_police_unit(u) { return units[u].type === POL } @@ -452,6 +461,18 @@ function for_each_friendly_unit_on_map(fn) { fn(u) } +function for_each_friendly_unit_on_map_box(box, fn) { + for (let u = first_friendly_unit; u <= last_friendly_unit; ++u) + if (unit_loc(u) > 2 && unit_box(u) === box) + fn(u) +} + +function for_each_friendly_unit_on_map_of_type(type, fn) { + for (let u = first_friendly_unit; u <= last_friendly_unit; ++u) + if (unit_loc(u) > 2 && unit_type(u) === type) + fn(u) +} + function for_each_friendly_unit_in_loc(x, fn) { for (let u = first_friendly_unit; u <= last_friendly_unit; ++u) if (unit_loc(u) === x) @@ -470,6 +491,12 @@ function for_each_map_area(fn) { fn(i) } +function for_each_algerian_map_area(fn) { + for (let i = 3; i < area_count; ++i) + if (is_area_algerian(i)) + fn(i) +} + function for_each_map_area_in_zone(z, fn) { for (let i = 3; i < area_count; ++i) if (area_zone(i) === z) @@ -810,13 +837,15 @@ function can_all_deploy_to(us, to) { function deploy_unit(who, to) { set_unit_loc(who, to) - // deploy unit: all FLN in UG, GOV in OPS, police in PTL + // deploy unit: all FLN in UG, GOV in OPS/OC, police in PTL if (is_fln_unit(who)) { set_unit_box(who, UG) } else if (is_police_unit(who)) { set_unit_box(who, PTL) - } else { + } else if (is_algerian_unit(who)) { set_unit_box(who, OPS) + } else { + set_unit_box(who, OC) } } @@ -875,7 +904,6 @@ states.scenario_setup = { set_toggle(game.selected, u) }, loc(to) { - console.log("loc", to) let list = game.selected game.selected = [] push_undo() @@ -1105,39 +1133,199 @@ function goto_gov_reinforcement_phase() { set_active_player() log_h2(`${game.active} Reinforcement`) game.state = "gov_reinforcement" + game.selected = [] + + // Make sure all available units can be deployed + for_each_friendly_unit_in_loc(FREE, u => { + set_unit_loc(u, DEPLOY) + set_unit_box(u, OC) + }) + + // Algerian units activate for free + for_each_friendly_unit_on_map_of_type(AL_X, u => { + set_unit_box(u, OPS) + }) } const COST_AIR_POINT = 2 const COST_HELO_POINT = 3 const COST_NAVAL_POINT = 3 const COST_BORDER_ZONE = 6 +const COST_ACTIVATE_BORDER_ZONE = 1 const MAX_AIR_POINT = 99 const MAX_HELO_POINT = 99 const MAX_NAVAL_POINT = 99 const MAX_BORDER_ZONE_DRM = -3 +const GOV_UNIT_MOBILIZE_COST = { + [FR_XX]: 5, + [FR_X]: 2, + [EL_X]: 3, + [AL_X]: 2, + [POL]: 1 +} + +function mobilization_cost(units) { + let cost = 0 + for (let u of units) { + cost += GOV_UNIT_MOBILIZE_COST[unit_type(u)] + } + return cost +} + +const GOV_UNIT_ACTIVATION_COST = { + [FR_XX]: 1, + [FR_X]: .5, + [EL_X]: .5, + [AL_X]: 0 +} + +function activation_cost(units) { + let cost = 0 + for (let u of units) { + cost += GOV_UNIT_ACTIVATION_COST[unit_type(u)] + } + return cost +} + +function mobilize_unit(who, to) { + set_unit_loc(who, to) + + if (is_police_unit(who)) { + set_unit_box(who, PTL) + } else { + set_unit_box(who, OPS) + } + + log(`>${units[who].name} into ${areas[to].name}`) +} + states.gov_reinforcement = { inactive: "to do reinforcement", prompt() { - view.prompt = "Reinforcement: Mobilize & activate units, and acquire assets" - - if (game.gov_psl > COST_AIR_POINT && game.air_max < MAX_AIR_POINT) - gen_action("acquire_air_point") - if (game.gov_psl > COST_HELO_POINT && game.helo_max < MAX_HELO_POINT) - gen_action("acquire_helo_point") - if (game.gov_psl > COST_NAVAL_POINT && game.naval < MAX_NAVAL_POINT) - gen_action("acquire_naval_point") - if (game.gov_psl > COST_BORDER_ZONE) { - // starts at no border zone instead of 0 - if (game.border_zone_drm === null) { - gen_action("mobilize_border_zone") - } else if (game.border_zone_drm > MAX_BORDER_ZONE_DRM) { - gen_action("improve_border_zone") + if (game.selected.length === 0) { + view.prompt = "Reinforcement: Mobilize & activate units, and acquire assets" + // first unit can be any unit in DEPLOY or on map + for_each_friendly_unit_in_loc(DEPLOY, u => { + gen_action_unit(u) + }) + + // activate french mobile units + for_each_friendly_unit_on_map_box(OC, u => { + gen_action_unit(u) + }) + + // remove police units + for_each_friendly_unit_on_map_of_type(POL, u => { + gen_action_unit(u) + }) + + // activate border + // TODO consider making marker selectable + if (game.border_zone_drm !== null && !game.border_zone_active && game.gov_psl > COST_ACTIVATE_BORDER_ZONE) { + gen_action("activate_border_zone") + } + + // asset acquisition + if (game.gov_psl > COST_AIR_POINT && game.air_max < MAX_AIR_POINT) + gen_action("acquire_air_point") + if (game.gov_psl > COST_HELO_POINT && game.helo_max < MAX_HELO_POINT) + gen_action("acquire_helo_point") + if (game.gov_psl > COST_NAVAL_POINT && game.naval < MAX_NAVAL_POINT) + gen_action("acquire_naval_point") + if (game.gov_psl > COST_BORDER_ZONE) { + // starts at no border zone instead of 0 + if (game.border_zone_drm === null) { + gen_action("mobilize_border_zone") + } else if (game.border_zone_drm > MAX_BORDER_ZONE_DRM) { + gen_action("improve_border_zone") + } + } + } else { + let first_unit = game.selected[0] + let first_unit_loc = unit_loc(first_unit) + let first_unit_type = unit_type(first_unit) + if (first_unit_type === POL && first_unit_loc !== DEPLOY) { + view.prompt = "Reinforcement: Remove Police units" + + for_each_friendly_unit_on_map_of_type(POL, u => { + gen_action_unit(u) + }) + + gen_action("remove") + } else if (first_unit_loc === DEPLOY) { + let cost = mobilization_cost(game.selected) + view.prompt = `Reinforcement: Mobilize units (cost ${cost} PSP)` + + for_each_friendly_unit_in_loc(DEPLOY, u => { + gen_action_unit(u) + }) + + if (game.gov_psl > cost) { + for_each_algerian_map_area(loc => { + gen_action_loc(loc) + }) + } + } else { + let cost = activation_cost(game.selected) + view.prompt = `Reinforcement: Activate units (cost ${cost} PSP)` + + for_each_friendly_unit_on_map_box(OC, u => { + gen_action_unit(u) + }) + + // Fractions rounded up + if (game.gov_psl > Math.ceil(cost)) { + gen_action("activate") + } } } + // XXX debug + // TODO confirmation when no units are activated? gen_action("end_reinforcement") }, + unit(u) { + set_toggle(game.selected, u) + }, + loc(to) { + let list = game.selected + game.selected = [] + push_undo() + log("Mobilized:") + for (let who of list) { + mobilize_unit(who, to) + } + let cost = mobilization_cost(list) + game.gov_psl -= cost + log(`Paid ${cost} PSP`) + }, + activate() { + let list = game.selected + game.selected = [] + push_undo() + log("Activated:") + for (let u of list) { + let loc = unit_loc(u) + log(`>${units[u].name} in ${areas[loc].name}`) + set_unit_box(u, OPS) + } + let cost = Math.ceil(activation_cost(list)) + game.gov_psl -= cost + log(`Paid ${cost} PSP`) + }, + remove() { + let list = game.selected + game.selected = [] + push_undo() + log("Removed:") + for (let u of list) { + let loc = unit_loc(u) + log(`>${units[u].name} from ${areas[loc].name}`) + set_unit_loc(u, DEPLOY) + set_unit_box(u, OC) + } + }, acquire_air_point() { push_undo() log("+1 Air Point") @@ -1161,6 +1349,13 @@ states.gov_reinforcement = { game.gov_psl -= COST_NAVAL_POINT game.naval += 1 }, + activate_border_zone() { + push_undo() + log("Border Zone Activated") + log(`>Paid ${COST_ACTIVATE_BORDER_ZONE} PSP`) + game.gov_psl -= COST_ACTIVATE_BORDER_ZONE + game.border_zone_active = true + }, mobilize_border_zone() { push_undo() log("Border Zone Mobilized") diff --git a/tools/gendata.js b/tools/gendata.js index e7bb191..317c565 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -124,39 +124,39 @@ const BAND = 6 const CADRE = 7 const FRONT = 8 -function def_unit(side, type, klass, count = 1) { +function def_unit(side, type, name, klass, count = 1) { for (let i = 0; i < count; ++i) { - units.push({side, type, class: klass}) + units.push({side, type, name, class: klass}) } } -def_unit(GOV, FR_XX, "fr_xx_2") -def_unit(GOV, FR_XX, "fr_xx_4") -def_unit(GOV, FR_XX, "fr_xx_9") -def_unit(GOV, FR_XX, "fr_xx_12") -def_unit(GOV, FR_XX, "fr_xx_13") -def_unit(GOV, FR_XX, "fr_xx_14") -def_unit(GOV, FR_XX, "fr_xx_19") -def_unit(GOV, FR_XX, "fr_xx_20") -def_unit(GOV, FR_XX, "fr_xx_21") -def_unit(GOV, FR_XX, "fr_xx_29") - -def_unit(GOV, FR_XX, "fr_xx_27") -def_unit(GOV, FR_XX, "fr_xx_25") -def_unit(GOV, FR_XX, "fr_xx_7") - -def_unit(GOV, FR_X, "fr_x", 4) -def_unit(GOV, EL_X, "fr_elite_x_para", 3) -def_unit(GOV, EL_X, "fr_elite_x_inf") -def_unit(GOV, EL_X, "fr_elite_x_marine", 3) - -def_unit(GOV, AL_X, "alg_x", 6) -def_unit(GOV, POL, "alg_police", 10) - -def_unit(FLN, FAILEK, "fln_failek", 10) -def_unit(FLN, BAND, "fln_band", 24) -def_unit(FLN, CADRE, "fln_cadre", 30) -def_unit(FLN, FRONT, "fln_front", 16) +def_unit(GOV, FR_XX, "French 2nd division", "fr_xx_2") +def_unit(GOV, FR_XX, "French 4th division", "fr_xx_4") +def_unit(GOV, FR_XX, "French 9th division", "fr_xx_9") +def_unit(GOV, FR_XX, "French 12th division", "fr_xx_12") +def_unit(GOV, FR_XX, "French 13th division", "fr_xx_13") +def_unit(GOV, FR_XX, "French 14th division", "fr_xx_14") +def_unit(GOV, FR_XX, "French 19th division", "fr_xx_19") +def_unit(GOV, FR_XX, "French 20th division", "fr_xx_20") +def_unit(GOV, FR_XX, "French 21th division", "fr_xx_21") +def_unit(GOV, FR_XX, "French 29th division", "fr_xx_29") + +def_unit(GOV, FR_XX, "French 27th division", "fr_xx_27") +def_unit(GOV, FR_XX, "French 5th division", "fr_xx_5") +def_unit(GOV, FR_XX, "French 7th division", "fr_xx_7") // rules errata: - The French light mechanized division (circle with slash through it) should be numbered "7", not "2" + +def_unit(GOV, FR_X, "French brigade", "fr_x", 4) +def_unit(GOV, EL_X, "French elite brigade", "fr_elite_x_para", 3) +def_unit(GOV, EL_X, "French elite brigade", "fr_elite_x_inf") +def_unit(GOV, EL_X, "French elite brigade", "fr_elite_x_marine", 3) + +def_unit(GOV, AL_X, "Algerian brigade", "alg_x", 6) +def_unit(GOV, POL, "Police", "alg_police", 10) + +def_unit(FLN, FAILEK, "Failek", "fln_failek", 10) +def_unit(FLN, BAND, "Band", "fln_band", 24) +def_unit(FLN, CADRE, "Cadre", "fln_cadre", 30) +def_unit(FLN, FRONT, "Front", "fln_front", 16) console.log("const area_count =", areas.length) console.log("const unit_count =", units.length) |