diff options
author | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-10-27 17:31:39 +0200 |
---|---|---|
committer | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-10-27 17:31:39 +0200 |
commit | 4ac9f4d99ce7f99cb14a17ddd213752a041097b8 (patch) | |
tree | cab98a3a87e14a13503399adc7d67954097cbbb6 | |
parent | 449c02b36ce1772cee4325faf0b5facbbc42e73e (diff) | |
download | algeria-4ac9f4d99ce7f99cb14a17ddd213752a041097b8.tar.gz |
Flush: potential airmobilized units
-rw-r--r-- | rules.js | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -663,6 +663,10 @@ function is_harass_unit(u) { return (type === BAND || type === FAILEK) && is_unit_not_neutralized(u) && is_area_algerian(loc) && has_enemy_unit_in_loc(loc) } +function is_potential_airmobile_flush_unit(u) { + return can_airmobilize_unit(u) && airmobilize_cost([u]) <= game.helo_avail && is_unit_not_neutralized(u) && has_enemy_unit_in_boxes([OPS, OC]) +} + function is_airmobile_flush_unit(u) { return is_unit_airmobile(u) && is_unit_not_neutralized(u) && has_enemy_unit_in_boxes([OPS, OC]) } @@ -3800,7 +3804,7 @@ states.gov_operations = { view.actions.population_resettlement = 0 for_each_friendly_unit_on_map_boxes([OPS, PTL], u => { - if (is_flush_unit(u) || is_airmobile_flush_unit(u)) { + if (is_flush_unit(u) || is_airmobile_flush_unit(u) || is_potential_airmobile_flush_unit(u)) { view.actions.flush = 1 } if (game.gov_psl > GOV_INTELLIGENCE_COST && is_intelligence_unit(u)) { @@ -3878,13 +3882,19 @@ states.gov_flush = { inactive: "to do Flush mission", prompt() { view.prompt = "Flush: Select location" + let has_loc = false for_each_algerian_map_area(loc => { - if (has_enemy_unit_in_loc_boxes(loc, [OPS, OC]) && has_gov_react_units_in_loc(loc)) + if (has_enemy_unit_in_loc_boxes(loc, [OPS, OC]) && has_gov_react_units_in_loc(loc)) { gen_action_loc(loc) + has_loc = true + } }) - if (game.helo_avail && can_airmobilize_any_unit()) + if (game.helo_avail && can_airmobilize_any_unit()) { + if (!has_loc) + view.prompt = "Flush: Select location (you need to Airmobilize first)" gen_action("airmobilize") + } }, airmobilize() { push_undo() |