summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-18 10:21:28 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:27 +0100
commit6e448b431b2f501832e0a85cbfbc05f9a7892d20 (patch)
tree543a9911c945930efe3da082957236cc2c3f27ea
parent35d0ccdab9db4b9a46f620b0249142626d23817e (diff)
downloadrommel-in-the-desert-6e448b431b2f501832e0a85cbfbc05f9a7892d20.tar.gz
Tweak Refuse Battle prompts.
-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