From 485e37962c9d30d08a8c7b132f3b0eab64df4015 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 4 May 2021 15:23:56 +0200 Subject: 300: fix land retreat --- rules.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rules.js b/rules.js index 2cc124a..dccbcea 100644 --- a/rules.js +++ b/rules.js @@ -1704,7 +1704,7 @@ function resume_greek_land_battle(_, current) { end_battle(); } -function gen_land_retreat_attacker(view) { +function gen_land_retreat_attacker(view, is_friendly_control) { // RULES: if land movement started in neighboring city, do they have to // retreat to origin city if it is neighboring, or could they have gone // a circuitous route to attack from another direction? @@ -1712,7 +1712,7 @@ function gen_land_retreat_attacker(view) { gen_action(view, 'city', game.from); else for (let city of ROADS[game.where]) - if (city in game.move_list) + if (is_friendly_control(city) && city in game.move_list) gen_action(view, 'city', city); } @@ -1724,7 +1724,7 @@ states.persian_land_retreat_attacker = { if (game.naval_battle) gen_action(view, 'port', game.from); else - gen_land_retreat_attacker(view); + gen_land_retreat_attacker(view, is_persian_control); gen_action(view, 'city', game.where); // shortcut for battle gen_action(view, 'battle'); }, @@ -1758,7 +1758,7 @@ states.greek_land_retreat_attacker = { if (game.naval_battle) gen_action(view, 'port', game.from); else - gen_land_retreat_attacker(view); + gen_land_retreat_attacker(view, is_greek_control); gen_action(view, 'city', game.where); // shortcut for battle gen_action(view, 'battle'); }, -- cgit v1.2.3