diff options
-rw-r--r-- | rules.js | 62 |
1 files changed, 33 insertions, 29 deletions
@@ -5800,16 +5800,13 @@ function gen_spending_bps() { let from = unit_hex(who) // Receive replacement in base - if (from === base) { - if (unit_lost_steps(who) > 0 && bps >= replacement_cost(who)) + if (from === base && unit_lost_steps(who) > 0) { + if (bps >= replacement_cost(who)) view.actions.replacement = 1 else view.actions.replacement = 0 } - // Quick deselect - gen_action_hex(from) - if (can_redeploy_from(from)) { search_redeploy(from) @@ -5854,20 +5851,19 @@ states.spending_bps = { inactive: "buildup", prompt() { view.prompt = `Buildup: Spend buildup points (${available_bps()} remain).` + let bps = available_bps() + for_each_friendly_unit_on_map(u => { + if (is_unit_undisrupted(u)) + gen_action_unit(u) + }) if (game.selected < 0) { - let bps = available_bps() + if (game.month >= 11 && has_friendly_unit_in_raw_hex(MALTA)) + gen_action_hex(MALTA) if (count_secret_minefields() >= 2 || bps >= 15) gen_action('minefield') if (bps >= 10) gen_action('extra_supply_card') - for_each_friendly_unit_on_map(u => { - if (is_unit_undisrupted(u)) - gen_action_unit(u) - }) - if (game.month >= 11 && has_friendly_unit_in_raw_hex(MALTA)) - gen_action_hex(MALTA) } else { - gen_action_unit(game.selected) gen_spending_bps() } gen_action('end_buildup') @@ -5878,10 +5874,18 @@ states.spending_bps = { game.selected = who game.buildup.changed = 0 } else { - if (!game.buildup.changed) - pop_undo() - else + if (who === game.selected) { + if (!game.buildup.changed) + pop_undo() + else + game.selected = -1 + } else { game.selected = -1 + if (game.buildup.changed) + push_undo() + game.selected = who + game.buildup.changed = 0 + } } }, extra_supply_card() { @@ -5956,24 +5960,24 @@ states.spending_bps = { } }, end_buildup() { - game.selected = -1 - clear_undo() - - print_buildup_summary() - - let n = available_bps() - if (n > 20) { - log(`Lost ${n - 20} unspent BPs.`) - pay_bps(n - 20) - } - - log(`Saved ${available_bps()} BPs.`) - end_buildup_spending() } } function end_buildup_spending() { + game.selected = -1 + clear_undo() + + print_buildup_summary() + + let n = available_bps() + if (n > 20) { + log(`Lost ${n - 20} unspent BPs.`) + pay_bps(n - 20) + } + + log(`Saved ${available_bps()} BPs.`) + if (is_active_player()) { set_enemy_player() goto_buildup_discard() |