diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -5252,19 +5252,37 @@ function fastest_undisrupted_friendly_unit_speed(where) { return r } +function has_hidden_friendly_unit(x) { + for (let u = first_friendly_unit; u <= last_friendly_unit; ++u) + if (unit_hex(u) === x && !set_has(game.revealed, u)) + return true + return false +} + function goto_rout_fire(where) { set_enemy_player() game.hits = 0 game.pursuit = where + game.flash = "" + let slowest = slowest_enemy_unit_speed(game.pursuit) + let fastest = fastest_undisrupted_friendly_unit_speed(game.pursuit) + log(`Slowest was ${speed_name[slowest]} unit.`) - game.state = 'rout_fire' + if (slowest <= fastest || has_hidden_friendly_unit(game.pursuit)) { + game.state = 'rout_fire' + } else { + // too fast for pursuit fire, and we already know all the units involved + set_enemy_player() + end_rout_fire() + } } function goto_pursuit_fire_during_retreat(where) { set_passive_player() game.hits = 0 game.pursuit = where + game.flash = "" let slowest = slowest_undisrupted_enemy_unit_speed(game.pursuit) let fastest = fastest_undisrupted_friendly_unit_speed(game.pursuit) |