diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-09-03 17:35:28 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 13:11:27 +0100 |
commit | d93ae767fd030a6e2f90adab2ff5c3b183782cd6 (patch) | |
tree | f5631d585b4455663d787f020c3f7396ca527091 /rules.js | |
parent | 2b557144914e935301e86565abd110f030232896 (diff) | |
download | rommel-in-the-desert-d93ae767fd030a6e2f90adab2ff5c3b183782cd6.tar.gz |
Don't highlight pass turn group non-retreat moves with disrupted units.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -680,6 +680,12 @@ function has_undisrupted_friendly_unit(x) { return has_undisrupted_allied_unit(x) } +function has_disrupted_friendly_unit(x) { + if (game.active === AXIS) + return has_disrupted_axis_unit(x) + return has_disrupted_allied_unit(x) +} + function has_enemy_unit(x) { if (game.active === ALLIED) return has_axis_unit(x) @@ -2045,7 +2051,7 @@ function is_valid_withdrawal_group_move_from(x) { return can_all_undisrupted_units_disengage_and_withdraw(x) } else { // non-retreat withdrawal, check if network is reduced after we leave this hex - if (can_all_undisrupted_units_withdraw(x)) { + if (!has_disrupted_friendly_unit(x) && can_all_undisrupted_units_withdraw(x)) { // All units in hex have the same supply source let src = hex_supply_source(x) let net = hex_supply_network(x) @@ -3051,9 +3057,12 @@ states.group_move_from = { mandatory = true } if (!mandatory) { - for (let x of all_hexes) - if (has_undisrupted_friendly_unit(x) && is_valid_withdrawal_group_move_from(x)) - gen_action_hex(x) + for (let x of all_hexes) { + if (has_undisrupted_friendly_unit(x)) { + if (is_valid_withdrawal_group_move_from(x)) + gen_action_hex(x) + } + } } } }, @@ -5208,13 +5217,13 @@ function roll_pursuit_fire_imp(who, n, hp) { } if (n === 1) { let a = roll_die() - game.flash = `${speed_name_cap[speed]} fired ${a}.` if (a >= 4) { game.hits++ a = die_face_hit[a] } else { a = die_face_miss[a] } + game.flash = `${speed_name_cap[speed]} fired ${a}.` } log(game.flash) if (game.hits > hp) @@ -5440,12 +5449,15 @@ function end_buildup_supply_check() { } function goto_buildup_supply_check_recover() { + let summary = [] for_each_friendly_unit_on_map(u => { if (is_unit_supplied(u) && is_unit_disrupted(u) && !is_battle_hex(unit_hex(u))) { - log(`Recovered at #${unit_hex(u)}.`) + set_add(summary, unit_hex(u)) clear_unit_disrupted(u) } }) + for (let x of summary) + log(`Recovered at #${x}.`) resume_buildup_eliminate_unsupplied() } |