summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-10-11 06:33:37 +0200
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-10-11 06:33:37 +0200
commit4ec9f0f35c96ec1a380bcda4289fe7d3e6339529 (patch)
tree6e8edefdf7ba50dacee937c2d22a8049e69c4137 /rules.js
parent567b6650973f33cff8ef3aea3909d4f12e98b26c (diff)
downloadalgeria-4ec9f0f35c96ec1a380bcda4289fe7d3e6339529.tar.gz
supression bugs
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index ca0f539..7b75d17 100644
--- a/rules.js
+++ b/rules.js
@@ -840,10 +840,10 @@ function has_unit_type_in_loc(t, x) {
return false
}
-function count_unit_type_in_loc(t, x) {
+function count_not_neutralized_unit_type_in_loc(t, x) {
let result = 0
for (let u = 0; u <= unit_count; ++u)
- if (unit_loc(u) === x && unit_type(u) === t)
+ if (unit_loc(u) === x && unit_type(u) === t && is_unit_not_neutralized(u))
result += 1
return result
}
@@ -3278,7 +3278,7 @@ states.gov_suppression = {
let loc = unit_loc(unit)
push_undo()
- let assist = count_unit_type_in_loc(loc, EL_X)
+ let assist = count_not_neutralized_unit_type_in_loc(EL_X, loc)
if (assist) {
log(`>in ${areas[loc].name} (with ${assist} Elite)`)
} else {
@@ -3308,7 +3308,7 @@ states.gov_suppression = {
// TODO FLN player chooses which exact units are neutralized)
shuffle(targets)
- for(let u of targets.slice(result)) {
+ for(let u of targets.slice(0, result)) {
log(`>${units[u].name} neutralized`)
set_unit_neutralized(u)
set_unit_box(u, OC)