summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js54
1 files changed, 46 insertions, 8 deletions
diff --git a/rules.js b/rules.js
index f83598c..d4f96e9 100644
--- a/rules.js
+++ b/rules.js
@@ -4032,20 +4032,58 @@ function reduce_fln_unit(from_type, to_type) {
continue_combat_after_fln_losses()
}
+function eliminate_fln_unit_2(u) {
+ push_undo()
+ eliminate_unit(u)
+ set_delete(game.combat.fln_units, u)
+ game.combat.distribute_fln_hits -= 1
+ if (!game.combat.distribute_fln_hits || !game.combat.fln_units.length)
+ continue_combat_after_fln_losses()
+}
+
+function reduce_fln_unit_2(u, to_type) {
+ push_undo()
+ let n = reduce_unit(u, to_type)
+ set_add(game.combat.fln_units, n)
+ set_delete(game.combat.fln_units, u)
+ game.combat.distribute_fln_hits -= 1
+ if (!game.combat.distribute_fln_hits || !game.combat.fln_units.length)
+ continue_combat_after_fln_losses()
+}
+
states.fln_combat_fln_losses = {
inactive: "to distribute combat losses",
prompt() {
view.prompt = `Distribute ${game.combat.distribute_fln_hits} hit(s) as losses.`
// each 'hit' on FLN units eliminates one Cadre or Band, or reduces a Front to a Cadre, or reduces a Failek to a Band (FLN player chooses how to distribute his losses).
- if (has_fln_combat_unit(CADRE))
- gen_action("eliminate_cadre")
- if (has_fln_combat_unit(BAND))
- gen_action("eliminate_band")
- if (has_fln_combat_unit(FRONT))
- gen_action("reduce_front")
- if (has_fln_combat_unit(FAILEK))
- gen_action("reduce_failek")
+ if (0) {
+ if (has_fln_combat_unit(CADRE))
+ gen_action("eliminate_cadre")
+ if (has_fln_combat_unit(BAND))
+ gen_action("eliminate_band")
+ if (has_fln_combat_unit(FRONT))
+ gen_action("reduce_front")
+ if (has_fln_combat_unit(FAILEK))
+ gen_action("reduce_failek")
+ } else {
+ for (let u of game.combat.fln_units)
+ gen_action_unit(u)
+ }
+ },
+ unit(u) {
+ switch (unit_type(u)) {
+ case FRONT:
+ reduce_fln_unit_2(u, CADRE)
+ break
+ case FAILEK:
+ reduce_fln_unit_2(u, BAND)
+ break
+ case BAND:
+ case CADRE:
+ eliminate_fln_unit_2(u)
+ break
+ }
},
eliminate_cadre() {
eliminate_fln_unit(CADRE)