summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.js1
-rw-r--r--rules.js27
2 files changed, 17 insertions, 11 deletions
diff --git a/play.js b/play.js
index 1535599..d34fc0e 100644
--- a/play.js
+++ b/play.js
@@ -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")
diff --git a/rules.js b/rules.js
index 5a7658c..b072ae1 100644
--- a/rules.js
+++ b/rules.js
@@ -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