From 4f0d9c6e6397603dca10c30caa1ad3ce65722a83 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 21 Oct 2024 20:47:08 +0200 Subject: renumber minor powers at end. --- rules.js | 181 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 92 insertions(+), 89 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index b7a3d19..a7ea703 100644 --- a/rules.js +++ b/rules.js @@ -72,17 +72,14 @@ const suit_class = [ "spades", "clubs", "hearts", "diamonds", "reserve" ] const suit_letter = [ "S", "C", "H", "D", "R" ] const P_FRANCE = 0 -const P_BAVARIA = 1 -const P_PRUSSIA = 2 -const P_SAXONY = 3 -const P_PRAGMATIC = 4 -const P_AUSTRIA = 5 +const P_PRUSSIA = 1 +const P_PRAGMATIC = 2 +const P_AUSTRIA = 3 +const P_BAVARIA = 4 +const P_SAXONY = 5 -const power_name = [ "France", "Bavaria", "Prussia", "Saxony", "Pragmatic Army", "Austria" ] -const power_class = [ "france", "bavaria", "prussia", "saxony", "pragmatic", "austria" ] - -const is_major_power = [ 1, 0, 1, 0, 1, 1 ] -const is_minor_power = [ 0, 1, 0, 1, 0, 0 ] +const power_name = [ "France", "Prussia", "Pragmatic Army", "Austria", "Bavaria", "Saxony" ] +const power_class = [ "france", "prussia", "pragmatic", "austria", "bavaria", "saxony" ] const SPADES = 0 const CLUBS = 1 @@ -98,20 +95,20 @@ const all_powers = [ 0, 1, 2, 3, 4, 5 ] const all_power_generals = [ [ 0, 1, 2, 3, 4 ], - [ 5 ], - [ 6, 7, 8, 9 ], - [ 10 ], - [ 11, 12, 13 ], - [ 14, 15, 16, 17, 18, 19 ], + [ 5, 6, 7, 8 ], + [ 9, 10, 11 ], + [ 12, 13, 14, 15, 16, 17 ], + [ 18 ], + [ 19 ], ] const all_power_trains = [ [ 20, 21 ], - [ 22 ], - [ 23, 24 ], - [ 25 ], - [ 26 ], - [ 27, 28, 29 ], + [ 22, 23 ], + [ 24 ], + [ 25, 26, 27 ], + [ 28 ], + [ 29 ], ] const last_piece = 29 @@ -120,36 +117,36 @@ const all_hussars = [ 30, 31 ] const piece_power = [ P_FRANCE, P_FRANCE, P_FRANCE, P_FRANCE, P_FRANCE, - P_BAVARIA, P_PRUSSIA, P_PRUSSIA, P_PRUSSIA, P_PRUSSIA, - P_SAXONY, P_PRAGMATIC, P_PRAGMATIC, P_PRAGMATIC, P_AUSTRIA, P_AUSTRIA, P_AUSTRIA, P_AUSTRIA, P_AUSTRIA, P_AUSTRIA, - P_FRANCE, P_FRANCE, P_BAVARIA, - P_PRUSSIA, P_PRUSSIA, P_SAXONY, + P_FRANCE, P_FRANCE, + P_PRUSSIA, P_PRUSSIA, P_PRAGMATIC, P_AUSTRIA, P_AUSTRIA, P_AUSTRIA, + P_BAVARIA, + P_SAXONY, P_AUSTRIA, P_AUSTRIA ] const piece_rank = [ 1, 2, 3, 4, 5, - 1, 1, 2, 3, 4, - 1, 1, 2, 3, 1, 2, 3, 4, 5, 6, + 1, + 1, ] const piece_abbr = [ "F1", "F2", "F3", "F4", "F5", - "B1", "P1", "P2", "P3", "P4", - "S1", "PA1", "PA2", "PA3", "A1", "A2", "A3", "A4", "A5", "A6", + "B1", + "S1", ] const piece_name = [ @@ -158,12 +155,10 @@ const piece_name = [ "Broglie", "Maillebois", "Noailles", - "Törring", "Friedrich", "Schwerin", "Leopold", "Dessauer", - "Rutowski", "George II", "Cumberland", "Earl of Stair", @@ -173,12 +168,14 @@ const piece_name = [ "Batthyány", "Neipperg", "Arenberg", + "Törring", + "Rutowski", "supply train", "supply train", - "supply train", "supply train", "supply train", "supply train", - "supply train", "supply train", "supply train", "supply train", + "supply train", + "supply train", "hussar", "hussar", ] @@ -188,12 +185,10 @@ const piece_log_name = [ "Broglie", "Maillebois", "Noailles", - "Törring", "Friedrich", "Schwerin", "Leopold", "Dessauer", - "Rutowski", "George II", "Cumberland", "Earl of Stair", @@ -203,21 +198,17 @@ const piece_log_name = [ "Batthyány", "Neipperg", "Arenberg", + "Törring", + "Rutowski", "French ST", "French ST", - "Bavarian ST", "Prussian ST", "Prussian ST", - "Saxon ST", "Pragmatic Army ST", "Austrian ST", "Austrian ST", "Austrian ST", + "Bavarian ST", + "Saxon ST", "Hussars", "Hussars", ] - -const all_pieces = [ ...all_power_generals.flat(), ...all_power_trains.flat() ] -const all_trains = [ ...all_power_trains.flat() ] -const all_generals = [ ...all_power_generals.flat() ] -const all_generals_by_rank = all_generals.slice().sort((a,b)=>piece_rank[a]-piece_rank[b]) - function to_deck(c) { return c >> 7 } @@ -293,6 +284,11 @@ const DRESDEN = find_city("Dresden") const ENGLAND = find_city("England") +const all_pieces = [ ...all_power_generals.flat(), ...all_power_trains.flat() ] +const all_trains = [ ...all_power_trains.flat() ] +const all_generals = [ ...all_power_generals.flat() ] +const all_generals_by_rank = all_generals.slice().sort((a,b)=>piece_rank[a]-piece_rank[b]) + const all_france_bavaria_generals = [ ...all_power_generals[P_FRANCE], ...all_power_generals[P_BAVARIA], @@ -604,19 +600,19 @@ set_add_all(all_fortresses, data.type.minor_fortress) const all_home_country_fortresses = [] all_home_country_fortresses[P_FRANCE] = set_intersect(all_fortresses, data.country.France) -all_home_country_fortresses[P_BAVARIA] = set_intersect(all_fortresses, data.country.Bavaria) all_home_country_fortresses[P_PRUSSIA] = set_intersect(all_fortresses, data.country.Prussia) -all_home_country_fortresses[P_SAXONY] = set_intersect(all_fortresses, data.country.Saxony) -all_home_country_fortresses[P_AUSTRIA] = set_intersect(all_fortresses, data.country.Austria) all_home_country_fortresses[P_PRAGMATIC] = set_intersect(all_fortresses, data.country.Netherlands) +all_home_country_fortresses[P_AUSTRIA] = set_intersect(all_fortresses, data.country.Austria) +all_home_country_fortresses[P_BAVARIA] = set_intersect(all_fortresses, data.country.Bavaria) +all_home_country_fortresses[P_SAXONY] = set_intersect(all_fortresses, data.country.Saxony) const all_home_country_major_fortresses = [] all_home_country_major_fortresses[P_FRANCE] = set_intersect(data.type.major_fortress, data.country.France) -all_home_country_major_fortresses[P_BAVARIA] = set_intersect(data.type.major_fortress, data.country.Bavaria) all_home_country_major_fortresses[P_PRUSSIA] = set_intersect(data.type.major_fortress, data.country.Prussia) -all_home_country_major_fortresses[P_SAXONY] = set_intersect(data.type.major_fortress, data.country.Saxony) -all_home_country_major_fortresses[P_AUSTRIA] = set_intersect(data.type.major_fortress, data.country.Austria) all_home_country_major_fortresses[P_PRAGMATIC] = set_intersect(data.type.major_fortress, data.country.Netherlands) +all_home_country_major_fortresses[P_AUSTRIA] = set_intersect(data.type.major_fortress, data.country.Austria) +all_home_country_major_fortresses[P_BAVARIA] = set_intersect(data.type.major_fortress, data.country.Bavaria) +all_home_country_major_fortresses[P_SAXONY] = set_intersect(data.type.major_fortress, data.country.Saxony) const all_silesian_fortresses = set_intersect(all_fortresses, data.country.Silesia) @@ -637,11 +633,11 @@ function is_home_country(s) { // TODO: Silesia switch (game.power) { case P_FRANCE: return set_has(data.country.France, s) - case P_BAVARIA: return set_has(data.country.Bavaria, s) case P_PRUSSIA: return set_has(data.country.Prussia, s) - case P_SAXONY: return set_has(data.country.Saxony, s) - case P_AUSTRIA: return set_has(data.country.Austria, s) case P_PRAGMATIC: return set_has(data.country.Netherlands, s) + case P_AUSTRIA: return set_has(data.country.Austria, s) + case P_BAVARIA: return set_has(data.country.Bavaria, s) + case P_SAXONY: return set_has(data.country.Saxony, s) } } @@ -720,7 +716,7 @@ function is_protected_from_conquest(s) { /* STATE */ -const tc_per_turn_table = [ 5, 1, 3, 1, 3, 5 ] +const tc_per_turn_table = [ 5, 3, 3, 5, 1, 1 ] function tc_per_turn() { let n = tc_per_turn_table[game.power] @@ -739,16 +735,17 @@ function tc_per_turn() { function player_from_power(pow) { switch (pow) { case P_FRANCE: - case P_BAVARIA: return R_LOUIS_XV case P_PRUSSIA: return R_FREDERICK - case P_SAXONY: - return R_FREDERICK case P_PRAGMATIC: return R_FREDERICK case P_AUSTRIA: return R_MARIA_THERESA + case P_SAXONY: + return R_FREDERICK + case P_BAVARIA: + return R_LOUIS_XV } } @@ -909,10 +906,10 @@ const POWER_FROM_ACTION_STAGE = [ ] const title_from_action_stage = [ - "=0 France and Bavaria", - "=2 Prussia and Saxony", - "=5 Austria", - "=4 Pragmatic Army", + "=" + P_FRANCE + "France and Bavaria", + "=" + P_PRUSSIA + "Prussia and Saxony", + "=" + P_PRAGMATIC + "Pragmatic Army", + "=" + P_AUSTRIA + "Austria", ] function set_active_to_current_action_stage() { @@ -929,12 +926,12 @@ const POWER_FROM_WINTER_STAGE = [ ] const title_from_winter_stage = [ - "=0", - "=1", - "=2", - "=3", - "=4", - "=5", + "=" + P_FRANCE, + "=" + P_BAVARIA, + "=" + P_PRUSSIA, + "=" + P_SAXONY, + "=" + P_PRAGMATIC, + "=" + P_AUSTRIA, ] function set_active_to_current_winter_stage() { @@ -3105,9 +3102,7 @@ function goto_retroactive_conquest() { const POWER_FROM_SETUP_STAGE = [ P_FRANCE, - P_BAVARIA, P_PRUSSIA, - P_SAXONY, P_PRAGMATIC, P_AUSTRIA, ] @@ -3117,26 +3112,35 @@ function set_active_setup_power() { game.active = current_player() } -const setup_initial_tcs = [ 2, 5, 9, 3, 3, 5 ] +const setup_initial_tcs = [ 2, 9, 3, 5, 5, 3 ] -const setup_total_troops = [ 26, 5, 16+6, 5, 14, 28 ] +const setup_total_troops = [ 26, 16+6, 14, 28, 5, 5 ] const setup_min_troops = [ 1, 1, 1, 1, 1, - 5, 1, 1, 4, 6, - 5, 1, 1, 1, 1, 1, 6, 2, 1, 4, + 5, + 5, ] const setup_max_troops = [ 8, 8, 8, 8, 8, - 5, 8, 8, 8, 6, - 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 5, + 5, +] + +const setup_troops = [ + 0, 0, 0, 0, 0, + 0, 0, 0, 6, + 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 5, + 5, ] const setup_piece_position = [ @@ -3149,18 +3153,12 @@ const setup_piece_position = [ find_city("Créspy-en-V."), find_city("Sarreguemines"), - // B - find_city("Ergoldsbach"), - // P find_city("Steinau"), find_city("Steinau"), find_city("Sprottau"), find_city("East Prussia"), - // S - find_city("Radeberg"), - // PA find_city("Delfzijl"), find_city("Delfzijl"), @@ -3174,22 +3172,22 @@ const setup_piece_position = [ find_city("Trübau"), find_city("Malmedy"), + // B + find_city("Ergoldsbach"), + + // S + find_city("Radeberg"), + // - TRAINS - // F find_city("Bar-le-Duc"), find_city("Regensburg"), - // B - find_city("Falkenstein"), - // P find_city("Grünberg"), find_city("Silesia Victory"), - // S - find_city("Meißen"), - // PA find_city("Tilburg"), @@ -3198,6 +3196,12 @@ const setup_piece_position = [ find_city("Bruck"), find_city("Geel"), + // B + find_city("Falkenstein"), + + // S + find_city("Meißen"), + // Hussars ELIMINATED, ELIMINATED @@ -3255,7 +3259,7 @@ exports.setup = function (seed, _scenario, _options) { pos: setup_piece_position.slice(), oos: 0, supreme: 0, - troops: new Array(20).fill(0), + troops: setup_troops.slice(), victory: [], elector: [], @@ -3304,7 +3308,7 @@ states.setup = { } else { let n_stacks = 0 for (let p of all_power_generals[game.power]) { - if (!set_has(game.moved, p)) { + if (game.troops[p] === 0) { gen_action_piece(p) n_stacks ++ } @@ -3319,7 +3323,6 @@ states.setup = { }, piece(p) { push_undo() - set_add(game.moved, p) game.selected = p game.state = "setup_general" }, @@ -3377,7 +3380,7 @@ states.setup_general = { } function end_setup() { - if (++game.stage === 6) { + if (++game.stage === 4) { goto_start_turn() } else { set_active_setup_power() -- cgit v1.2.3