diff options
-rw-r--r-- | rules.js | 53 |
1 files changed, 37 insertions, 16 deletions
@@ -1479,8 +1479,8 @@ const advanced_sequence_of_play = [ { power: P_PRAGMATIC, action: goto_movement }, { power: P_PRAGMATIC, action: validate_end_movement }, + // austria + pragmatic shared combat phase { power: P_AUSTRIA, action: goto_combat }, - { power: P_PRAGMATIC, action: goto_combat }, { power: P_AUSTRIA, action: end_action_stage }, { power: P_FRANCE, action: goto_end_turn }, @@ -3645,7 +3645,7 @@ states.recruit = { for (let p of all_power_generals[game.power]) { if (is_intro() && is_flanders_space(game.pos[p])) continue - if (game.troops[p] > 0 && game.troops[p] < 8) + if (is_piece_on_map(p) && game.troops[p] > 0 && game.troops[p] < 8) gen_action_piece(p) else if (is_piece_eliminated(p) && has_re_entry_space_for_general(p)) gen_action_piece(p) @@ -3806,7 +3806,7 @@ function goto_combat() { let from = [] let to = [] - for (let p of all_controlled_generals(game.power)) { + for (let p of all_coop_generals(game.power)) { if (piece_power[p] === P_PRUSSIA && is_prussia_neutral()) continue if (piece_power[p] === P_SAXONY && is_saxony_neutral()) @@ -3834,14 +3834,26 @@ function goto_combat() { } } - if (game.combat.length > 0) - game.state = "combat" - else - goto_retroactive_conquest() + next_combat() } -function next_combat() { +function set_active_to_next_combat_power() { set_active_to_current_sequence_of_play() + if (is_intro() || is_two_player()) + return + // resolve all austria combat first + if (game.power === P_AUSTRIA) { + for (let i = 0; i < game.combat.length; i += 2) { + let p = get_supreme_commander(game.combat[i]) + if (p >= 0 && piece_power[p] === P_AUSTRIA) + return + } + set_active_to_power(P_PRAGMATIC) + } +} + +function next_combat() { + set_active_to_next_combat_power() game.count = 0 delete game.attacker delete game.defender @@ -3855,8 +3867,11 @@ states.combat = { inactive: "attack", prompt() { prompt("Resolve your attacks.") - for (let i = 0; i < game.combat.length; i += 2) - gen_action_supreme_commander(game.combat[i]) + for (let i = 0; i < game.combat.length; i += 2) { + let p = get_supreme_commander(game.combat[i]) + if (p >= 0 && is_controlled_power(game.power, piece_power[p])) + gen_action_piece(p) + } }, piece(p) { push_undo() @@ -4502,9 +4517,8 @@ function goto_retroactive_conquest() { apply_retroactive_conquest(conq, game.power) } } else { - if (game.power === P_AUSTRIA) { - // wait until pragmatic has also finished combat - } else if (game.power === P_PRAGMATIC) { + if (game.power === P_AUSTRIA || game.power === P_PRAGMATIC) { + // shared combat phase apply_retroactive_conquest(conq, P_AUSTRIA) apply_retroactive_conquest(conq, P_PRAGMATIC) } else { @@ -5498,9 +5512,16 @@ states.send_expeditionary_corps = { inactive: "send expeditionary corps off map", prompt() { prompt("Send expeditionary corps to off map box.") - for (let p of all_power_generals[game.power]) - if (is_piece_on_map_or_eliminated(p)) - gen_action_piece(p) + + let tc_in_hand = 0 + for_each_card_in_hand(c => tc_in_hand += to_value(c)) + + for (let p of all_power_generals[game.power]) { + if (is_piece_on_map_or_eliminated(p)) { + if (game.troops[p] > 0 || tc_in_hand >= 8) + gen_action_piece(p) + } + } }, piece(p) { push_undo() |