From d331ad044c3c3be4fc057b1b00494a5c6fdc84f9 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 3 Oct 2022 12:50:12 +0200 Subject: Fix hexside disengagement checks. Check that a hexside is passable before counting it as a retreat option. --- rules.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/rules.js b/rules.js index 39338e2..5dca9fe 100644 --- a/rules.js +++ b/rules.js @@ -1871,7 +1871,7 @@ function can_unit_withdraw(who) { let from = unit_hex(who) for_each_adjacent_hex(from, to => { let side = to_side_id(from, to) - if (!has_enemy_unit(to)) + if (side_limit[side] > 0 && !has_enemy_unit(to)) if (sline[side] && sdist[to] <= sdist[from]) result = true }) @@ -1887,7 +1887,7 @@ function can_unit_disengage_and_withdraw(who) { let from = unit_hex(who) for_each_adjacent_hex(from, to => { let side = to_side_id(from, to) - if (!is_enemy_hexside(side) && !has_undisrupted_enemy_unit(to)) + if (side_limit[side] > 0 && !is_enemy_hexside(side) && !has_undisrupted_enemy_unit(to)) if (sline[side] && sdist[to] <= sdist[from]) result = true }) @@ -1900,7 +1900,7 @@ function can_unit_disengage_and_move(who) { let result = false for_each_adjacent_hex(from, to => { let side = to_side_id(from, to) - if (!is_enemy_hexside(side) && !has_undisrupted_enemy_unit(to)) + if (side_limit[side] > 0 && !is_enemy_hexside(side) && !has_undisrupted_enemy_unit(to)) result = true }) return result @@ -3095,15 +3095,9 @@ states.group_move_from = { prompt() { show_move_commands() view.prompt = `Group Move: Select group to move.` - for (let x of game.group) if (x !== game.from1 || game.to1) gen_action_hex(x) - - if (game.turn_option !== 'pass') { - if (has_friendly_unit_in_raw_hex(friendly_queue())) - gen_action_hex(friendly_queue()) - } }, hex(x) { push_undo() -- cgit v1.2.3