diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 62 |
1 files changed, 42 insertions, 20 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 }, @@ -3609,11 +3609,13 @@ states.recruit = { for (let p of all_power_generals[game.power]) { if (is_intro() && is_flanders_space(game.pos[p])) continue - if (is_piece_on_map(p)) + if (is_piece_eliminated(p)) { + if (has_re_entry_space_for_general(p)) { + av_general += 1 + av_troops += 8 + } + } else { av_troops += 8 - game.troops[p] - else if (is_piece_eliminated(p) && has_re_entry_space_for_general(p)) { - av_general += 1 - av_troops += 8 } } @@ -3645,10 +3647,13 @@ states.recruit = { for (let p of all_power_generals[game.power]) { if (is_intro() && is_flanders_space(game.pos[p])) continue - 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) + if (is_piece_eliminated(p)) { + if (has_re_entry_space_for_general(p)) + gen_action_piece(p) + } else { + if (game.troops[p] < 8) + gen_action_piece(p) + } } } } @@ -3806,7 +3811,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 +3839,29 @@ 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 (& saxony) combat first; then pragmatic + 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) { + let pp = piece_power[p] + if (pp === P_AUSTRIA || pp === P_SAXONY) + 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 +3875,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 +4525,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 { |