diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-09-18 10:21:28 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 13:11:27 +0100 |
commit | 6e448b431b2f501832e0a85cbfbc05f9a7892d20 (patch) | |
tree | 543a9911c945930efe3da082957236cc2c3f27ea /rules.js | |
parent | 35d0ccdab9db4b9a46f620b0249142626d23817e (diff) | |
download | rommel-in-the-desert-6e448b431b2f501832e0a85cbfbc05f9a7892d20.tar.gz |
Tweak Refuse Battle prompts.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 27 |
1 files changed, 17 insertions, 10 deletions
@@ -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 |