diff options
author | Tor Andersson <tor@ccxvii.net> | 2025-02-15 11:55:27 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2025-02-15 12:09:20 +0100 |
commit | b38f9a790f41a20da5959563a23527135e4b28ac (patch) | |
tree | 73c4ae54205233764c1e653152899119671f8388 | |
parent | 84ab6403892145231e8c9a173822de79e378e3f4 (diff) | |
download | andean-abyss-relax-513.tar.gz |
Change event 65 - Poppies.relax-513
DO (place shipment and base) or (remove shipment and base)
NOT (place or remove shipment) and (place or remove base)
-rw-r--r-- | events.txt | 24 | ||||
-rw-r--r-- | play.js | 1 | ||||
-rw-r--r-- | rules.js | 140 |
3 files changed, 83 insertions, 82 deletions
@@ -1070,12 +1070,26 @@ SHADED 64 resources CARTELS (game.vm.total) EVENT 65 - # 5.1.3 - do both shipment and base if possible prompt "Place or remove 1 Shipment and Insurgent Base in any Mountain Department." - if_space is_mountain(s) && ( can_place_or_remove_shipment(s) && can_place_or_remove_insurgent_base(s) ) - or_space is_mountain(s) && ( can_place_or_remove_shipment(s) || can_place_or_remove_insurgent_base(s) ) - place_or_remove_shipment - place_or_remove_insurgent_base + space 1 is_mountain(s) && ( can_place_or_remove_shipment(s) || can_place_or_remove_insurgent_base(s) ) + place_or_remove + if game.vm.choice === "place" + prompt "Place Shipment." + piece_undo 1 is_piece_in_event_space(p) && is_any_guerrilla(p) + place_shipment + endpiece + prompt "Place Insurgent Base." + place FARC_AUC_CARTELS BASE + else + prompt "Remove Shipment." + shipment 1 (s === game.vm.s) + remove_shipment + endshipment + prompt "Remove Insurgent Base." + piece all is_piece_in_event_space(p) && is_insurgent_base(p) + remove + endpiece + endif endspace EVENT 66 @@ -1424,6 +1424,7 @@ function on_update() { action_button("support", "Support") action_button("opposition", "Opposition") + action_button("place", "Place") action_button("remove", "Remove") action_button("roll", "Roll") action_button("skip", "Skip") @@ -717,6 +717,10 @@ function is_insurgent_piece(p) { return is_farc_piece(p) || is_auc_piece(p) || is_cartels_piece(p) } +function is_insurgent_base(p) { + return is_farc_base(p) || is_auc_base(p) || is_cartels_base(p) +} + function is_active_guerrilla(p, faction) { return is_piece(p, faction, GUERRILLA) && is_active(p) } @@ -7834,95 +7838,65 @@ states.vm_set_passive_support_or_passive_opposition = { }, } -function can_place_or_remove_shipment(s) { - if (has_available_shipment() && has_any_guerrilla(s)) - return true - if (is_any_shipment_held_in_space(s)) - return true - return false +function can_place_shipment(s) { + return (has_available_shipment() && has_any_guerrilla(s)) } -function vm_place_or_remove_shipment() { - if (can_place_or_remove_shipment(game.vm.s)) - game.state = "vm_place_or_remove_shipment" - else - vm_next() +function can_remove_shipment(s) { + return (is_any_shipment_held_in_space(s)) } -states.vm_place_or_remove_shipment = { - prompt() { - event_prompt(`Place or remove Shipment in ${space_name[game.vm.s]}.`) - for (let sh = 0; sh < 4; ++sh) - if (is_shipment_held_in_space(sh, game.vm.s)) - gen_action_shipment(sh) - let sh = find_available_shipment() - if (sh >= 0) - gen_action_shipment(sh) - }, - shipment(sh) { - push_undo() - if (is_shipment_held_in_space(sh, game.vm.s)) { - let p = get_held_shipment_piece(sh) - log("Removed Shipment from " + piece_faction_name(p) + " in S" + piece_space(p) + ".") - remove_shipment(sh) - vm_next() - } else { - game.state = "vm_place_or_remove_shipment_place" - } - }, +function can_place_insurgent_base(s) { + return (can_place_piece(s, FARC, BASE) || can_place_piece(s, AUC, BASE) || can_place_piece(s, CARTELS, BASE)) } -states.vm_place_or_remove_shipment_place = { - prompt() { - event_prompt(`Place Shipment in ${space_name[game.vm.s]}.`) - view.selected_shipment = find_available_shipment() - gen_piece_in_space(game.vm.s, FARC, GUERRILLA) - gen_piece_in_space(game.vm.s, AUC, GUERRILLA) - gen_piece_in_space(game.vm.s, CARTELS, GUERRILLA) - }, - piece(p) { - push_undo() - let sh = find_available_shipment() - log("Placed Shipment with " + piece_faction_name(p) + " in S" + piece_space(p) + ".") - place_shipment(sh, p) - vm_next() - }, +function can_remove_insurgent_base(s) { + return (has_piece(s, FARC, BASE) || has_piece(s, AUC, BASE) || has_piece(s, CARTELS, BASE)) +} + +function can_place_or_remove_shipment(s) { + return can_place_shipment(s) || can_remove_shipment(s) } function can_place_or_remove_insurgent_base(s) { - if (can_place_piece(s, FARC, BASE) || can_place_piece(s, AUC, BASE) || can_place_piece(s, CARTELS, BASE)) - return true - if (has_piece(s, FARC, BASE) || has_piece(s, AUC, BASE) || has_piece(s, CARTELS, BASE)) - return true - return false + return can_place_insurgent_base(s) || can_remove_insurgent_base(s) } -function vm_place_or_remove_insurgent_base() { - if (can_place_or_remove_insurgent_base(game.vm.s)) - game.state = "vm_place_or_remove_insurgent_base" - else +function vm_place_or_remove() { + let p = can_place_shipment(game.vm.s) || can_place_insurgent_base(game.vm.s) + let r = can_remove_shipment(game.vm.s) || can_remove_insurgent_base(game.vm.s) + if (p && !r) { + game.vm.choice = "place" + vm_next() + } else if (!p && r) { + game.vm.choice = "remove" vm_next() + } else { + game.state = "vm_place_or_remove" + } } -states.vm_place_or_remove_insurgent_base = { +states.vm_place_or_remove = { prompt() { - event_prompt(`Place or remove Insurgent Base in ${space_name[game.vm.s]}.`) - gen_piece_in_space(game.vm.s, FARC, BASE) - gen_piece_in_space(game.vm.s, AUC, BASE) - gen_piece_in_space(game.vm.s, CARTELS, BASE) - gen_place_piece(game.vm.s, FARC, BASE) - gen_place_piece(game.vm.s, AUC, BASE) - gen_place_piece(game.vm.s, CARTELS, BASE) + event_prompt(`Place or remove Shipment and Insurgent Base?`) + view.where = game.vm.s + if (can_place_shipment(game.vm.s) || can_place_insurgent_base(game.vm.s)) + view.actions.place = 1 + else + view.actions.place = 0 + if (can_remove_shipment(game.vm.s) || can_remove_insurgent_base(game.vm.s)) + view.actions.remove = 1 + else + view.actions.remove = 0 }, - piece(p) { + place() { push_undo() - if (piece_space(p) === game.vm.s) { - log("Removed " + piece_name(p) + " from S" + game.vm.s + ".") - remove_piece(p) - } else { - log("Placed " + piece_name(p) + " in S" + game.vm.s + ".") - place_piece(p, game.vm.s) - } + game.vm.choice = "place" + vm_next() + }, + remove() { + push_undo() + game.vm.choice = "remove" vm_next() }, } @@ -10042,13 +10016,25 @@ CODE[64 * 2 + 1] = [ // EVENT 65 CODE[65 * 2 + 0] = [ [ vm_prompt, "Place or remove 1 Shipment and Insurgent Base in any Mountain Department." ], - [ vm_if, ()=>can_vm_space(1,(s)=>is_mountain(s) && ( can_place_or_remove_shipment(s) && can_place_or_remove_insurgent_base(s) )) ], - [ vm_space, true, 1, 1, (s)=>is_mountain(s) && ( can_place_or_remove_shipment(s) && can_place_or_remove_insurgent_base(s) ) ], - [ vm_else ], [ vm_space, true, 1, 1, (s)=>is_mountain(s) && ( can_place_or_remove_shipment(s) || can_place_or_remove_insurgent_base(s) ) ], + [ vm_place_or_remove ], + [ vm_if, ()=>game.vm.choice === "place" ], + [ vm_prompt, "Place Shipment." ], + [ vm_piece, true, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_any_guerrilla(p) ], + [ vm_place_shipment ], + [ vm_endpiece ], + [ vm_prompt, "Place Insurgent Base." ], + [ vm_place, false, 0, FARC_AUC_CARTELS, BASE ], + [ vm_else ], + [ vm_prompt, "Remove Shipment." ], + [ vm_shipment, false, 1, 1, (p,s)=>(s === game.vm.s) ], + [ vm_remove_shipment ], + [ vm_endshipment ], + [ vm_prompt, "Remove Insurgent Base." ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_insurgent_base(p) ], + [ vm_remove ], + [ vm_endpiece ], [ vm_endif ], - [ vm_place_or_remove_shipment ], - [ vm_place_or_remove_insurgent_base ], [ vm_endspace ], [ vm_return ], ] |