diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-10-23 10:49:53 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-10-23 10:53:17 +0200 |
commit | 7dc86dde42c3bf9cd38bc40da477dbd03f5b5ba3 (patch) | |
tree | 55073d6612102aad7f63ed7a51bc6b8d94260101 /rules.js | |
parent | f62b29ceeb2afd0bf206b4d173e10c7e8ce0f5ff (diff) | |
download | maria-7dc86dde42c3bf9cd38bc40da477dbd03f5b5ba3.tar.gz |
22 Arenberg
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 35 |
1 files changed, 27 insertions, 8 deletions
@@ -106,6 +106,8 @@ const IMPERIAL_ELECTION = 24 const ELIMINATED = data.cities.name.length +const ARENBERG = 17 + const all_powers = [ 0, 1, 2, 3, 4, 5 ] const all_major_powers = [ 0, 1, 2, 3 ] @@ -636,6 +638,11 @@ all_home_country_major_fortresses[P_AUSTRIA] = set_intersect(data.type.major_for 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_arenberg_major_fortresses = set_union( + all_home_country_major_fortresses[P_PRAGMATIC], + all_home_country_major_fortresses[P_AUSTRIA] +) + const all_silesian_fortresses = set_intersect(all_fortresses, data.country.Silesia) const protect_range = [] @@ -1374,6 +1381,12 @@ function search_supply_path(who) { let from = game.pos[who] let trains = all_power_trains[piece_power[who]] + if (who === ARENBERG) { + if (set_has(data.country.Netherlands, from)) + return 1 + trains = all_austria_pragmatic_trains + } + if (is_home_country(from)) return 1 @@ -2392,8 +2405,14 @@ function goto_recruit() { game.state = "recruit" } -function has_re_entry_space_for_general() { - for (let s of all_home_country_major_fortresses[game.power]) +function all_re_entry_cities_for_general(p) { + if (p === ARENBERG) + return all_arenberg_major_fortresses + return all_home_country_major_fortresses[game.power] +} + +function has_re_entry_space_for_general(p) { + for (let s of all_re_entry_cities_for_general(p)) if (can_re_enter_general_at_city(s)) return true return false @@ -2414,7 +2433,7 @@ function can_re_enter_general_at_city(to) { function can_recruit_anything() { for (let p of all_power_generals[game.power]) { // can re-enter generals - if (is_piece_eliminated(p) && has_re_entry_space_for_general()) + if (is_piece_eliminated(p) && has_re_entry_space_for_general(p)) return true // can recruit troops? if (is_piece_on_map(p) && game.troops[p] < 8) @@ -2431,7 +2450,7 @@ states.recruit = { for (let p of all_power_generals[game.power]) { if (is_piece_on_map(p)) av_troops += 8 - game.troops[p] - else if (is_piece_eliminated(p) && has_re_entry_space_for_general()) { + else if (is_piece_eliminated(p) && has_re_entry_space_for_general(p)) { av_general += 1 av_troops += 8 } @@ -2467,7 +2486,7 @@ states.recruit = { for (let p of all_power_generals[game.power]) { if (game.troops[p] > 0 && game.troops[p] < 8) gen_action_piece(p) - else if (is_piece_eliminated(p) && has_re_entry_space_for_general()) + else if (is_piece_eliminated(p) && has_re_entry_space_for_general(p)) gen_action_piece(p) } } @@ -2526,7 +2545,7 @@ states.re_enter_general_where = { prompt() { prompt("Re-enter " + format_selected() + ".") view.selected = game.selected - for (let s of all_home_country_major_fortresses[game.power]) + for (let s of all_re_entry_cities_for_general(game.selected)) if (can_re_enter_general_at_city(s)) gen_action_space(s) }, @@ -2545,7 +2564,7 @@ states.re_enter_general_from_political_card = { prompt() { prompt("Re-enter " + format_selected() + ".") view.selected = game.selected - for (let s of all_home_country_major_fortresses[game.power]) + for (let s of all_re_entry_cities_for_general(game.selected)) if (can_re_enter_general_at_city(s)) gen_action_space(s) }, @@ -3725,7 +3744,7 @@ states.political_troops_place = { for (let p of all_power_generals[game.power]) { if (is_piece_on_map(p) && game.troops[p] < 8) gen_action_piece(p) - if (is_piece_eliminated(p) && has_re_entry_space_for_general()) + if (is_piece_eliminated(p) && has_re_entry_space_for_general(p)) gen_action_piece(p) } } |