summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-10-15 15:35:12 +0200
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-10-15 15:35:12 +0200
commitad22b59795da3c5f9ba4eb3d2279c824e071a8d2 (patch)
treec7a52e6a8b2a370ce8522b9856494129e1e59a0d
parent0e39c6726bbf2647b4acbcf598c48345c7049c90 (diff)
downloadalgeria-ad22b59795da3c5f9ba4eb3d2279c824e071a8d2.tar.gz
FLN raid and harass. assisting units should be in OPS
-rw-r--r--rules.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index 65f44c7..504a72e 100644
--- a/rules.js
+++ b/rules.js
@@ -713,6 +713,12 @@ function for_each_friendly_unit_on_map_boxes(boxes, fn) {
fn(u)
}
+function for_each_friendly_unit_in_loc_box(loc, box, fn) {
+ for (let u = first_friendly_unit; u <= last_friendly_unit; ++u)
+ if (unit_loc(u) === loc && unit_box(u) === box)
+ fn(u)
+}
+
function for_each_enemy_unit_in_loc_boxes(loc, boxes, fn) {
for (let u = first_enemy_unit; u <= last_enemy_unit; ++u)
if (unit_loc(u) === loc && boxes.includes(unit_box(u)))
@@ -2638,8 +2644,8 @@ states.fln_strike = {
let first_unit_loc = unit_loc(first_unit)
let can_assist = false
- for_each_friendly_unit_on_map_box(OPS, u => {
- if (unit_loc(u) === first_unit_loc && unit_type(u) === CADRE) {
+ for_each_friendly_unit_in_loc_box(first_unit_loc, OPS, u => {
+ if (unit_type(u) === CADRE) {
gen_action_unit(u)
can_assist = true
}
@@ -2834,7 +2840,7 @@ states.fln_raid = {
let first_unit = game.selected[0]
let first_unit_loc = unit_loc(first_unit)
- for_each_friendly_unit_in_loc(first_unit_loc, u => {
+ for_each_friendly_unit_in_loc_box(first_unit_loc, OPS, u => {
if (is_raid_unit(u)) {
gen_action_unit(u)
}
@@ -2937,7 +2943,7 @@ states.fln_harass = {
gen_action("roll")
}
- for_each_friendly_unit_on_map_box(OPS, u => {
+ for_each_friendly_unit_in_loc_box(first_unit_loc, OPS, u => {
if (is_harass_unit(u)) {
if (set_has(game.selected, u)) {
gen_action_unit(u)