diff options
-rw-r--r-- | play.js | 1 | ||||
-rw-r--r-- | rules.js | 27 |
2 files changed, 17 insertions, 11 deletions
@@ -997,7 +997,6 @@ function on_update() { action_button("eliminate", "Eliminate") action_button("overrun", "Overrun") - action_button("refuse", "Refuse") action_button("retreat", "Retreat") action_button("probe", "Probe") @@ -4292,23 +4292,29 @@ function goto_refuse_battle() { states.refuse_battle = { inactive: "refuse battle", prompt() { - view.prompt = `Refuse Battle: You may retreat from hexes just attacked.` - view.selected_hexes = game.selected + view.selected_hexes = game.refuse for (let x of game.new_battles) if (can_all_undisrupted_units_disengage_and_withdraw(x)) gen_action_hex(x) - if (game.selected >= 0) - gen_action('refuse') - gen_action('pass') + if (game.refuse > 0) { + view.prompt = `Refuse Battle: You may retreat from ${hex_name[game.refuse]}.` + gen_action('retreat') + gen_action('undo') + } else { + view.prompt = `Refuse Battle: Select an attacked hex to refuse battle.` + gen_action('pass') + } + }, + undo() { + game.refuse = 0 }, hex(x) { - if (x === game.selected) - game.selected = -1 + if (x === game.refuse) + game.refuse = 0 else - game.selected = x + game.refuse = x }, - refuse() { - game.refuse = pop_selected() + retreat() { log_h4(`Refused battle at #${game.refuse}`) set_delete(game.new_battles, game.refuse) goto_pursuit_fire_during_refuse_battle(game.refuse) @@ -4679,6 +4685,7 @@ function goto_select_battle() { log(`>#${x}`) } + // TODO: auto-select here? if (game.active_battles.length === 1) goto_battle(game.active_battles[0]) else |