summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js37
1 files changed, 35 insertions, 2 deletions
diff --git a/rules.js b/rules.js
index d26cff5..e3ca589 100644
--- a/rules.js
+++ b/rules.js
@@ -3723,12 +3723,22 @@ function vm_free_assault_cartels() {
goto_assault_space()
}
+function must_air_lift_to_assault(state) {
+ if (state === "assault" && game.op.spaces.length === 0) {
+ for (let s = first_space; s <= last_space; ++s)
+ if (can_assault_in_space(s, 0))
+ return false
+ return true
+ }
+ return false
+}
+
function can_assault() {
if (game.sa && can_air_lift()) {
for (let s = first_space; s <= last_space; ++s)
if (has_assault_target(s, 0))
return true
- return true
+ return false
}
for (let s = first_space; s <= last_space; ++s)
if (can_assault_in_space(s, 0))
@@ -4744,7 +4754,13 @@ function gen_special_activity(faction, action, enable) {
function gen_govt_special_activity() {
if (game.sa) {
- // TODO: if Assault and no valid assault targets, only allow air lift!
+ if (must_air_lift_to_assault(game.state)) {
+ // if Assault and no valid assault targets, only allow air lift!
+ view.actions.air_lift = can_air_lift() ? 1 : 0
+ view.actions.eradicate = 0
+ view.actions.air_strike = 0
+ return
+ }
view.actions.air_lift = can_air_lift() ? 1 : 0
view.actions.eradicate = can_eradicate() ? 1 : 0
view.actions.air_strike = can_air_strike() ? 1 : 0
@@ -4830,6 +4846,16 @@ states.air_lift_to = {
view.prompt = "Air Lift: Select destination space."
view.where = game.sa.from
let manpad = has_momentum(MOM_MISIL_ANTIAEREO)
+
+ if (must_air_lift_to_assault(game.sa.save)) {
+ // if Assault and no valid assault targets, only allow air lift to assault enabling spaces!
+ for (let s = first_space; s <= last_space; ++s)
+ if (s !== game.sa.from && can_air_lift_to(manpad, s))
+ if (has_assault_target(s))
+ gen_action_space(s)
+ return
+ }
+
for (let s = first_space; s <= last_space; ++s)
if (s !== game.sa.from && can_air_lift_to(manpad, s))
gen_action_space(s)
@@ -4854,6 +4880,13 @@ states.air_lift_move = {
view.prompt = `Air Lift: Move Troops from ${space_name[game.sa.from]} to ${space_name[game.sa.to]}.`
view.where = game.sa.to
gen_piece_in_space(game.sa.from, GOVT, TROOPS)
+
+ if (game.sa.count < 1 && must_air_lift_to_assault(game.sa.save)) {
+ // if Assault and no valid assault targets, only allow air lift to assault enabling spaces!
+ view.actions.end_air_lift = 0
+ return
+ }
+
view.actions.end_air_lift = 1
},
piece(p) {