diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-10-03 12:50:12 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 13:11:27 +0100 |
commit | d331ad044c3c3be4fc057b1b00494a5c6fdc84f9 (patch) | |
tree | 643127ad1dd072afff4b2c2580522dd350200ba6 | |
parent | e2b4501b9655dae272187860ca6cbe478783e4de (diff) | |
download | rommel-in-the-desert-d331ad044c3c3be4fc057b1b00494a5c6fdc84f9.tar.gz |
Fix hexside disengagement checks.
Check that a hexside is passable before counting it as a retreat option.
-rw-r--r-- | rules.js | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -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() |