summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/rules.js b/rules.js
index 1909669..ebf090b 100644
--- a/rules.js
+++ b/rules.js
@@ -2681,9 +2681,12 @@ function is_general_without_cu(s) {
function gen_defender_retreat() {
let here = game.move.to
let is_lone = is_general_without_cu(here)
+ let can_retreat = false
for (let to of SPACES[here].adjacent) {
- if (can_defender_retreat(to, is_lone))
+ if (can_defender_retreat(to, is_lone)) {
gen_action_space(to)
+ can_retreat = true
+ }
}
if (game.active === P_BRITAIN) {
let can_sea_retreat = false
@@ -2700,16 +2703,21 @@ function gen_defender_retreat() {
if (to !== game.move.from && is_non_blockaded_port(to)) {
if (!has_american_pc(to) && !has_american_or_french_cu(to)) {
gen_action_space(to)
+ can_retreat = true
}
}
}
}
}
+ if (!can_retreat)
+ view.actions.surrender = 1
}
function gen_attacker_retreat() {
if (can_attacker_retreat())
gen_action_space(game.move.from)
+ else
+ view.actions.surrender = 1
}
function end_retreat_before_battle() {
@@ -2734,12 +2742,6 @@ function goto_retreat_after_battle(victor) {
states.retreat_after_battle = {
prompt() {
view.prompt = "Retreat after battle."
- if (game.active === P_AMERICA)
- view.retreat = find_american_or_french_general(game.move.to)
- else
- view.retreat = find_british_general(game.move.to)
- view.actions.surrender = 1
- // TODO: retreat with 0 CU into lone enemy general
if (game.active === game.combat.attacker)
gen_attacker_retreat()
else