summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-04-28 20:17:54 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-03 18:48:16 +0200
commit4549c4ab9e300193cc485d2f8024d1713dcf8d02 (patch)
tree96c0be358fa3471050f06282b1bc58e5f9be1a18
parent2963cf5d82063c3a7583feea0fad94d55aad91c9 (diff)
downloadandean-abyss-4549c4ab9e300193cc485d2f8024d1713dcf8d02.tar.gz
Events - Log when Free Op/SA cannot be executed.
-rw-r--r--events.txt32
-rw-r--r--rules.js21
2 files changed, 44 insertions, 9 deletions
diff --git a/events.txt b/events.txt
index a35eecd..543a6ae 100644
--- a/events.txt
+++ b/events.txt
@@ -105,6 +105,8 @@ EVENT 8
repeat 3
if can_air_strike()
free_air_strike
+ else
+ log "Government cannot Air Strike."
endif
endrepeat
@@ -241,7 +243,11 @@ EVENT 20
SHADED 20
current FARC
- free_march
+ if can_free_march()
+ free_march
+ else
+ log "FARC cannot March."
+ endif
prompt "Flip up to 3 FARC Guerrillas Underground."
piece_undo_opt 3 is_farc_guerrilla(p) && is_active(p)
underground
@@ -353,6 +359,8 @@ EVENT 27
repeat 3
if can_air_lift() || can_eradicate() || can_air_strike()
free_govt_special_activity
+ else
+ log "Government cannot execute any Special Activities."
endif
endrepeat
@@ -391,6 +399,8 @@ EVENT 29
endpiece
if can_assault_in_space(game.vm.s)
free_assault
+ else
+ log "Government cannot Assault."
endif
endspace
@@ -519,14 +529,18 @@ EVENT 37
SHADED 37
current AUC
- free_march
- prompt "Free Ambush at any 1 destination."
- space 1 set_has(game.vm.march, s) && has_underground_guerrilla(s, AUC) && has_enemy_piece(s)
- prompt "Free Ambush."
- piece 1 is_piece_in_event_space(p) && is_underground_guerrilla(p, AUC)
- free_ambush
- endpiece
- endspace
+ if can_free_march()
+ free_march
+ prompt "Free Ambush at any 1 destination."
+ space 1 set_has(game.vm.march, s) && has_underground_guerrilla(s, AUC) && has_enemy_piece(s)
+ prompt "Free Ambush."
+ piece 1 is_piece_in_event_space(p) && is_underground_guerrilla(p, AUC)
+ free_ambush
+ endpiece
+ endspace
+ else
+ log "AUC cannot March."
+ endif
EVENT 38
prompt "Remove all Active AUC Guerrillas from up to 3 spaces with cubes or Support."
diff --git a/rules.js b/rules.js
index 7721f2a..c4aeb40 100644
--- a/rules.js
+++ b/rules.js
@@ -4170,6 +4170,13 @@ function can_march() {
return false
}
+function can_free_march() {
+ for (let s = first_space; s <= last_space; ++s)
+ if (can_march_to(s))
+ return true
+ return false
+}
+
function has_unmoved_piece(s, faction, type) {
if (game.op && game.op.pieces) {
let first = first_piece[faction][type]
@@ -8413,6 +8420,8 @@ CODE[8 * 2 + 0] = [
[ vm_repeat, 3 ],
[ vm_if, ()=>can_air_strike() ],
[ vm_free_air_strike ],
+ [ vm_else ],
+ [ vm_log, "Government cannot Air Strike." ],
[ vm_endif ],
[ vm_endrepeat ],
[ vm_return ],
@@ -8623,7 +8632,11 @@ CODE[20 * 2 + 0] = [
// SHADED 20
CODE[20 * 2 + 1] = [
[ vm_current, FARC ],
+ [ vm_if, ()=>can_free_march() ],
[ vm_free_march ],
+ [ vm_else ],
+ [ vm_log, "FARC cannot March." ],
+ [ vm_endif ],
[ vm_prompt, "Flip up to 3 FARC Guerrillas Underground." ],
[ vm_piece, true, 0, 3, (p,s)=>is_farc_guerrilla(p) && is_active(p) ],
[ vm_underground ],
@@ -8773,6 +8786,8 @@ CODE[27 * 2 + 0] = [
[ vm_repeat, 3 ],
[ vm_if, ()=>can_air_lift() || can_eradicate() || can_air_strike() ],
[ vm_free_govt_special_activity ],
+ [ vm_else ],
+ [ vm_log, "Government cannot execute any Special Activities." ],
[ vm_endif ],
[ vm_endrepeat ],
[ vm_return ],
@@ -8821,6 +8836,8 @@ CODE[29 * 2 + 0] = [
[ vm_endpiece ],
[ vm_if, ()=>can_assault_in_space(game.vm.s) ],
[ vm_free_assault ],
+ [ vm_else ],
+ [ vm_log, "Government cannot Assault." ],
[ vm_endif ],
[ vm_endspace ],
[ vm_return ],
@@ -8998,6 +9015,7 @@ CODE[37 * 2 + 0] = [
// SHADED 37
CODE[37 * 2 + 1] = [
[ vm_current, AUC ],
+ [ vm_if, ()=>can_free_march() ],
[ vm_free_march ],
[ vm_prompt, "Free Ambush at any 1 destination." ],
[ vm_space, true, 1, 1, (s)=>set_has(game.vm.march, s) && has_underground_guerrilla(s, AUC) && has_enemy_piece(s) ],
@@ -9006,6 +9024,9 @@ CODE[37 * 2 + 1] = [
[ vm_free_ambush ],
[ vm_endpiece ],
[ vm_endspace ],
+ [ vm_else ],
+ [ vm_log, "AUC cannot March." ],
+ [ vm_endif ],
[ vm_return ],
]