From 3341f4689fff6b684fce4a4b65d2f83cec122557 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 8 Apr 2023 13:25:49 +0200 Subject: Event code - all instead of 0. Use min/max values in opcode instead of "skip" boolean, to possibly allow for ranges 1-3 for "up to" instead of 0-3. 5.1.3 - place base if able --- events.txt | 306 ++++++++++++++++------------ info/cards.html | 11 +- rules.js | 595 +++++++++++++++++++++++++++++++------------------------ tools/gencode.js | 71 +++---- 4 files changed, 547 insertions(+), 436 deletions(-) diff --git a/events.txt b/events.txt index b8186e3..e44ec9c 100644 --- a/events.txt +++ b/events.txt @@ -3,17 +3,23 @@ # TODO: format prompt "Remove N Piece(s)" # TODO: prompt wording to match card texts -# TODO: piece/space_opt_1 - optional if at least 1 - -# TODO: 5.1.3 - as much as possible - for doing multiple things in one space -# 14, 34, 49 (place base + other piece) priority to spaces with room for all available pieces -# 65 priority to where both (place or remove shipment) and (place or remove insurgent base) - -# TODO: replace pieces - must check stacking if replacement piece is available -# 35, 39, 40, 50, 54, 57, 72 - # TODO: allow voluntarily removing pieces before taking event (but disable passing if did so) -# - needed for 66 shaded (within stacking place base) etc + +# Notes on difficult events: +# +# 5.1.3 - must place/remove multiple pieces base if able +# 14, shaded 14, shaded 34, shaded 49 +# 30 remove farc zone and remove farc base +# 43 place terror and remove farc base +# 65 (place or remove shipment) and (place or remove insurgent base) +# TODO: shaded 24 (2 troops) +# +# Replace pieces - may only remove when unable to place available piece (check stacking if piece is available) +# 35, shaded 39, 40, shaded 50, 54, 57, shaded 57, 72 +# +# Remove X or replace X - exclusive choices +# shaded 50, 54 +# EVENT 1 log "1 Civic Action space each Support Phase requires Government Control and any cube." @@ -147,9 +153,15 @@ SHADED 13 EVENT 14 current GOVT prompt "Place 1 Base and 3 Troops into any Department." - # TODO: 5.1.3 do as much as can! + # 5.1.3 - place base if possible! + space 1 is_dept(s) && can_place_piece(s, GOVT, BASE) + auto_place GOVT BASE + auto_place GOVT TROOPS + auto_place GOVT TROOPS + auto_place GOVT TROOPS + return + endspace space 1 is_dept(s) && can_stack_any(s, GOVT) - # TODO: auto or manual ? auto_place GOVT BASE auto_place GOVT TROOPS auto_place GOVT TROOPS @@ -158,7 +170,8 @@ EVENT 14 SHADED 14 prompt "Remove 1 Government Base and 1 cube from a Department." - space 1 is_dept(s) && has_faction_piece(s, GOVT) + # 5.1.3 - remove both base and cube if possible + space 1 is_dept(s) && ( has_govt_base(s) && has_cube(s) ) prompt `Remove Government Base from ${space_name[game.vm.s]}.` piece 1 is_piece_in_event_space(p) && is_govt_base(p) remove @@ -167,6 +180,18 @@ SHADED 14 piece 1 is_piece_in_event_space(p) && is_cube(p) remove endpiece + return + endspace + space 1 is_dept(s) && ( has_govt_base(s) || has_cube(s) ) + prompt `Remove Government Base from ${space_name[game.vm.s]}.` + piece 1 is_piece_in_event_space(p) && is_govt_base(p) + remove + endpiece + prompt `Remove cube from ${space_name[game.vm.s]}.` + piece 1 is_piece_in_event_space(p) && is_cube(p) + remove + endpiece + return endspace EVENT 15 @@ -181,7 +206,7 @@ SHADED 15 EVENT 16 prompt "Each Mountain, +5 Resources to Faction with most pieces." - space 0 is_mountain(s) + space all is_mountain(s) auto_resources (faction_with_most_pieces(game.vm.s)) 5 endspace @@ -208,12 +233,12 @@ SHADED 18 EVENT 19 if game.current === GOVT prompt "Free Sweep or Assault in each space possible." - space 0 can_sweep_activate(s) || can_assault_any(s) + space all can_sweep_activate(s) || can_assault_any(s) free_sweep_assault endspace else prompt "Free Attack or Terror in each space possible." - space 0 can_terror(s) || can_attack(s) + space all can_terror(s) || can_attack(s) free_attack_terror endspace endif @@ -264,11 +289,11 @@ EVENT 23 prompt "In a Department, Activate all Guerrillas and remove all Cartels Bases." space 1 is_dept(s) && (has_any_underground_guerrilla(s) || has_cartels_base(s)) prompt "Activate all Guerrillas." - piece 0 is_piece_in_event_space(p) && is_any_guerrilla(p) && is_underground(p) + piece all is_piece_in_event_space(p) && is_any_guerrilla(p) && is_underground(p) activate endpiece prompt "Remove all Cartels Bases." - piece 0 is_piece_in_event_space(p) && is_cartels_base(p) + piece all is_piece_in_event_space(p) && is_cartels_base(p) remove endpiece endspace @@ -291,6 +316,7 @@ EVENT 24 SHADED 24 prompt "Remove 2 Troops from a space with FARC pieces." + # TODO: 5.1.3 - 2 troops priority space 1 has_farc_piece(s) && has_troops(s) prompt "Remove 2 Troops." piece 2 is_piece_in_event_space(p) && is_troops(p) @@ -306,30 +332,30 @@ EVENT 25 prompt "Remove all FARC pieces from 1 Mountain." space 1 is_mountain(s) && has_faction_piece(s, FARC) prompt "Remove all FARC pieces." - piece 0 is_piece_in_event_space(p) && is_farc_piece(p) + piece all is_piece_in_event_space(p) && is_farc_piece(p) remove endpiece endspace SHADED 25 prompt "Place 3 FARC pieces into Antioquia or an adjacent Department." - space 1 s === ANTIOQUIA || (is_dept(s) && is_adjacent(ANTIOQUIA, s)) - place FARC [BASE,GUERRILLA] - place FARC [BASE,GUERRILLA] - place FARC [BASE,GUERRILLA] + space 1 (s === ANTIOQUIA || (is_dept(s) && is_adjacent(ANTIOQUIA, s))) && can_place_any(s, FARC) + place FARC BASE_GUERRILLA + place FARC BASE_GUERRILLA + place FARC BASE_GUERRILLA endspace EVENT 26 current CARTELS prompt "All Cartels Guerrillas free Attack FARC." - space 0 has_cartels_guerrilla(s) && has_farc_piece(s) + space all has_cartels_guerrilla(s) && has_farc_piece(s) free_attack_farc endspace SHADED 26 prompt "Transfer 6 Resources from Cartels to FARC for each space with Cartels Base and FARC Guerrilla." # prompt "Transfer 6 Resources from Cartels to FARC for each space with both." - space 0 has_cartels_base(s) && has_farc_guerrilla(s) && game.resources[CARTELS] > 0 + space all has_cartels_base(s) && has_farc_guerrilla(s) && game.resources[CARTELS] > 0 auto_transfer CARTELS FARC 6 endspace @@ -359,7 +385,7 @@ SHADED 28 auto_place FARC BASE endspace prompt "Sabotage each empty LoC touching Cúcuta." - space 0 is_loc(s) && is_adjacent(CUCUTA, s) && is_empty(s) && !has_sabotage(s) + space all is_loc(s) && is_adjacent(CUCUTA, s) && is_empty(s) && !has_sabotage(s) sabotage endspace @@ -369,18 +395,18 @@ EVENT 29 # TODO: Madrid Donors, Senado & Camara, etc space 1 has_underground_guerrilla(s, FARC) || ( assault_kill_count(s) > 0 && (has_farc_piece(s) || has_exposed_piece(s, AUC) || has_exposed_piece(s, CARTELS)) ) prompt "Activate all FARC." - piece 0 is_piece_in_event_space(p) && is_farc_guerrilla(p) && is_underground(p) + piece all is_piece_in_event_space(p) && is_farc_guerrilla(p) && is_underground(p) activate endpiece free_assault endspace SHADED 29 - current [FARC,AUC] + current FARC_AUC prompt "Execute 2 free Ambushes in 1 space." space 1 has_piece(s, game.current, GUERRILLA) && has_enemy_piece(s) repeat 2 - prompt "Execute 2 free Ambushes with any Guerrillas without Activating." + prompt "Execute 2 free Ambushes with any Guerrilla without Activating." piece_undo 1 is_piece_in_event_space(p) && is_piece(p, game.current, GUERRILLA) && has_enemy_piece(s) free_ambush_without_activating endpiece @@ -389,14 +415,20 @@ SHADED 29 EVENT 30 prompt "Remove 1 FARC Zone and 1 FARC Base there." - space 1 is_farc_zone(s) + # 5.1.3 - remove both farc zone and farc base if possible + space 1 is_farc_zone(s) && has_farc_base(s) remove_farc_zone prompt "Remove 1 FARC Base." piece 1 is_piece_in_event_space(p) && is_farc_base(p) remove endpiece + return + endspace + space 1 is_farc_zone(s) + remove_farc_zone endspace + SHADED 30 current GOVT place_farc_zone @@ -436,34 +468,45 @@ EVENT 33 SHADED 33 capability EVT_SUCUMBIOS - # TODO: auto or manual select Ecuador ? - set_space ECUADOR - # prompt "Place 2 pieces in Ecuador." - # space 1 s === ECUADOR - place (game.current) [BASE,GUERRILLA,TROOPS,POLICE] - place (game.current) [BASE,GUERRILLA,TROOPS,POLICE] - # endspace + # TODO: auto or manual + if true + set_space ECUADOR + place (game.current) ANY_PIECE + place (game.current) ANY_PIECE + else + prompt "Place 2 pieces in Ecuador." + space 1 s === ECUADOR + place (game.current) ANY_PIECE + place (game.current) ANY_PIECE + endspace + endif + EVENT 34 # -1 = all insurgent factions resources -1 -5 SHADED 34 - current [FARC,AUC,CARTELS] + current FARC_AUC_CARTELS prompt "Place 2 Guerrillas and 1 Base into a 0 Population Department." - # TODO: 5.1.3 do as much as can! - space 1 is_zero_pop_dept(s) && can_stack_any(s, game.current) - # TODO: auto or manual ? + # 5.1.3 - place base if possible + space 1 is_zero_pop_dept(s) && can_place_piece(s, game.current, BASE) + auto_place (game.current) BASE auto_place (game.current) GUERRILLA auto_place (game.current) GUERRILLA + return + endspace + space 1 is_zero_pop_dept(s) && can_stack_any(s, game.current) auto_place (game.current) BASE + auto_place (game.current) GUERRILLA + auto_place (game.current) GUERRILLA endspace EVENT 35 prompt "Replace Cartels Bases in 1 Department with Police." space 1 is_dept(s) && has_cartels_base(s) && can_replace_with(s, GOVT, POLICE) prompt "Replace Cartels Bases with Police." - piece 0 is_piece_in_event_space(p) && is_cartels_base(p) && can_replace_with(s, GOVT, POLICE) + piece all is_piece_in_event_space(p) && is_cartels_base(p) && can_replace_with(s, GOVT, POLICE) remove auto_place GOVT POLICE endpiece @@ -491,7 +534,7 @@ EVENT 36 EVENT 37 current GOVT prompt "Free Sweep or Assault FARC within each space; AUC Guerrillas act as Troops." - space 0 can_sweep_activate(s, FARC) || can_assault(s, FARC) + space all can_sweep_activate(s, FARC) || can_assault(s, FARC) free_sweep_assault_farc endspace @@ -510,16 +553,16 @@ EVENT 38 prompt "Remove all Active AUC Guerrillas from up to 3 spaces with cubes or Support." space_opt 3 (has_cube(s) || is_support(s)) && has_active_guerrilla(s, AUC) prompt "Remove all AUC Guerrillas." - piece 0 is_piece_in_event_space(p) && is_active_guerrilla(p, AUC) + piece all is_piece_in_event_space(p) && is_active_guerrilla(p, AUC) remove endpiece endspace SHADED 38 prompt "All AUC Guerrillas in spaces with cubes or Support to Underground." - space 0 (has_cube(s) || is_support(s)) && has_active_guerrilla(s, AUC) + space all (has_cube(s) || is_support(s)) && has_active_guerrilla(s, AUC) prompt "All AUC Guerrillas to Underground." - piece 0 is_piece_in_event_space(p) && is_active_guerrilla(p, AUC) + piece all is_piece_in_event_space(p) && is_active_guerrilla(p, AUC) underground endpiece endspace @@ -553,7 +596,7 @@ SHADED 40 prompt "Move all cubes in a Department with AUC to any Cities." space 1 is_dept(s) && has_auc_piece(s) && has_cube(s) prompt "Move all cubes to any Cities." - piece 0 is_piece_in_event_space(p) && is_cube(p) + piece all is_piece_in_event_space(p) && is_cube(p) save_space prompt "Move cube to any City." space_no_undo 1 is_city(s) @@ -564,7 +607,7 @@ SHADED 40 endspace prompt "Place 1 AUC piece in each of 2 Cities." space 2 is_city(s) - place AUC [BASE,GUERRILLA] + place AUC BASE_GUERRILLA endspace EVENT 41 @@ -572,14 +615,14 @@ EVENT 41 prompt "Remove all AUC pieces from 1 space." space 1 has_auc_piece(s) prompt "Remove all AUC pieces." - piece 0 is_piece_in_event_space(p) && is_auc_piece(p) + piece all is_piece_in_event_space(p) && is_auc_piece(p) remove endpiece endspace SHADED 41 prompt "AUC Resources +3 for each space with AUC and Cartels pieces." - space 0 has_auc_piece(s) && has_cartels_piece(s) + space all has_auc_piece(s) && has_cartels_piece(s) auto_resources AUC 3 endspace @@ -597,13 +640,19 @@ SHADED 42 EVENT 43 prompt "Place 2 Terror and remove all FARC Bases from a Department with Troops." - space 1 is_dept(s) && has_troops(s) + # 5.1.3 - farc bases if possible + space 1 is_dept(s) && has_troops(s) && has_farc_base(s) terror terror prompt "Remove all FARC Bases." - piece 0 is_piece_in_event_space(p) && is_farc_base(p) + piece all is_piece_in_event_space(p) && is_farc_base(p) remove endpiece + return + endspace + space 1 is_dept(s) && has_troops(s) + terror + terror endspace SHADED 43 @@ -630,21 +679,25 @@ SHADED 44 EVENT 45 prompt "Shift each space with cubes and Terror 1 level toward Active Support." - space 0 has_cube(s) && has_terror(s) && can_shift_support(s) + space all has_cube(s) && has_terror(s) && can_shift_support(s) shift_support endspace SHADED 45 - # TODO: aid (-count_spaces_with_faction_piece(AUC)) - prompt "Aid -1 for each space with AUC pieces." - space 0 has_auc_piece(s) - auto_aid -1 - endspace + # TODO: auto or manual + if true + aid (-count_matching_spaces(s=>has_faction_piece(s,AUC))) + else + prompt "Aid -1 for each space with AUC pieces." + space all has_auc_piece(s) + auto_aid -1 + endspace + endif roll resources GOVT (-game.vm.die) EVENT 46 - current [FARC,AUC,CARTELS] + current FARC_AUC_CARTELS prompt "Execute free Terror with any Guerrilla." space 1 has_piece(s, game.current, GUERRILLA) piece 1 is_piece_in_event_space(p) && is_piece(p, game.current, GUERRILLA) @@ -663,20 +716,18 @@ EVENT 46 EVENT 47 prompt "All AUC Guerrillas to Active." - piece 0 is_auc_guerrilla(p) && is_underground(p) + piece all is_auc_guerrilla(p) && is_underground(p) activate endpiece prompt "All Police free Assault AUC as if Troops." - space 0 has_police(s) && has_auc_piece(s) + space all has_police(s) && has_auc_piece(s) # TODO: test this free_assault_auc endspace SHADED 47 current AUC - set_space CUCUTA prompt "Place 2 AUC Guerrillas in Cúcuta." - # set_space CUCUTA space 1 s === CUCUTA auto_place AUC GUERRILLA auto_place AUC GUERRILLA @@ -716,10 +767,15 @@ EVENT 49 SHADED 49 prompt "Place an AUC Guerrilla and Base in any Department." - # TODO: 5.1.3 do as much as can! - space 1 is_dept(s) && can_stack_any(s, AUC) + # 5.1.3 - place base if possible + space 1 is_dept(s) && can_place_piece(s, AUC, BASE) + auto_place AUC BASE auto_place AUC GUERRILLA + return + endspace + space 1 is_dept(s) && can_stack_any(s, AUC) auto_place AUC BASE + auto_place AUC GUERRILLA endspace EVENT 50 @@ -734,7 +790,7 @@ EVENT 50 endrepeat SHADED 50 - # Note: strictly remove 2 or replace 2 + # Note: strictly remove or replace (see event 54) prompt "Remove any 2 Police or replace them with available AUC Guerrillas." piece_undo 1 is_police(p) set_piece_space @@ -760,7 +816,7 @@ SHADED 50 EVENT 51 if is_any_pipeline_sabotaged() prompt "Remove all Pipeline Sabotage." - space 0 is_pipeline(s) && has_sabotage(s) + space all is_pipeline(s) && has_sabotage(s) remove_sabotage endspace else @@ -784,14 +840,18 @@ SHADED 52 space 1 has_auc_piece(s) && can_stack_base(s, AUC) auto_place AUC BASE endspace - # TODO: resources AUC (count_pieces_on_map(AUC,BASE)) - prompt "AUC Resources +1 per AUC Base." - piece 0 is_auc_base(p) - auto_resources AUC 1 - endpiece + # TODO: auto or manual + if true + resources AUC (count_pieces_on_map(AUC,BASE)) + else + prompt "AUC Resources +1 per AUC Base." + piece all is_auc_base(p) + auto_resources AUC 1 + endpiece + endif EVENT 53 - current [FARC,AUC,CARTELS] + current FARC_AUC_CARTELS prompt "Select Departments to move Guerrillas between." space 1 is_dept(s) mark_space @@ -820,43 +880,27 @@ EVENT 53 endpiece EVENT 54 - # Note: strictly remove 2 or replace 2 (see shaded 50) - prompt "Remove up to 2 Guerrillas or replace them with with another Faction's." + # Note: strictly remove or replace (see shaded 50) + prompt "Remove up to 2 Guerrillas or replace them with with another Faction's Guerrillas." piece_undo 1 is_any_guerrilla(p) set_piece_space remove - if piece_faction(game.vm.p) === FARC - place_opt [AUC,CARTELS] GUERRILLA - endif - if piece_faction(game.vm.p) === AUC - place_opt [FARC,CARTELS] GUERRILLA - endif - if piece_faction(game.vm.p) === CARTELS - place_opt [FARC,AUC] GUERRILLA - endif + place_opt (piece_enemy_factions(game.vm.p)) GUERRILLA set_space -1 endpiece if game.vm.opt - # TODO: don't remove just placed guerrilla! prompt "Remove 1 more Guerrilla." + # TODO: don't remove just placed piece piece_undo_opt 1 is_any_guerrilla(p) remove endpiece else - # TODO: don't replace just placed guerrilla! prompt "Replace 1 more Guerrilla." + # TODO: don't replace just placed piece piece_undo_opt 1 is_any_guerrilla(p) && ( can_replace_with(s, FARC, GUERRILLA) || can_replace_with(s, AUC, GUERRILLA) || can_replace_with(s, CARTELS, GUERRILLA) ) set_piece_space remove - if piece_faction(game.vm.p) === FARC - place [AUC,CARTELS] GUERRILLA - endif - if piece_faction(game.vm.p) === AUC - place [FARC,CARTELS] GUERRILLA - endif - if piece_faction(game.vm.p) === CARTELS - place [FARC,AUC] GUERRILLA - endif + place_opt (piece_enemy_factions(game.vm.p)) GUERRILLA set_space -1 endpiece endif @@ -883,7 +927,7 @@ EVENT 56 SHADED 56 prompt "Add twice Cartels pieces in Cities to Cartels Resources." - piece 0 is_cartels_piece(p) && is_city(s) + piece all is_cartels_piece(p) && is_city(s) auto_resources CARTELS 2 endpiece prompt "Place a Cartels Base in each of 2 Cities." @@ -905,16 +949,16 @@ SHADED 57 # TODO: prompt "Replace a Police with any Cartels piece in 2 spaces." space 2 has_police(s) prompt "Replace a Police with any Cartels piece." - piece 1 is_piece_in_event_space(p) && is_police(p) + piece 1 is_piece_in_event_space(p) && is_police(p) && can_replace_with(s, CARTELS, GUERRILLA) remove - place CARTELS [BASE,GUERRILLA] + place CARTELS BASE_GUERRILLA endpiece endspace EVENT 58 resources CARTELS -6 prompt "Remove all Cartels Guerrillas." - piece 0 is_cartels_guerrilla(p) + piece all is_cartels_guerrilla(p) remove endpiece @@ -931,18 +975,18 @@ SHADED 58 EVENT 59 current GOVT prompt "All Cartels Guerrillas to Active." - piece 0 is_cartels_guerrilla(p) && is_underground(p) + piece all is_cartels_guerrilla(p) && is_underground(p) activate endpiece prompt "Free Assault against Cartels in each space." - space 0 can_assault(s, CARTELS) + space all can_assault(s, CARTELS) free_assault_cartels endspace SHADED 59 current CARTELS prompt "Flip all Cartels Guerrillas Underground." - piece 0 is_cartels_guerrilla(p) && is_active(p) + piece all is_cartels_guerrilla(p) && is_active(p) underground endpiece prompt "Relocate up to 3 Cartels Guerrillas anywhere." @@ -957,7 +1001,7 @@ EVENT 60 prompt "Remove all Cartels pieces from 2 Cities or 1 Department." space 2 has_cartels_piece(s) && ((is_city(s) && (game.vm.ss.length === 0 || is_city(game.vm.ss[0]))) || (is_dept(s) && game.vm.ss.length === 0)) prompt "Remove all Cartels pieces." - piece 0 is_piece_in_event_space(p) && is_cartels_piece(p) + piece all is_piece_in_event_space(p) && is_cartels_piece(p) remove endpiece endspace @@ -978,7 +1022,7 @@ EVENT 61 prompt "Remove all Cartels pieces from 1 City." space 1 is_city(s) && has_cartels_piece(s) prompt "Remove all Cartels pieces." - piece_undo 0 is_piece_in_event_space(p) && is_cartels_piece(p) + piece_undo all is_piece_in_event_space(p) && is_cartels_piece(p) remove endpiece endspace @@ -1005,9 +1049,9 @@ SHADED 62 EVENT 63 current CARTELS prompt "In each space with Cartels Guerrillas..." - space 0 has_cartels_guerrilla(s) + space all has_cartels_guerrilla(s) prompt "Remove all but one Cartels Guerrilla." - piece 0 is_piece_in_event_space(p) && is_cartels_guerrilla(p) && count_pieces(s, CARTELS, GUERRILLA) > 1 + piece all is_piece_in_event_space(p) && is_cartels_guerrilla(p) && count_pieces(s, CARTELS, GUERRILLA) > 1 remove endpiece prompt "Free Terror with remaining Cartels Guerrilla." @@ -1031,18 +1075,23 @@ EVENT 64 SHADED 64 prompt "Cartels Resources +2 for each Cartels Base in a City." - piece 0 is_cartels_base(p) && is_city(s) + piece all is_cartels_base(p) && is_city(s) auto_resources CARTELS 2 endpiece prompt "Cartels Resources +1 for each Cartels Base in a Department." - piece 0 is_cartels_base(p) && is_dept(s) + piece all is_cartels_base(p) && is_dept(s) auto_resources CARTELS 1 endpiece EVENT 65 prompt "Place or remove 1 Shipment and Insurgent Base in any Mountain Department." - # TODO: 5.1.3 do as much as can! - space 1 is_mountain(s) + # 5.1.3 - do both shipment and base if possible + space 1 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 + return + endspace + space 1 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 endspace @@ -1055,7 +1104,7 @@ EVENT 66 SHADED 66 prompt "Place Cartels Base into each Forest that already has one." - space 0 is_forest(s) && has_cartels_base(s) && can_stack_base(s, CARTELS) + space all is_forest(s) && has_cartels_base(s) && can_stack_base(s, CARTELS) auto_place CARTELS BASE endspace @@ -1086,7 +1135,7 @@ EVENT 68 SHADED 68 prompt "Cartels Resources +2 per Cartels piece in coastal spaces." - piece 0 is_cartels_piece(p) && is_coastal_space(s) + piece all is_cartels_piece(p) && is_coastal_space(s) auto_resources CARTELS 2 endpiece @@ -1105,13 +1154,13 @@ EVENT 69 space 1 (s !== game.vm.m[0]) && is_within_adjacent_depts(s, game.vm.m[0], 3) && can_stack_any(s, game.current) if game.current === GOVT prompt "Move cubes to destination." - piece_undo_opt 0 (s === game.vm.m[0]) && is_cube(p) && can_stack_any(s, GOVT) + piece_undo_opt all (s === game.vm.m[0]) && is_cube(p) && can_stack_any(s, GOVT) move endpiece free_train_sweep_assault else prompt "Move Guerrillas to destination." - piece_undo_opt 0 (s === game.vm.m[0]) && is_piece(p, game.current, GUERRILLA) && can_stack_any(s, game.current) + piece_undo_opt all (s === game.vm.m[0]) && is_piece(p, game.current, GUERRILLA) && can_stack_any(s, game.current) move endpiece free_rally_attack_terror @@ -1120,14 +1169,14 @@ EVENT 69 EVENT 70 prompt "Government Resources +6 for each Forest without Guerrillas." - space_no_undo 0 is_forest(s) && !has_any_guerrilla(s) + space_no_undo all is_forest(s) && !has_any_guerrilla(s) auto_resources GOVT 6 endspace SHADED 70 - current [FARC,AUC,CARTELS] + current FARC_AUC_CARTELS prompt "Free Terror in each Forest and +3 Resources per Terror." - space 0 is_forest(s) && has_piece(s, game.current, GUERRILLA) + space all is_forest(s) && has_piece(s, game.current, GUERRILLA) prompt "Free Terror with any 1 Guerrilla." piece 1 is_piece_in_event_space(p) && is_piece(p, game.current, GUERRILLA) free_terror @@ -1146,21 +1195,26 @@ EVENT 71 SHADED 71 capability EVT_DARIEN - # TODO: auto or manual select Panama ? - # set_space PANAMA - prompt "Place 1-2 Bases in Panamá." - space 1 s === PANAMA - auto_place (game.current) BASE + # TODO: auto or manual + if true + set_space PANAMA + place (game.current) BASE place_opt (game.current) BASE - endspace + else + prompt "Place 1-2 Bases in Panamá." + space 1 s === PANAMA + auto_place (game.current) BASE + place_opt (game.current) BASE + endspace + endif EVENT 72 prompt "Replace all Cartels Guerrillas in 2 spaces with other Guerrillas." space 2 has_cartels_guerrilla(s) && ( can_replace_with(s, FARC, GUERRILLA) || can_replace_with(s, AUC, GUERRILLA) ) prompt "Replace all Cartels Guerrillas with other Guerrillas." - piece_undo 0 is_piece_in_event_space(p) && is_cartels_guerrilla(p) && ( can_replace_with(s, FARC, GUERRILLA) || can_replace_with(s, AUC, GUERRILLA) ) + piece_undo all is_piece_in_event_space(p) && is_cartels_guerrilla(p) && ( can_replace_with(s, FARC, GUERRILLA) || can_replace_with(s, AUC, GUERRILLA) ) remove - place [FARC,AUC] GUERRILLA + place FARC_AUC GUERRILLA endpiece endspace @@ -1169,7 +1223,7 @@ SHADED 72 while has_piece(AVAILABLE, CARTELS, GUERRILLA) prompt "Place all available Cartels Guerrillas into spaces with Cartels Bases." asm game.vm.p = find_piece(AVAILABLE, CARTELS, GUERRILLA) - space 1 has_cartels_base(s) + space 1 has_cartels_base(s) && can_stack_piece(s, CARTELS, GUERRILLA) auto_place CARTELS GUERRILLA endspace endwhile diff --git a/info/cards.html b/info/cards.html index 8c951b8..8dfb765 100644 --- a/info/cards.html +++ b/info/cards.html @@ -96,7 +96,7 @@ body { .card.card_70{background-image:url(../cards.1x/card_70.jpg)} .card.card_71{background-image:url(../cards.1x/card_71.jpg)} .card.card_72{background-image:url(../cards.1x/card_72.jpg)} -.card.card_73, .card.card_74, .card.card_75, .card.card_76 {background-image:url(../cards.1x/card_7x.jpg)} +.card.card_73{background-image:url(../cards.1x/card_7x.jpg)} @media (min-resolution: 97dpi) { .card.card_back{background-image:url(../cards.2x/card_back.jpg)} @@ -172,7 +172,7 @@ body { .card.card_70{background-image:url(../cards.2x/card_70.jpg)} .card.card_71{background-image:url(../cards.2x/card_71.jpg)} .card.card_72{background-image:url(../cards.2x/card_72.jpg)} -.card.card_73, .card.card_74, .card.card_75, .card.card_76 {background-image:url(../cards.2x/card_7x.jpg)} +.card.card_73{background-image:url(../cards.2x/card_7x.jpg)} } @@ -254,8 +254,7 @@ body {
-
-
-
- +
+
+
diff --git a/rules.js b/rules.js index 5e77dfd..e3ff3b9 100644 --- a/rules.js +++ b/rules.js @@ -66,6 +66,17 @@ const GUERRILLA = 1 const TROOPS = 2 const POLICE = 3 +// Faction lists +const FARC_AUC_CARTELS = [ FARC, AUC, CARTELS ] +const GOVT_AUC_CARTELS = [ GOVT, AUC, CARTELS ] +const GOVT_FARC_CARTELS = [ GOVT, FARC, CARTELS ] +const GOVT_FARC_AUC = [ GOVT, FARC, AUC ] +const FARC_AUC = [ FARC, AUC ] + +// Piece type lists +const ANY_PIECE = [ BASE, GUERRILLA, TROOPS, POLICE ] +const BASE_GUERRILLA = [ BASE, GUERRILLA ] + const piece_type_name = [ "Base", "Guerrilla", "Troops", "Police" ] const piece_faction_type_name = [ [ "Govt Base", null, "Troops", "Police" ], @@ -302,7 +313,7 @@ exports.setup = function (seed, scenario, options) { } game.deck[0] = - /* TEST */ 35 + /* TEST */ 54 log("DECK " + game.deck.join(", ")) update_control() @@ -466,6 +477,15 @@ function setup_remove_piece(faction, type, count, where) { // === MISC PIECE QUERIES === +function piece_enemy_factions(p) { + switch (piece_faction(p)) { + case GOVT: return FARC_AUC_CARTELS + case FARC: return GOVT_AUC_CARTELS + case AUC: return GOVT_FARC_CARTELS + case CARTELS: return GOVT_FARC_AUC + } +} + function piece_space(p) { return game.pieces[p] } @@ -593,6 +613,14 @@ function count_pieces_on_map(faction, type) { return n } +function count_matching_spaces(f) { + let n = 0 + for (let s = first_space; s <= last_space; ++s) + if (is_space(s) && f(s)) + ++n + return n +} + function count_faction_pieces(s, faction) { switch (faction) { case GOVT: @@ -2152,7 +2180,6 @@ function is_selected_op_space(s) { } function select_op_space(s, cost) { - console.log("game.op", game.op) set_add(game.op.spaces, s) if (!game.op.free) game.resources[game.current] -= cost @@ -4351,7 +4378,6 @@ states.kidnap_space = { if (c) { // Drug Ransom if targeting Cartels with Shipment if (is_any_shipment_held_by_faction_in_space(CARTELS, s)) { - console.log("kidnap_space", is_any_shipment_held_by_faction_in_space(CARTELS, s)) for (let sh = 0; sh < 4; ++sh) if (is_shipment_held_by_faction_in_space(sh, CARTELS, s)) gen_action_shipment(sh) @@ -5533,7 +5559,6 @@ function vm_if() { let balance = 1 while (balance > 0) { ++game.vm.pc - console.log("scan else:", CODE[game.vm.pc][0].name) switch (CODE[game.vm.pc][0]) { case vm_if: ++balance @@ -5978,19 +6003,16 @@ function vm_endspace() { } function can_vm_space() { - let n = CODE[game.vm.pc][3] let f = CODE[game.vm.pc][4] - if (n > 0 && game.vm.ss.length >= n) - return false - for (let s = first_space; s <= last_space; ++s) - if (!set_has(game.vm.ss, s) && f(s)) - return true + if (game.vm.ss.length < CODE[game.vm.pc][3]) + for (let s = first_space; s <= last_space; ++s) + if (!set_has(game.vm.ss, s) && f(s)) + return true return false } states.vm_space = { prompt() { - let n = CODE[game.vm.pc][3] let f = CODE[game.vm.pc][4] view.who = game.vm.p if (game.vm.prompt) @@ -6000,7 +6022,7 @@ states.vm_space = { for (let s = first_space; s <= last_space; ++s) if (is_space(s) && !set_has(game.vm.ss, s) && f(s)) gen_action_space(s) - if (CODE[game.vm.pc][2]) + if (game.vm.ss.length >= CODE[game.vm.pc][2]) view.actions.skip = 1 }, space(s) { @@ -6013,8 +6035,7 @@ states.vm_space = { skip() { if (CODE[game.vm.pc][1]) push_undo() - if (CODE[game.vm.pc][2]) - game.vm.opt = 1 + game.vm.opt = 1 vm_goto(vm_endspace, vm_space, 1, 1) }, } @@ -6037,19 +6058,16 @@ function vm_endpiece() { } function can_vm_piece() { - let n = CODE[game.vm.pc][3] let f = CODE[game.vm.pc][4] - if (n > 0 && game.vm.pp.length >= n) - return false - for (let p = all_first_piece; p <= all_last_piece; ++p) - if (piece_space(p) >= 0 && !set_has(game.vm.pp, p) && f(p, piece_space(p))) - return true + if (game.vm.pp.length < CODE[game.vm.pc][3]) + for (let p = all_first_piece; p <= all_last_piece; ++p) + if (piece_space(p) >= 0 && !set_has(game.vm.pp, p) && f(p, piece_space(p))) + return true return false } states.vm_piece = { prompt() { - let n = CODE[game.vm.pc][3] let f = CODE[game.vm.pc][4] if (game.vm.shipment !== undefined) view.selected_shipment = game.vm.shipment @@ -6062,7 +6080,7 @@ states.vm_piece = { for (let p = all_first_piece; p <= all_last_piece; ++p) if (piece_space(p) >= 0 && !set_has(game.vm.pp, p) && f(p, piece_space(p))) gen_action_piece(p) - if (CODE[game.vm.pc][2]) + if (game.vm.pp.length >= CODE[game.vm.pc][2]) view.actions.skip = 1 }, piece(p) { @@ -6075,8 +6093,7 @@ states.vm_piece = { skip() { if (CODE[game.vm.pc][1]) push_undo() - if (CODE[game.vm.pc][2]) - game.vm.opt = 1 + game.vm.opt = 1 vm_goto(vm_endpiece, vm_piece, 1, 1) }, } @@ -6138,8 +6155,7 @@ states.vm_shipment = { skip() { if (CODE[game.vm.pc][1]) push_undo() - if (CODE[game.vm.pc][2]) - game.vm.opt = 1 + game.vm.opt = 1 vm_goto(vm_endshipment, vm_shipment, 1, 1) }, } @@ -6241,7 +6257,7 @@ states.vm_place = { skip() { if (CODE[game.vm.pc][1]) push_undo() - if (CODE[game.vm.pc][2]) + if (CODE[game.vm.pc][2]) // only flag as optional if opcode is opt game.vm.opt = 1 vm_next() }, @@ -6270,10 +6286,16 @@ states.vm_set_passive_support_or_passive_opposition = { }, } -function vm_place_or_remove_shipment() { +function can_place_or_remove_shipment(s) { if (has_available_shipment() && has_any_guerrilla(game.vm.s)) - game.state = "vm_place_or_remove_shipment" - else if (is_any_shipment_held_in_space(game.vm.s)) + return true + if (is_any_shipment_held_in_space(game.vm.s)) + return true + return false +} + +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() @@ -6304,11 +6326,16 @@ states.vm_place_or_remove_shipment = { }, } -function vm_place_or_remove_insurgent_base() { - let s = game.vm.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)) - game.state = "vm_place_or_remove_insurgent_base" - else if (has_piece(s, FARC, BASE) || has_piece(s, AUC, BASE) || has_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 +} + +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 vm_next() @@ -6764,7 +6791,6 @@ function clear_undo() { } function push_undo() { -try{throw new Error("push_undo")}catch(e){console.log(e)} let copy = {} for (let k in game) { let v = game[k] @@ -7037,49 +7063,49 @@ const CODE = [ [ vm_return ], // EVENT 4 [ vm_prompt, "Add twice Econ of unsabotaged pipelines to Government Resources." ], - [ vm_space, 1, 0, 3, (s)=>is_unsabotaged_pipeline(s) ], + [ vm_space, true, 3, 3, (s)=>is_unsabotaged_pipeline(s) ], [ vm_auto_resources, GOVT, ()=>(2*data.spaces[game.vm.s].econ) ], [ vm_endspace ], [ vm_return ], // SHADED 4 [ vm_prompt, "Sabotage the 3 pipelines with highest value and no cubes." ], - [ vm_space, 1, 0, 3, (s)=>is_highest_value_pipeline_without_cubes(s) ], + [ vm_space, true, 3, 3, (s)=>is_highest_value_pipeline_without_cubes(s) ], [ vm_sabotage ], [ vm_endspace ], [ vm_return ], // EVENT 5 [ vm_prompt, "Place Police onto Pipelines." ], [ vm_repeat, 6 ], - [ vm_space, 1, 0, 1, (s)=>is_pipeline(s) && has_available_piece(GOVT, POLICE) ], - [ vm_auto_place, 0, 0, GOVT, POLICE ], + [ vm_space, true, 1, 1, (s)=>is_pipeline(s) && has_available_piece(GOVT, POLICE) ], + [ vm_auto_place, false, 0, GOVT, POLICE ], [ vm_mark_space ], [ vm_endspace ], [ vm_endrepeat ], [ vm_prompt, "Flip 3 Guerrillas there or adjacent to Active." ], - [ vm_piece, 0, 0, 3, (p,s)=>is_any_guerrilla(p) && is_underground(p) && is_with_or_adjacent_to_mark(s, game.vm.m) ], + [ vm_piece, false, 3, 3, (p,s)=>is_any_guerrilla(p) && is_underground(p) && is_with_or_adjacent_to_mark(s, game.vm.m) ], [ vm_activate ], [ vm_endpiece ], [ vm_return ], // SHADED 5 [ vm_prompt, "Shift space adjacent to a 3-Econ LoC by 2 levels toward Active Opposition." ], - [ vm_space, 1, 0, 1, (s)=>can_shift_opposition(s) && is_adjacent_to_3econ_loc(s) ], + [ vm_space, true, 1, 1, (s)=>can_shift_opposition(s) && is_adjacent_to_3econ_loc(s) ], [ vm_shift_opposition ], [ vm_shift_opposition ], [ vm_endspace ], [ vm_return ], // EVENT 6 [ vm_prompt, "Select Opposition or Neutral Departments adjacent to Sabotage." ], - [ vm_space, 1, 0, 2, (s)=>is_pop(s) && !is_support(s) && is_adjacent_to_sabotage(s) ], + [ vm_space, true, 2, 2, (s)=>is_pop(s) && !is_support(s) && is_adjacent_to_sabotage(s) ], [ vm_set_passive_support ], [ vm_endspace ], [ vm_return ], // SHADED 6 [ vm_prompt, "Sabotage a pipeline." ], - [ vm_space, 1, 0, 1, (s)=>is_pipeline(s) && !has_sabotage(s) ], + [ vm_space, true, 1, 1, (s)=>is_pipeline(s) && !has_sabotage(s) ], [ vm_sabotage ], [ vm_endspace ], [ vm_prompt, "Shift an Adjacent Department." ], - [ vm_space, 1, 0, 1, (s)=>can_shift_opposition(s) && is_dept(s) && is_adjacent(s, game.vm.s) ], + [ vm_space, true, 1, 1, (s)=>can_shift_opposition(s) && is_dept(s) && is_adjacent(s, game.vm.s) ], [ vm_shift_opposition ], [ vm_endspace ], [ vm_return ], @@ -7143,24 +7169,43 @@ const CODE = [ // EVENT 14 [ vm_current, GOVT ], [ vm_prompt, "Place 1 Base and 3 Troops into any Department." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && can_stack_any(s, GOVT) ], - [ vm_auto_place, 0, 0, GOVT, BASE ], - [ vm_auto_place, 0, 0, GOVT, TROOPS ], - [ vm_auto_place, 0, 0, GOVT, TROOPS ], - [ vm_auto_place, 0, 0, GOVT, TROOPS ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && can_place_piece(s, GOVT, BASE) ], + [ vm_auto_place, false, 0, GOVT, BASE ], + [ vm_auto_place, false, 0, GOVT, TROOPS ], + [ vm_auto_place, false, 0, GOVT, TROOPS ], + [ vm_auto_place, false, 0, GOVT, TROOPS ], + [ vm_return ], + [ vm_endspace ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && can_stack_any(s, GOVT) ], + [ vm_auto_place, false, 0, GOVT, BASE ], + [ vm_auto_place, false, 0, GOVT, TROOPS ], + [ vm_auto_place, false, 0, GOVT, TROOPS ], + [ vm_auto_place, false, 0, GOVT, TROOPS ], [ vm_endspace ], [ vm_return ], // SHADED 14 [ vm_prompt, "Remove 1 Government Base and 1 cube from a Department." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && has_faction_piece(s, GOVT) ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && ( has_govt_base(s) && has_cube(s) ) ], [ vm_prompt, ()=>`Remove Government Base from ${space_name[game.vm.s]}.` ], - [ vm_piece, 0, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_govt_base(p) ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_govt_base(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_prompt, ()=>`Remove cube from ${space_name[game.vm.s]}.` ], - [ vm_piece, 0, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_cube(p) ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_cube(p) ], [ vm_remove ], [ vm_endpiece ], + [ vm_return ], + [ vm_endspace ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && ( has_govt_base(s) || has_cube(s) ) ], + [ vm_prompt, ()=>`Remove Government Base from ${space_name[game.vm.s]}.` ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_govt_base(p) ], + [ vm_remove ], + [ vm_endpiece ], + [ vm_prompt, ()=>`Remove cube from ${space_name[game.vm.s]}.` ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_cube(p) ], + [ vm_remove ], + [ vm_endpiece ], + [ vm_return ], [ vm_endspace ], [ vm_return ], // EVENT 15 @@ -7169,13 +7214,13 @@ const CODE = [ [ vm_return ], // SHADED 15 [ vm_prompt, "Shift a City from Neutral or Passive Support to Passive Opposition." ], - [ vm_space, 1, 0, 1, (s)=>is_city(s) && (is_neutral(s) || is_passive_support(s)) ], + [ vm_space, true, 1, 1, (s)=>is_city(s) && (is_neutral(s) || is_passive_support(s)) ], [ vm_set_passive_opposition ], [ vm_endspace ], [ vm_return ], // EVENT 16 [ vm_prompt, "Each Mountain, +5 Resources to Faction with most pieces." ], - [ vm_space, 1, 0, 0, (s)=>is_mountain(s) ], + [ vm_space, true, 999, 999, (s)=>is_mountain(s) ], [ vm_auto_resources, ()=>(faction_with_most_pieces(game.vm.s)), 5 ], [ vm_endspace ], [ vm_return ], @@ -7202,12 +7247,12 @@ const CODE = [ // EVENT 19 [ vm_if, ()=>game.current === GOVT ], [ vm_prompt, "Free Sweep or Assault in each space possible." ], - [ vm_space, 1, 0, 0, (s)=>can_sweep_activate(s) || can_assault_any(s) ], + [ vm_space, true, 999, 999, (s)=>can_sweep_activate(s) || can_assault_any(s) ], [ vm_free_sweep_assault ], [ vm_endspace ], [ vm_else ], [ vm_prompt, "Free Attack or Terror in each space possible." ], - [ vm_space, 1, 0, 0, (s)=>can_terror(s) || can_attack(s) ], + [ vm_space, true, 999, 999, (s)=>can_terror(s) || can_attack(s) ], [ vm_free_attack_terror ], [ vm_endspace ], [ vm_endif ], @@ -7215,9 +7260,9 @@ const CODE = [ // EVENT 20 [ vm_current, GOVT ], [ vm_prompt, "Move up to 6 FARC Guerillas into adjacent spaces." ], - [ vm_piece, 1, 1, 6, (p,s)=>is_farc_guerrilla(p) ], + [ vm_piece, true, 0, 6, (p,s)=>is_farc_guerrilla(p) ], [ vm_prompt, "Move FARC Guerilla into an adjacent space." ], - [ vm_space, 0, 0, 1, (s)=>is_adjacent(s, piece_space(game.vm.p)) && can_stack_any(s, game.current) ], + [ vm_space, false, 1, 1, (s)=>is_adjacent(s, piece_space(game.vm.p)) && can_stack_any(s, game.current) ], [ vm_move ], [ vm_endspace ], [ vm_endpiece ], @@ -7226,27 +7271,27 @@ const CODE = [ [ vm_current, FARC ], [ vm_free_march ], [ vm_prompt, "Flip up to 3 FARC Guerrillas Underground." ], - [ vm_piece, 1, 1, 3, (p,s)=>is_farc_guerrilla(p) && is_active(p) ], + [ vm_piece, true, 0, 3, (p,s)=>is_farc_guerrilla(p) && is_active(p) ], [ vm_underground ], [ vm_endpiece ], [ vm_return ], // EVENT 21 [ vm_resources, FARC, -6 ], [ vm_prompt, "Remove 1 FARC Base." ], - [ vm_piece, 1, 0, 1, (p,s)=>is_farc_base(p) ], + [ vm_piece, true, 1, 1, (p,s)=>is_farc_base(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_return ], // SHADED 21 [ vm_resources, FARC, 6 ], [ vm_prompt, "Place a FARC Base in a City or Department" ], - [ vm_space, 1, 0, 1, (s)=>(is_city(s) || is_dept(s)) && can_stack_base(s, FARC) ], - [ vm_auto_place, 0, 0, FARC, BASE ], + [ vm_space, true, 1, 1, (s)=>(is_city(s) || is_dept(s)) && can_stack_base(s, FARC) ], + [ vm_auto_place, false, 0, FARC, BASE ], [ vm_endspace ], [ vm_return ], // EVENT 22 [ vm_prompt, "Shift an Opposition space to Neutral." ], - [ vm_space, 1, 0, 1, (s)=>is_opposition(s) ], + [ vm_space, true, 1, 1, (s)=>is_opposition(s) ], [ vm_set_neutral ], [ vm_endspace ], [ vm_return ], @@ -7256,13 +7301,13 @@ const CODE = [ [ vm_return ], // EVENT 23 [ vm_prompt, "In a Department, Activate all Guerrillas and remove all Cartels Bases." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && (has_any_underground_guerrilla(s) || has_cartels_base(s)) ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && (has_any_underground_guerrilla(s) || has_cartels_base(s)) ], [ vm_prompt, "Activate all Guerrillas." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_any_guerrilla(p) && is_underground(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_any_guerrilla(p) && is_underground(p) ], [ vm_activate ], [ vm_endpiece ], [ vm_prompt, "Remove all Cartels Bases." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_cartels_base(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_cartels_base(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_endspace ], @@ -7270,7 +7315,7 @@ const CODE = [ // SHADED 23 [ vm_current, GOVT ], [ vm_prompt, "Remove 3 Troops." ], - [ vm_piece, 1, 0, 3, (p,s)=>is_troops(p) ], + [ vm_piece, true, 3, 3, (p,s)=>is_troops(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_ineligible, GOVT ], @@ -7278,51 +7323,51 @@ const CODE = [ [ vm_return ], // EVENT 24 [ vm_prompt, "Shift a City to Active Support." ], - [ vm_space, 1, 0, 1, (s)=>is_city(s) && can_shift_support(s) ], + [ vm_space, true, 1, 1, (s)=>is_city(s) && can_shift_support(s) ], [ vm_set_active_support ], [ vm_endspace ], [ vm_ineligible, FARC ], [ vm_return ], // SHADED 24 [ vm_prompt, "Remove 2 Troops from a space with FARC pieces." ], - [ vm_space, 1, 0, 1, (s)=>has_farc_piece(s) && has_troops(s) ], + [ vm_space, true, 1, 1, (s)=>has_farc_piece(s) && has_troops(s) ], [ vm_prompt, "Remove 2 Troops." ], - [ vm_piece, 0, 0, 2, (p,s)=>is_piece_in_event_space(p) && is_troops(p) ], + [ vm_piece, false, 2, 2, (p,s)=>is_piece_in_event_space(p) && is_troops(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_endspace ], [ vm_prompt, "Shift a City with Support to Neutral." ], - [ vm_space, 1, 0, 1, (s)=>is_city(s) && is_support(s) ], + [ vm_space, true, 1, 1, (s)=>is_city(s) && is_support(s) ], [ vm_set_neutral ], [ vm_endspace ], [ vm_return ], // EVENT 25 [ vm_prompt, "Remove all FARC pieces from 1 Mountain." ], - [ vm_space, 1, 0, 1, (s)=>is_mountain(s) && has_faction_piece(s, FARC) ], + [ vm_space, true, 1, 1, (s)=>is_mountain(s) && has_faction_piece(s, FARC) ], [ vm_prompt, "Remove all FARC pieces." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_farc_piece(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_farc_piece(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_endspace ], [ vm_return ], // SHADED 25 [ vm_prompt, "Place 3 FARC pieces into Antioquia or an adjacent Department." ], - [ vm_space, 1, 0, 1, (s)=>s === ANTIOQUIA || (is_dept(s) && is_adjacent(ANTIOQUIA, s)) ], - [ vm_place, 0, 0, FARC, [BASE,GUERRILLA] ], - [ vm_place, 0, 0, FARC, [BASE,GUERRILLA] ], - [ vm_place, 0, 0, FARC, [BASE,GUERRILLA] ], + [ vm_space, true, 1, 1, (s)=>(s === ANTIOQUIA || (is_dept(s) && is_adjacent(ANTIOQUIA, s))) && can_place_any(s, FARC) ], + [ vm_place, false, 0, FARC, BASE_GUERRILLA ], + [ vm_place, false, 0, FARC, BASE_GUERRILLA ], + [ vm_place, false, 0, FARC, BASE_GUERRILLA ], [ vm_endspace ], [ vm_return ], // EVENT 26 [ vm_current, CARTELS ], [ vm_prompt, "All Cartels Guerrillas free Attack FARC." ], - [ vm_space, 1, 0, 0, (s)=>has_cartels_guerrilla(s) && has_farc_piece(s) ], + [ vm_space, true, 999, 999, (s)=>has_cartels_guerrilla(s) && has_farc_piece(s) ], [ vm_free_attack_farc ], [ vm_endspace ], [ vm_return ], // SHADED 26 [ vm_prompt, "Transfer 6 Resources from Cartels to FARC for each space with Cartels Base and FARC Guerrilla." ], - [ vm_space, 1, 0, 0, (s)=>has_cartels_base(s) && has_farc_guerrilla(s) && game.resources[CARTELS] > 0 ], + [ vm_space, true, 999, 999, (s)=>has_cartels_base(s) && has_farc_guerrilla(s) && game.resources[CARTELS] > 0 ], [ vm_auto_transfer, CARTELS, FARC, 6 ], [ vm_endspace ], [ vm_return ], @@ -7338,41 +7383,41 @@ const CODE = [ [ vm_return ], // EVENT 28 [ vm_prompt, "Remove up to 3 Insurgent pieces from a space next to Venezuela." ], - [ vm_space, 1, 0, 1, (s)=>is_next_to_venezuela(s) && has_insurgent_piece(s) ], + [ vm_space, true, 1, 1, (s)=>is_next_to_venezuela(s) && has_insurgent_piece(s) ], [ vm_prompt, "Remove up to 3 Insurgent pieces." ], - [ vm_piece, 0, 1, 3, (p,s)=>is_piece_in_event_space(p) && is_insurgent_piece(p) ], + [ vm_piece, false, 0, 3, (p,s)=>is_piece_in_event_space(p) && is_insurgent_piece(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_endspace ], [ vm_return ], // SHADED 28 [ vm_prompt, "Place FARC Base in a Department next to Venezuela." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && is_next_to_venezuela(s) && can_stack_base(s, FARC) ], - [ vm_auto_place, 0, 0, FARC, BASE ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && is_next_to_venezuela(s) && can_stack_base(s, FARC) ], + [ vm_auto_place, false, 0, FARC, BASE ], [ vm_endspace ], [ vm_prompt, "Sabotage each empty LoC touching Cúcuta." ], - [ vm_space, 1, 0, 0, (s)=>is_loc(s) && is_adjacent(CUCUTA, s) && is_empty(s) && !has_sabotage(s) ], + [ vm_space, true, 999, 999, (s)=>is_loc(s) && is_adjacent(CUCUTA, s) && is_empty(s) && !has_sabotage(s) ], [ vm_sabotage ], [ vm_endspace ], [ vm_return ], // EVENT 29 [ vm_current, GOVT ], [ vm_prompt, "Activate all FARC and free Assault in 1 space." ], - [ vm_space, 1, 0, 1, (s)=>has_underground_guerrilla(s, FARC) || ( assault_kill_count(s) > 0 && (has_farc_piece(s) || has_exposed_piece(s, AUC) || has_exposed_piece(s, CARTELS)) ) ], + [ vm_space, true, 1, 1, (s)=>has_underground_guerrilla(s, FARC) || ( assault_kill_count(s) > 0 && (has_farc_piece(s) || has_exposed_piece(s, AUC) || has_exposed_piece(s, CARTELS)) ) ], [ vm_prompt, "Activate all FARC." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_farc_guerrilla(p) && is_underground(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_farc_guerrilla(p) && is_underground(p) ], [ vm_activate ], [ vm_endpiece ], [ vm_free_assault ], [ vm_endspace ], [ vm_return ], // SHADED 29 - [ vm_current, [FARC,AUC] ], + [ vm_current, FARC_AUC ], [ vm_prompt, "Execute 2 free Ambushes in 1 space." ], - [ vm_space, 1, 0, 1, (s)=>has_piece(s, game.current, GUERRILLA) && has_enemy_piece(s) ], + [ vm_space, true, 1, 1, (s)=>has_piece(s, game.current, GUERRILLA) && has_enemy_piece(s) ], [ vm_repeat, 2 ], - [ vm_prompt, "Execute 2 free Ambushes with any Guerrillas without Activating." ], - [ vm_piece, 1, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_piece(p, game.current, GUERRILLA) && has_enemy_piece(s) ], + [ vm_prompt, "Execute 2 free Ambushes with any Guerrilla without Activating." ], + [ vm_piece, true, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_piece(p, game.current, GUERRILLA) && has_enemy_piece(s) ], [ vm_free_ambush_without_activating ], [ vm_endpiece ], [ vm_endrepeat ], @@ -7380,12 +7425,16 @@ const CODE = [ [ vm_return ], // EVENT 30 [ vm_prompt, "Remove 1 FARC Zone and 1 FARC Base there." ], - [ vm_space, 1, 0, 1, (s)=>is_farc_zone(s) ], + [ vm_space, true, 1, 1, (s)=>is_farc_zone(s) && has_farc_base(s) ], [ vm_remove_farc_zone ], [ vm_prompt, "Remove 1 FARC Base." ], - [ vm_piece, 0, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_farc_base(p) ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_farc_base(p) ], [ vm_remove ], [ vm_endpiece ], + [ vm_return ], + [ vm_endspace ], + [ vm_space, true, 1, 1, (s)=>is_farc_zone(s) ], + [ vm_remove_farc_zone ], [ vm_endspace ], [ vm_return ], // SHADED 30 @@ -7394,23 +7443,23 @@ const CODE = [ [ vm_return ], // EVENT 31 [ vm_prompt, "Shift 2 Cities 1 level toward Active Support." ], - [ vm_space, 1, 0, 2, (s)=>is_city(s) && can_shift_support(s) ], + [ vm_space, true, 2, 2, (s)=>is_city(s) && can_shift_support(s) ], [ vm_shift_support ], [ vm_endspace ], [ vm_prompt, "Shift 1 Department 1 level toward Active Support." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && can_shift_support(s) ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && can_shift_support(s) ], [ vm_shift_support ], [ vm_endspace ], [ vm_return ], // SHADED 31 [ vm_prompt, "Shift 3 spaces from Passive Opposition to Active Opposition." ], - [ vm_space, 1, 0, 3, (s)=>is_passive_opposition(s) ], + [ vm_space, true, 3, 3, (s)=>is_passive_opposition(s) ], [ vm_set_active_opposition ], [ vm_endspace ], [ vm_return ], // EVENT 32 [ vm_prompt, "Shift 2 spaces from Neutral or Passive Opposition to Passive Support." ], - [ vm_space, 1, 0, 2, (s)=>is_neutral(s) || is_passive_opposition(s) ], + [ vm_space, true, 2, 2, (s)=>is_neutral(s) || is_passive_opposition(s) ], [ vm_set_passive_support ], [ vm_endspace ], [ vm_return ], @@ -7419,44 +7468,58 @@ const CODE = [ [ vm_return ], // EVENT 33 [ vm_prompt, "Remove up to 3 Insurgent pieces from a space bordering Ecuador." ], - [ vm_space, 1, 0, 1, (s)=>is_next_to_ecuador(s) && has_insurgent_piece(s) ], - [ vm_piece, 0, 1, 3, (p,s)=>is_piece_in_event_space(p) && is_insurgent_piece(p) ], + [ vm_space, true, 1, 1, (s)=>is_next_to_ecuador(s) && has_insurgent_piece(s) ], + [ vm_piece, false, 0, 3, (p,s)=>is_piece_in_event_space(p) && is_insurgent_piece(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_endspace ], [ vm_return ], // SHADED 33 [ vm_capability, EVT_SUCUMBIOS ], + [ vm_if, ()=>true ], [ vm_set_space, ECUADOR ], - [ vm_place, 0, 0, ()=>(game.current), [BASE,GUERRILLA,TROOPS,POLICE] ], - [ vm_place, 0, 0, ()=>(game.current), [BASE,GUERRILLA,TROOPS,POLICE] ], + [ vm_place, false, 0, ()=>(game.current), ANY_PIECE ], + [ vm_place, false, 0, ()=>(game.current), ANY_PIECE ], + [ vm_else ], + [ vm_prompt, "Place 2 pieces in Ecuador." ], + [ vm_space, true, 1, 1, (s)=>s === ECUADOR ], + [ vm_place, false, 0, ()=>(game.current), ANY_PIECE ], + [ vm_place, false, 0, ()=>(game.current), ANY_PIECE ], + [ vm_endspace ], + [ vm_endif ], [ vm_return ], // EVENT 34 [ vm_resources, -1, -5 ], [ vm_return ], // SHADED 34 - [ vm_current, [FARC,AUC,CARTELS] ], + [ vm_current, FARC_AUC_CARTELS ], [ vm_prompt, "Place 2 Guerrillas and 1 Base into a 0 Population Department." ], - [ vm_space, 1, 0, 1, (s)=>is_zero_pop_dept(s) && can_stack_any(s, game.current) ], - [ vm_auto_place, 0, 0, ()=>(game.current), GUERRILLA ], - [ vm_auto_place, 0, 0, ()=>(game.current), GUERRILLA ], - [ vm_auto_place, 0, 0, ()=>(game.current), BASE ], + [ vm_space, true, 1, 1, (s)=>is_zero_pop_dept(s) && can_place_piece(s, game.current, BASE) ], + [ vm_auto_place, false, 0, ()=>(game.current), BASE ], + [ vm_auto_place, false, 0, ()=>(game.current), GUERRILLA ], + [ vm_auto_place, false, 0, ()=>(game.current), GUERRILLA ], + [ vm_return ], + [ vm_endspace ], + [ vm_space, true, 1, 1, (s)=>is_zero_pop_dept(s) && can_stack_any(s, game.current) ], + [ vm_auto_place, false, 0, ()=>(game.current), BASE ], + [ vm_auto_place, false, 0, ()=>(game.current), GUERRILLA ], + [ vm_auto_place, false, 0, ()=>(game.current), GUERRILLA ], [ vm_endspace ], [ vm_return ], // EVENT 35 [ vm_prompt, "Replace Cartels Bases in 1 Department with Police." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && has_cartels_base(s) && can_replace_with(s, GOVT, POLICE) ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && has_cartels_base(s) && can_replace_with(s, GOVT, POLICE) ], [ vm_prompt, "Replace Cartels Bases with Police." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_cartels_base(p) && can_replace_with(s, GOVT, POLICE) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_cartels_base(p) && can_replace_with(s, GOVT, POLICE) ], [ vm_remove ], - [ vm_auto_place, 0, 0, GOVT, POLICE ], + [ vm_auto_place, false, 0, GOVT, POLICE ], [ vm_endpiece ], [ vm_endspace ], [ vm_aid, 3 ], [ vm_return ], // SHADED 35 [ vm_prompt, "Shift a Department with a Cartels Base 2 levels toward Active Opposition." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && has_cartels_base(s) && can_shift_opposition(s) ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && has_cartels_base(s) && can_shift_opposition(s) ], [ vm_shift_opposition ], [ vm_shift_opposition ], [ vm_endspace ], @@ -7468,14 +7531,14 @@ const CODE = [ [ vm_place_farc_zone ], [ vm_asm, ()=>game.current = game.vm.m ], [ vm_prompt, "Shift 2 adjacent spaces 1 level toward Active Support." ], - [ vm_space, 1, 0, 2, (s)=>is_pop(s) && is_adjacent(game.vm.farc_zone, s) && can_shift_support(s) ], + [ vm_space, true, 2, 2, (s)=>is_pop(s) && is_adjacent(game.vm.farc_zone, s) && can_shift_support(s) ], [ vm_shift_support ], [ vm_endspace ], [ vm_return ], // EVENT 37 [ vm_current, GOVT ], [ vm_prompt, "Free Sweep or Assault FARC within each space; AUC Guerrillas act as Troops." ], - [ vm_space, 1, 0, 0, (s)=>can_sweep_activate(s, FARC) || can_assault(s, FARC) ], + [ vm_space, true, 999, 999, (s)=>can_sweep_activate(s, FARC) || can_assault(s, FARC) ], [ vm_free_sweep_assault_farc ], [ vm_endspace ], [ vm_return ], @@ -7483,93 +7546,93 @@ const CODE = [ [ vm_current, AUC ], [ vm_free_march ], [ vm_prompt, "Free Ambush at any 1 destination." ], - [ vm_space, 1, 0, 1, (s)=>set_has(game.vm.m, s) && has_underground_guerrilla(s, AUC) && has_enemy_piece(s) ], + [ vm_space, true, 1, 1, (s)=>set_has(game.vm.m, s) && has_underground_guerrilla(s, AUC) && has_enemy_piece(s) ], [ vm_prompt, "Free Ambush." ], - [ vm_piece, 0, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_auc_guerrilla(p) && is_underground(p) ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_auc_guerrilla(p) && is_underground(p) ], [ vm_free_ambush ], [ vm_endpiece ], [ vm_endspace ], [ vm_return ], // EVENT 38 [ vm_prompt, "Remove all Active AUC Guerrillas from up to 3 spaces with cubes or Support." ], - [ vm_space, 1, 1, 3, (s)=>(has_cube(s) || is_support(s)) && has_active_guerrilla(s, AUC) ], + [ vm_space, true, 0, 3, (s)=>(has_cube(s) || is_support(s)) && has_active_guerrilla(s, AUC) ], [ vm_prompt, "Remove all AUC Guerrillas." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_active_guerrilla(p, AUC) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_active_guerrilla(p, AUC) ], [ vm_remove ], [ vm_endpiece ], [ vm_endspace ], [ vm_return ], // SHADED 38 [ vm_prompt, "All AUC Guerrillas in spaces with cubes or Support to Underground." ], - [ vm_space, 1, 0, 0, (s)=>(has_cube(s) || is_support(s)) && has_active_guerrilla(s, AUC) ], + [ vm_space, true, 999, 999, (s)=>(has_cube(s) || is_support(s)) && has_active_guerrilla(s, AUC) ], [ vm_prompt, "All AUC Guerrillas to Underground." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_active_guerrilla(p, AUC) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_active_guerrilla(p, AUC) ], [ vm_underground ], [ vm_endpiece ], [ vm_endspace ], [ vm_return ], // EVENT 39 [ vm_prompt, "Place Police into each of 6 Departments." ], - [ vm_space, 1, 0, 6, (s)=>is_dept(s) && can_stack_any(s, GOVT) && has_available_piece(GOVT, POLICE) ], - [ vm_auto_place, 0, 0, GOVT, POLICE ], + [ vm_space, true, 6, 6, (s)=>is_dept(s) && can_stack_any(s, GOVT) && has_available_piece(GOVT, POLICE) ], + [ vm_auto_place, false, 0, GOVT, POLICE ], [ vm_endspace ], [ vm_return ], // SHADED 39 [ vm_prompt, "In up to 3 Departments, replace 1 Police with AUC Guerrilla." ], - [ vm_space, 1, 1, 3, (s)=>is_dept(s) && has_police(s) && can_replace_with(s, AUC, GUERRILLA) ], + [ vm_space, true, 0, 3, (s)=>is_dept(s) && has_police(s) && can_replace_with(s, AUC, GUERRILLA) ], [ vm_prompt, "Replace 1 Police with AUC Guerrilla." ], - [ vm_piece, 0, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_police(p) && can_replace_with(s, AUC, GUERRILLA) ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_police(p) && can_replace_with(s, AUC, GUERRILLA) ], [ vm_remove ], - [ vm_auto_place, 0, 0, AUC, GUERRILLA ], + [ vm_auto_place, false, 0, AUC, GUERRILLA ], [ vm_endpiece ], [ vm_endspace ], [ vm_return ], // EVENT 40 [ vm_prompt, "Replace 3 AUC Guerrillas with Police." ], - [ vm_piece, 1, 0, 3, (p,s)=>is_auc_guerrilla(p) && can_replace_with(s, GOVT, POLICE) ], + [ vm_piece, true, 3, 3, (p,s)=>is_auc_guerrilla(p) && can_replace_with(s, GOVT, POLICE) ], [ vm_set_piece_space ], [ vm_remove ], - [ vm_auto_place, 0, 0, GOVT, POLICE ], + [ vm_auto_place, false, 0, GOVT, POLICE ], [ vm_set_space, -1 ], [ vm_endpiece ], [ vm_return ], // SHADED 40 [ vm_prompt, "Move all cubes in a Department with AUC to any Cities." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && has_auc_piece(s) && has_cube(s) ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && has_auc_piece(s) && has_cube(s) ], [ vm_prompt, "Move all cubes to any Cities." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_cube(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_cube(p) ], [ vm_save_space ], [ vm_prompt, "Move cube to any City." ], - [ vm_space, 0, 0, 1, (s)=>is_city(s) ], + [ vm_space, false, 1, 1, (s)=>is_city(s) ], [ vm_move ], [ vm_endspace ], [ vm_restore_space ], [ vm_endpiece ], [ vm_endspace ], [ vm_prompt, "Place 1 AUC piece in each of 2 Cities." ], - [ vm_space, 1, 0, 2, (s)=>is_city(s) ], - [ vm_place, 0, 0, AUC, [BASE,GUERRILLA] ], + [ vm_space, true, 2, 2, (s)=>is_city(s) ], + [ vm_place, false, 0, AUC, BASE_GUERRILLA ], [ vm_endspace ], [ vm_return ], // EVENT 41 [ vm_resources, AUC, -6 ], [ vm_prompt, "Remove all AUC pieces from 1 space." ], - [ vm_space, 1, 0, 1, (s)=>has_auc_piece(s) ], + [ vm_space, true, 1, 1, (s)=>has_auc_piece(s) ], [ vm_prompt, "Remove all AUC pieces." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_auc_piece(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_auc_piece(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_endspace ], [ vm_return ], // SHADED 41 [ vm_prompt, "AUC Resources +3 for each space with AUC and Cartels pieces." ], - [ vm_space, 1, 0, 0, (s)=>has_auc_piece(s) && has_cartels_piece(s) ], + [ vm_space, true, 999, 999, (s)=>has_auc_piece(s) && has_cartels_piece(s) ], [ vm_auto_resources, AUC, 3 ], [ vm_endspace ], [ vm_return ], // EVENT 42 [ vm_prompt, "Shift 2 Neutral spaces to Passive Support." ], - [ vm_space, 1, 0, 2, (s)=>is_neutral(s) ], + [ vm_space, true, 2, 2, (s)=>is_neutral(s) ], [ vm_set_passive_support ], [ vm_endspace ], [ vm_resources, GOVT, 3 ], @@ -7581,18 +7644,23 @@ const CODE = [ [ vm_return ], // EVENT 43 [ vm_prompt, "Place 2 Terror and remove all FARC Bases from a Department with Troops." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && has_troops(s) ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && has_troops(s) && has_farc_base(s) ], [ vm_terror ], [ vm_terror ], [ vm_prompt, "Remove all FARC Bases." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_farc_base(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_farc_base(p) ], [ vm_remove ], [ vm_endpiece ], + [ vm_return ], + [ vm_endspace ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && has_troops(s) ], + [ vm_terror ], + [ vm_terror ], [ vm_endspace ], [ vm_return ], // SHADED 43 [ vm_prompt, "Place 2 Terror in a Department with Troops." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && has_troops(s) ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && has_troops(s) ], [ vm_terror ], [ vm_terror ], [ vm_endspace ], @@ -7600,43 +7668,47 @@ const CODE = [ [ vm_return ], // EVENT 44 [ vm_prompt, "Shift a non-Opposition City to Active Support." ], - [ vm_space, 1, 0, 1, (s)=>is_city(s) && !is_opposition(s) && can_shift_support(s) ], + [ vm_space, true, 1, 1, (s)=>is_city(s) && !is_opposition(s) && can_shift_support(s) ], [ vm_set_active_support ], [ vm_endspace ], [ vm_resources, GOVT, 3 ], [ vm_return ], // SHADED 44 [ vm_prompt, "Shift a City from Support to Neutral." ], - [ vm_space, 1, 0, 1, (s)=>is_city(s) && is_support(s) ], + [ vm_space, true, 1, 1, (s)=>is_city(s) && is_support(s) ], [ vm_set_neutral ], [ vm_endspace ], [ vm_resources, GOVT, -3 ], [ vm_return ], // EVENT 45 [ vm_prompt, "Shift each space with cubes and Terror 1 level toward Active Support." ], - [ vm_space, 1, 0, 0, (s)=>has_cube(s) && has_terror(s) && can_shift_support(s) ], + [ vm_space, true, 999, 999, (s)=>has_cube(s) && has_terror(s) && can_shift_support(s) ], [ vm_shift_support ], [ vm_endspace ], [ vm_return ], // SHADED 45 + [ vm_if, ()=>true ], + [ vm_aid, ()=>(-count_matching_spaces(s=>has_faction_piece(s,AUC))) ], + [ vm_else ], [ vm_prompt, "Aid -1 for each space with AUC pieces." ], - [ vm_space, 1, 0, 0, (s)=>has_auc_piece(s) ], + [ vm_space, true, 999, 999, (s)=>has_auc_piece(s) ], [ vm_auto_aid, -1 ], [ vm_endspace ], + [ vm_endif ], [ vm_roll ], [ vm_resources, GOVT, ()=>(-game.vm.die) ], [ vm_return ], // EVENT 46 - [ vm_current, [FARC,AUC,CARTELS] ], + [ vm_current, FARC_AUC_CARTELS ], [ vm_prompt, "Execute free Terror with any Guerrilla." ], - [ vm_space, 1, 0, 1, (s)=>has_piece(s, game.current, GUERRILLA) ], - [ vm_piece, 0, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_piece(p, game.current, GUERRILLA) ], + [ vm_space, true, 1, 1, (s)=>has_piece(s, game.current, GUERRILLA) ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_piece(p, game.current, GUERRILLA) ], [ vm_free_terror ], [ vm_terror ], [ vm_terror_aid_cut ], [ vm_endpiece ], [ vm_prompt, "Remove enemy pieces." ], - [ vm_piece, 1, 0, 2, (p,s)=>is_piece_in_event_space(p) && is_enemy_piece(p) ], + [ vm_piece, true, 2, 2, (p,s)=>is_piece_in_event_space(p) && is_enemy_piece(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_if, ()=>is_pop(game.vm.s) ], @@ -7646,29 +7718,28 @@ const CODE = [ [ vm_return ], // EVENT 47 [ vm_prompt, "All AUC Guerrillas to Active." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_auc_guerrilla(p) && is_underground(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_auc_guerrilla(p) && is_underground(p) ], [ vm_activate ], [ vm_endpiece ], [ vm_prompt, "All Police free Assault AUC as if Troops." ], - [ vm_space, 1, 0, 0, (s)=>has_police(s) && has_auc_piece(s) ], + [ vm_space, true, 999, 999, (s)=>has_police(s) && has_auc_piece(s) ], [ vm_free_assault_auc ], [ vm_endspace ], [ vm_return ], // SHADED 47 [ vm_current, AUC ], - [ vm_set_space, CUCUTA ], [ vm_prompt, "Place 2 AUC Guerrillas in Cúcuta." ], - [ vm_space, 1, 0, 1, (s)=>s === CUCUTA ], - [ vm_auto_place, 0, 0, AUC, GUERRILLA ], - [ vm_auto_place, 0, 0, AUC, GUERRILLA ], + [ vm_space, true, 1, 1, (s)=>s === CUCUTA ], + [ vm_auto_place, false, 0, AUC, GUERRILLA ], + [ vm_auto_place, false, 0, AUC, GUERRILLA ], [ vm_prompt, "Execute free Terror in Cúcuta." ], - [ vm_piece, 0, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_auc_guerrilla(p) && is_underground(p) ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_auc_guerrilla(p) && is_underground(p) ], [ vm_free_terror ], [ vm_terror_aid_cut ], [ vm_endpiece ], [ vm_endspace ], [ vm_prompt, "Flip any 2 AUC Guerrillas Underground." ], - [ vm_piece, 0, 0, 2, (p,s)=>is_auc_guerrilla(p) && is_active(p) ], + [ vm_piece, false, 2, 2, (p,s)=>is_auc_guerrilla(p) && is_active(p) ], [ vm_underground ], [ vm_endpiece ], [ vm_return ], @@ -7684,7 +7755,7 @@ const CODE = [ [ vm_return ], // SHADED 48 [ vm_prompt, "Shift 2 Cities other than Bogotá 1 level toward Active Opposition." ], - [ vm_space, 1, 0, 2, (s)=>s !== BOGOTA && is_city(s) && can_shift_opposition(s) ], + [ vm_space, true, 2, 2, (s)=>s !== BOGOTA && is_city(s) && can_shift_opposition(s) ], [ vm_shift_opposition ], [ vm_endspace ], [ vm_return ], @@ -7696,9 +7767,14 @@ const CODE = [ [ vm_return ], // SHADED 49 [ vm_prompt, "Place an AUC Guerrilla and Base in any Department." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && can_stack_any(s, AUC) ], - [ vm_auto_place, 0, 0, AUC, GUERRILLA ], - [ vm_auto_place, 0, 0, AUC, BASE ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && can_place_piece(s, AUC, BASE) ], + [ vm_auto_place, false, 0, AUC, BASE ], + [ vm_auto_place, false, 0, AUC, GUERRILLA ], + [ vm_return ], + [ vm_endspace ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && can_stack_any(s, AUC) ], + [ vm_auto_place, false, 0, AUC, BASE ], + [ vm_auto_place, false, 0, AUC, GUERRILLA ], [ vm_endspace ], [ vm_return ], // EVENT 50 @@ -7706,31 +7782,31 @@ const CODE = [ [ vm_repeat, 3 ], [ vm_if, ()=>!game.vm.opt ], [ vm_prompt, "Place up to 3 Police into any Departments." ], - [ vm_space, 1, 1, 1, (s)=>is_dept(s) && can_stack_any(s, GOVT) ], - [ vm_auto_place, 0, 0, GOVT, POLICE ], + [ vm_space, true, 0, 1, (s)=>is_dept(s) && can_stack_any(s, GOVT) ], + [ vm_auto_place, false, 0, GOVT, POLICE ], [ vm_endspace ], [ vm_endif ], [ vm_endrepeat ], [ vm_return ], // SHADED 50 [ vm_prompt, "Remove any 2 Police or replace them with available AUC Guerrillas." ], - [ vm_piece, 1, 0, 1, (p,s)=>is_police(p) ], + [ vm_piece, true, 1, 1, (p,s)=>is_police(p) ], [ vm_set_piece_space ], [ vm_remove ], - [ vm_place, 0, 1, AUC, GUERRILLA ], + [ vm_place, false, 1, AUC, GUERRILLA ], [ vm_set_space, -1 ], [ vm_endpiece ], [ vm_if, ()=>game.vm.opt ], [ vm_prompt, "Remove 1 more Police." ], - [ vm_piece, 1, 0, 1, (p,s)=>is_police(p) ], + [ vm_piece, true, 1, 1, (p,s)=>is_police(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_else ], [ vm_prompt, "Replace 1 more Police with AUC Guerrilla." ], - [ vm_piece, 1, 0, 1, (p,s)=>is_police(p) && can_replace_with(s, AUC, GUERRILLA) ], + [ vm_piece, true, 1, 1, (p,s)=>is_police(p) && can_replace_with(s, AUC, GUERRILLA) ], [ vm_set_piece_space ], [ vm_remove ], - [ vm_auto_place, 0, 0, AUC, GUERRILLA ], + [ vm_auto_place, false, 0, AUC, GUERRILLA ], [ vm_set_space, -1 ], [ vm_endpiece ], [ vm_endif ], @@ -7738,7 +7814,7 @@ const CODE = [ // EVENT 51 [ vm_if, ()=>is_any_pipeline_sabotaged() ], [ vm_prompt, "Remove all Pipeline Sabotage." ], - [ vm_space, 1, 0, 0, (s)=>is_pipeline(s) && has_sabotage(s) ], + [ vm_space, true, 999, 999, (s)=>is_pipeline(s) && has_sabotage(s) ], [ vm_remove_sabotage ], [ vm_endspace ], [ vm_else ], @@ -7747,45 +7823,49 @@ const CODE = [ [ vm_return ], // SHADED 51 [ vm_prompt, "Sabotage 3 Pipelines with or adjacent to FARC Guerrillas." ], - [ vm_space, 1, 0, 3, (s)=>is_pipeline(s) && is_with_or_adjacent_to_farc_guerrilla(s) ], + [ vm_space, true, 3, 3, (s)=>is_pipeline(s) && is_with_or_adjacent_to_farc_guerrilla(s) ], [ vm_sabotage ], [ vm_endspace ], [ vm_return ], // EVENT 52 [ vm_prompt, "Shift 2 City or Mountain each 1 level toward Active Support." ], - [ vm_space, 1, 0, 2, (s)=>(is_city(s) || is_mountain(s)) && can_shift_support(s) ], + [ vm_space, true, 2, 2, (s)=>(is_city(s) || is_mountain(s)) && can_shift_support(s) ], [ vm_shift_support ], [ vm_endspace ], [ vm_return ], // SHADED 52 [ vm_prompt, "Place an AUC Base into a space with AUC." ], - [ vm_space, 1, 0, 1, (s)=>has_auc_piece(s) && can_stack_base(s, AUC) ], - [ vm_auto_place, 0, 0, AUC, BASE ], + [ vm_space, true, 1, 1, (s)=>has_auc_piece(s) && can_stack_base(s, AUC) ], + [ vm_auto_place, false, 0, AUC, BASE ], [ vm_endspace ], + [ vm_if, ()=>true ], + [ vm_resources, AUC, ()=>(count_pieces_on_map(AUC,BASE)) ], + [ vm_else ], [ vm_prompt, "AUC Resources +1 per AUC Base." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_auc_base(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_auc_base(p) ], [ vm_auto_resources, AUC, 1 ], [ vm_endpiece ], + [ vm_endif ], [ vm_return ], // EVENT 53 - [ vm_current, [FARC,AUC,CARTELS] ], + [ vm_current, FARC_AUC_CARTELS ], [ vm_prompt, "Select Departments to move Guerrillas between." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) ], [ vm_mark_space ], [ vm_endspace ], [ vm_if, ()=>has_piece(game.vm.m[0], game.current, GUERRILLA) ], [ vm_prompt, "Select Departments to move Guerrillas between." ], - [ vm_space, 1, 0, 1, (s)=>(s !== game.vm.m[0]) && is_dept(s) ], + [ vm_space, true, 1, 1, (s)=>(s !== game.vm.m[0]) && is_dept(s) ], [ vm_mark_space ], [ vm_endspace ], [ vm_else ], [ vm_prompt, "Select Departments to move Guerrillas between." ], - [ vm_space, 1, 0, 1, (s)=>is_dept(s) && has_piece(s, game.current, GUERRILLA) ], + [ vm_space, true, 1, 1, (s)=>is_dept(s) && has_piece(s, game.current, GUERRILLA) ], [ vm_mark_space ], [ vm_endspace ], [ vm_endif ], [ vm_prompt, "Move Guerrillas between Departments." ], - [ vm_piece, 0, 0, 2, (p,s)=>is_piece(p, game.current, GUERRILLA) && (s === game.vm.m[0] || s === game.vm.m[1]) ], + [ vm_piece, false, 2, 2, (p,s)=>is_piece(p, game.current, GUERRILLA) && (s === game.vm.m[0] || s === game.vm.m[1]) ], [ vm_if, ()=>piece_space(game.vm.p) === game.vm.m[0] ], [ vm_set_space, ()=>(game.vm.m[1]) ], [ vm_else ], @@ -7797,58 +7877,42 @@ const CODE = [ [ vm_endpiece ], [ vm_return ], // EVENT 54 - [ vm_prompt, "Remove up to 2 Guerrillas or replace them with with another Faction's." ], - [ vm_piece, 1, 0, 1, (p,s)=>is_any_guerrilla(p) ], + [ vm_prompt, "Remove up to 2 Guerrillas or replace them with with another Faction's Guerrillas." ], + [ vm_piece, true, 1, 1, (p,s)=>is_any_guerrilla(p) ], [ vm_set_piece_space ], [ vm_remove ], - [ vm_if, ()=>piece_faction(game.vm.p) === FARC ], - [ vm_place, 0, 1, [AUC,CARTELS], GUERRILLA ], - [ vm_endif ], - [ vm_if, ()=>piece_faction(game.vm.p) === AUC ], - [ vm_place, 0, 1, [FARC,CARTELS], GUERRILLA ], - [ vm_endif ], - [ vm_if, ()=>piece_faction(game.vm.p) === CARTELS ], - [ vm_place, 0, 1, [FARC,AUC], GUERRILLA ], - [ vm_endif ], + [ vm_place, false, 1, ()=>(piece_enemy_factions(game.vm.p)), GUERRILLA ], [ vm_set_space, -1 ], [ vm_endpiece ], [ vm_if, ()=>game.vm.opt ], [ vm_prompt, "Remove 1 more Guerrilla." ], - [ vm_piece, 1, 1, 1, (p,s)=>is_any_guerrilla(p) ], + [ vm_piece, true, 0, 1, (p,s)=>is_any_guerrilla(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_else ], [ vm_prompt, "Replace 1 more Guerrilla." ], - [ vm_piece, 1, 1, 1, (p,s)=>is_any_guerrilla(p) && ( can_replace_with(s, FARC, GUERRILLA) || can_replace_with(s, AUC, GUERRILLA) || can_replace_with(s, CARTELS, GUERRILLA) ) ], + [ vm_piece, true, 0, 1, (p,s)=>is_any_guerrilla(p) && ( can_replace_with(s, FARC, GUERRILLA) || can_replace_with(s, AUC, GUERRILLA) || can_replace_with(s, CARTELS, GUERRILLA) ) ], [ vm_set_piece_space ], [ vm_remove ], - [ vm_if, ()=>piece_faction(game.vm.p) === FARC ], - [ vm_place, 0, 0, [AUC,CARTELS], GUERRILLA ], - [ vm_endif ], - [ vm_if, ()=>piece_faction(game.vm.p) === AUC ], - [ vm_place, 0, 0, [FARC,CARTELS], GUERRILLA ], - [ vm_endif ], - [ vm_if, ()=>piece_faction(game.vm.p) === CARTELS ], - [ vm_place, 0, 0, [FARC,AUC], GUERRILLA ], - [ vm_endif ], + [ vm_place, false, 1, ()=>(piece_enemy_factions(game.vm.p)), GUERRILLA ], [ vm_set_space, -1 ], [ vm_endpiece ], [ vm_endif ], [ vm_return ], // EVENT 55 [ vm_prompt, "Remove 2 Shipments." ], - [ vm_shipment, 0, 0, 2, (p,s)=>true ], + [ vm_shipment, false, 2, 2, (p,s)=>true ], [ vm_remove_shipment ], [ vm_endshipment ], [ vm_prompt, "Remove 5 Cartels Guerrillas." ], - [ vm_piece, 0, 0, 5, (p,s)=>is_cartels_guerrilla(p) ], + [ vm_piece, false, 5, 5, (p,s)=>is_cartels_guerrilla(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_aid, 3 ], [ vm_return ], // SHADED 55 [ vm_prompt, "Shift 3 spaces with Cartels pieces 1 level toward Active Opposition." ], - [ vm_space, 1, 0, 3, (s)=>can_shift_opposition(s) && has_cartels_piece(s) ], + [ vm_space, true, 3, 3, (s)=>can_shift_opposition(s) && has_cartels_piece(s) ], [ vm_shift_opposition ], [ vm_endspace ], [ vm_return ], @@ -7857,46 +7921,46 @@ const CODE = [ [ vm_return ], // SHADED 56 [ vm_prompt, "Add twice Cartels pieces in Cities to Cartels Resources." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_cartels_piece(p) && is_city(s) ], + [ vm_piece, false, 999, 999, (p,s)=>is_cartels_piece(p) && is_city(s) ], [ vm_auto_resources, CARTELS, 2 ], [ vm_endpiece ], [ vm_prompt, "Place a Cartels Base in each of 2 Cities." ], - [ vm_space, 1, 0, 2, (s)=>is_city(s) && can_stack_base(s, CARTELS) ], - [ vm_auto_place, 0, 0, CARTELS, BASE ], + [ vm_space, true, 2, 2, (s)=>is_city(s) && can_stack_base(s, CARTELS) ], + [ vm_auto_place, false, 0, CARTELS, BASE ], [ vm_endspace ], [ vm_return ], // EVENT 57 [ vm_prompt, "Replace up to 3 Cartels pieces with Police." ], - [ vm_piece, 1, 1, 3, (p,s)=>is_cartels_piece(p) && can_replace_with(s, GOVT, POLICE) ], + [ vm_piece, true, 0, 3, (p,s)=>is_cartels_piece(p) && can_replace_with(s, GOVT, POLICE) ], [ vm_set_piece_space ], [ vm_remove ], - [ vm_auto_place, 0, 0, GOVT, POLICE ], + [ vm_auto_place, false, 0, GOVT, POLICE ], [ vm_set_space, -1 ], [ vm_endpiece ], [ vm_return ], // SHADED 57 [ vm_prompt, "In each of 2 spaces replace a Police with any Cartels piece." ], - [ vm_space, 1, 0, 2, (s)=>has_police(s) ], + [ vm_space, true, 2, 2, (s)=>has_police(s) ], [ vm_prompt, "Replace a Police with any Cartels piece." ], - [ vm_piece, 0, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_police(p) ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_police(p) && can_replace_with(s, CARTELS, GUERRILLA) ], [ vm_remove ], - [ vm_place, 0, 0, CARTELS, [BASE,GUERRILLA] ], + [ vm_place, false, 0, CARTELS, BASE_GUERRILLA ], [ vm_endpiece ], [ vm_endspace ], [ vm_return ], // EVENT 58 [ vm_resources, CARTELS, -6 ], [ vm_prompt, "Remove all Cartels Guerrillas." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_cartels_guerrilla(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_cartels_guerrilla(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_return ], // SHADED 58 [ vm_current, CARTELS ], [ vm_prompt, "Relocate up to 4 Police to any spaces." ], - [ vm_piece, 1, 1, 4, (p,s)=>is_police(p) ], + [ vm_piece, true, 0, 4, (p,s)=>is_police(p) ], [ vm_prompt, "Relocate Police to any space." ], - [ vm_space, 0, 0, 1, (s)=>can_stack_piece(s, GOVT, POLICE) ], + [ vm_space, false, 1, 1, (s)=>can_stack_piece(s, GOVT, POLICE) ], [ vm_move ], [ vm_endspace ], [ vm_endpiece ], @@ -7904,33 +7968,33 @@ const CODE = [ // EVENT 59 [ vm_current, GOVT ], [ vm_prompt, "All Cartels Guerrillas to Active." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_cartels_guerrilla(p) && is_underground(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_cartels_guerrilla(p) && is_underground(p) ], [ vm_activate ], [ vm_endpiece ], [ vm_prompt, "Free Assault against Cartels in each space." ], - [ vm_space, 1, 0, 0, (s)=>can_assault(s, CARTELS) ], + [ vm_space, true, 999, 999, (s)=>can_assault(s, CARTELS) ], [ vm_free_assault_cartels ], [ vm_endspace ], [ vm_return ], // SHADED 59 [ vm_current, CARTELS ], [ vm_prompt, "Flip all Cartels Guerrillas Underground." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_cartels_guerrilla(p) && is_active(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_cartels_guerrilla(p) && is_active(p) ], [ vm_underground ], [ vm_endpiece ], [ vm_prompt, "Relocate up to 3 Cartels Guerrillas anywhere." ], - [ vm_piece, 1, 1, 3, (p,s)=>is_cartels_guerrilla(p) ], + [ vm_piece, true, 0, 3, (p,s)=>is_cartels_guerrilla(p) ], [ vm_prompt, "Relocate Cartels Guerrilla anywhere." ], - [ vm_space, 0, 0, 1, (s)=>!is_event_piece_space(s) && can_stack_piece(s, CARTELS, GUERRILLA) ], + [ vm_space, false, 1, 1, (s)=>!is_event_piece_space(s) && can_stack_piece(s, CARTELS, GUERRILLA) ], [ vm_move ], [ vm_endspace ], [ vm_endpiece ], [ vm_return ], // EVENT 60 [ vm_prompt, "Remove all Cartels pieces from 2 Cities or 1 Department." ], - [ vm_space, 1, 0, 2, (s)=>has_cartels_piece(s) && ((is_city(s) && (game.vm.ss.length === 0 || is_city(game.vm.ss[0]))) || (is_dept(s) && game.vm.ss.length === 0)) ], + [ vm_space, true, 2, 2, (s)=>has_cartels_piece(s) && ((is_city(s) && (game.vm.ss.length === 0 || is_city(game.vm.ss[0]))) || (is_dept(s) && game.vm.ss.length === 0)) ], [ vm_prompt, "Remove all Cartels pieces." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_cartels_piece(p) ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_cartels_piece(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_endspace ], @@ -7939,19 +8003,19 @@ const CODE = [ // SHADED 60 [ vm_current, CARTELS ], [ vm_prompt, "Place a Cartels Base in each of 2 Cities." ], - [ vm_space, 1, 0, 2, (s)=>is_city(s) && can_stack_base(s, CARTELS) ], - [ vm_auto_place, 0, 0, CARTELS, BASE ], + [ vm_space, true, 2, 2, (s)=>is_city(s) && can_stack_base(s, CARTELS) ], + [ vm_auto_place, false, 0, CARTELS, BASE ], [ vm_endspace ], [ vm_prompt, "Free Bribe in 1 space." ], - [ vm_space, 1, 0, 1, (s)=>!is_empty(s) ], + [ vm_space, true, 1, 1, (s)=>!is_empty(s) ], [ vm_free_bribe ], [ vm_endspace ], [ vm_return ], // EVENT 61 [ vm_prompt, "Remove all Cartels pieces from 1 City." ], - [ vm_space, 1, 0, 1, (s)=>is_city(s) && has_cartels_piece(s) ], + [ vm_space, true, 1, 1, (s)=>is_city(s) && has_cartels_piece(s) ], [ vm_prompt, "Remove all Cartels pieces." ], - [ vm_piece, 1, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_cartels_piece(p) ], + [ vm_piece, true, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_cartels_piece(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_endspace ], @@ -7959,32 +8023,32 @@ const CODE = [ [ vm_return ], // SHADED 61 [ vm_prompt, "Place 1 Cartels Base into each of 3 Departments with no Cartels pieces." ], - [ vm_space, 1, 0, 3, (s)=>is_dept(s) && !has_cartels_piece(s) && can_stack_base(s, CARTELS) ], - [ vm_auto_place, 0, 0, CARTELS, BASE ], + [ vm_space, true, 3, 3, (s)=>is_dept(s) && !has_cartels_piece(s) && can_stack_base(s, CARTELS) ], + [ vm_auto_place, false, 0, CARTELS, BASE ], [ vm_endspace ], [ vm_return ], // EVENT 62 [ vm_prompt, "Remove up to 3 Insurgent pieces for 0 Population Forests." ], - [ vm_piece, 1, 1, 3, (p,s)=>is_insurgent_piece(p) && is_zero_pop_forest(s) ], + [ vm_piece, true, 0, 3, (p,s)=>is_insurgent_piece(p) && is_zero_pop_forest(s) ], [ vm_remove ], [ vm_endpiece ], [ vm_return ], // SHADED 62 [ vm_prompt, "Place 1 Cartels Base each in Guainia, Vaupés, and Amazonas." ], - [ vm_space, 1, 0, 3, (s)=>(s === GUAINIA || s === VAUPES || s === AMAZONAS) && can_stack_base(s, CARTELS) ], - [ vm_auto_place, 0, 0, CARTELS, BASE ], + [ vm_space, true, 3, 3, (s)=>(s === GUAINIA || s === VAUPES || s === AMAZONAS) && can_stack_base(s, CARTELS) ], + [ vm_auto_place, false, 0, CARTELS, BASE ], [ vm_endspace ], [ vm_return ], // EVENT 63 [ vm_current, CARTELS ], [ vm_prompt, "In each space with Cartels Guerrillas..." ], - [ vm_space, 1, 0, 0, (s)=>has_cartels_guerrilla(s) ], + [ vm_space, true, 999, 999, (s)=>has_cartels_guerrilla(s) ], [ vm_prompt, "Remove all but one Cartels Guerrilla." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_cartels_guerrilla(p) && count_pieces(s, CARTELS, GUERRILLA) > 1 ], + [ vm_piece, false, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_cartels_guerrilla(p) && count_pieces(s, CARTELS, GUERRILLA) > 1 ], [ vm_remove ], [ vm_endpiece ], [ vm_prompt, "Free Terror with remaining Cartels Guerrilla." ], - [ vm_piece, 0, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_cartels_guerrilla(p) ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_cartels_guerrilla(p) ], [ vm_free_terror ], [ vm_endpiece ], [ vm_endspace ], @@ -7996,7 +8060,7 @@ const CODE = [ [ vm_prompt, "Place 2 Shipments with FARC Guerrillas in the same spaces as Cartels Bases." ], [ vm_if, ()=>has_available_shipment() ], [ vm_asm, ()=>game.vm.shipment = find_available_shipment() ], - [ vm_piece, 1, 0, 1, (p,s)=>is_farc_guerrilla(p) && has_cartels_base(s) ], + [ vm_piece, true, 1, 1, (p,s)=>is_farc_guerrilla(p) && has_cartels_base(s) ], [ vm_place_shipment ], [ vm_endpiece ], [ vm_endif ], @@ -8004,31 +8068,36 @@ const CODE = [ [ vm_return ], // SHADED 64 [ vm_prompt, "Cartels Resources +2 for each Cartels Base in a City." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_cartels_base(p) && is_city(s) ], + [ vm_piece, false, 999, 999, (p,s)=>is_cartels_base(p) && is_city(s) ], [ vm_auto_resources, CARTELS, 2 ], [ vm_endpiece ], [ vm_prompt, "Cartels Resources +1 for each Cartels Base in a Department." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_cartels_base(p) && is_dept(s) ], + [ vm_piece, false, 999, 999, (p,s)=>is_cartels_base(p) && is_dept(s) ], [ vm_auto_resources, CARTELS, 1 ], [ vm_endpiece ], [ vm_return ], // EVENT 65 [ vm_prompt, "Place or remove 1 Shipment and Insurgent Base in any Mountain Department." ], - [ vm_space, 1, 0, 1, (s)=>is_mountain(s) ], + [ 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_shipment ], + [ vm_place_or_remove_insurgent_base ], + [ vm_return ], + [ vm_endspace ], + [ 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_shipment ], [ vm_place_or_remove_insurgent_base ], [ vm_endspace ], [ vm_return ], // EVENT 66 [ vm_prompt, "Remove 3 Cartels Bases from Forest." ], - [ vm_piece, 1, 0, 3, (p,s)=>is_cartels_base(p) && is_forest(s) ], + [ vm_piece, true, 3, 3, (p,s)=>is_cartels_base(p) && is_forest(s) ], [ vm_remove ], [ vm_endpiece ], [ vm_return ], // SHADED 66 [ vm_prompt, "Place Cartels Base into each Forest that already has one." ], - [ vm_space, 1, 0, 0, (s)=>is_forest(s) && has_cartels_base(s) && can_stack_base(s, CARTELS) ], - [ vm_auto_place, 0, 0, CARTELS, BASE ], + [ vm_space, true, 999, 999, (s)=>is_forest(s) && has_cartels_base(s) && can_stack_base(s, CARTELS) ], + [ vm_auto_place, false, 0, CARTELS, BASE ], [ vm_endspace ], [ vm_return ], // EVENT 67 @@ -8044,46 +8113,46 @@ const CODE = [ [ vm_if, ()=>game.vm.p >= 0 ], [ vm_remove ], [ vm_prompt, "Remove 1 more Cartels piece from coastal spaces." ], - [ vm_piece, 0, 0, 1, (p,s)=>is_coastal_space(s) && is_cartels_piece(p) ], + [ vm_piece, false, 1, 1, (p,s)=>is_coastal_space(s) && is_cartels_piece(p) ], [ vm_remove ], [ vm_endpiece ], [ vm_endif ], [ vm_if, ()=>game.vm.sh >= 0 ], [ vm_remove_shipment ], [ vm_prompt, "Remove up to 1 more Shipment from coastal spaces." ], - [ vm_shipment, 0, 1, 1, (p,s)=>is_coastal_space(s) ], + [ vm_shipment, false, 0, 1, (p,s)=>is_coastal_space(s) ], [ vm_remove_shipment ], [ vm_endshipment ], [ vm_endif ], [ vm_return ], // SHADED 68 [ vm_prompt, "Cartels Resources +2 per Cartels piece in coastal spaces." ], - [ vm_piece, 0, 0, 0, (p,s)=>is_cartels_piece(p) && is_coastal_space(s) ], + [ vm_piece, false, 999, 999, (p,s)=>is_cartels_piece(p) && is_coastal_space(s) ], [ vm_auto_resources, CARTELS, 2 ], [ vm_endpiece ], [ vm_return ], // EVENT 69 [ vm_prompt, "Select source space." ], [ vm_if, ()=>game.current === GOVT ], - [ vm_space, 1, 0, 1, (s)=>has_cube(s) ], + [ vm_space, true, 1, 1, (s)=>has_cube(s) ], [ vm_mark_space ], [ vm_endspace ], [ vm_else ], - [ vm_space, 1, 0, 1, (s)=>has_piece(s, game.current, GUERRILLA) ], + [ vm_space, true, 1, 1, (s)=>has_piece(s, game.current, GUERRILLA) ], [ vm_mark_space ], [ vm_endspace ], [ vm_endif ], [ vm_prompt, "Select destination Department." ], - [ vm_space, 1, 0, 1, (s)=>(s !== game.vm.m[0]) && is_within_adjacent_depts(s, game.vm.m[0], 3) && can_stack_any(s, game.current) ], + [ vm_space, true, 1, 1, (s)=>(s !== game.vm.m[0]) && is_within_adjacent_depts(s, game.vm.m[0], 3) && can_stack_any(s, game.current) ], [ vm_if, ()=>game.current === GOVT ], [ vm_prompt, "Move cubes to destination." ], - [ vm_piece, 1, 1, 0, (p,s)=>(s === game.vm.m[0]) && is_cube(p) && can_stack_any(s, GOVT) ], + [ vm_piece, true, 0, 999, (p,s)=>(s === game.vm.m[0]) && is_cube(p) && can_stack_any(s, GOVT) ], [ vm_move ], [ vm_endpiece ], [ vm_free_train_sweep_assault ], [ vm_else ], [ vm_prompt, "Move Guerrillas to destination." ], - [ vm_piece, 1, 1, 0, (p,s)=>(s === game.vm.m[0]) && is_piece(p, game.current, GUERRILLA) && can_stack_any(s, game.current) ], + [ vm_piece, true, 0, 999, (p,s)=>(s === game.vm.m[0]) && is_piece(p, game.current, GUERRILLA) && can_stack_any(s, game.current) ], [ vm_move ], [ vm_endpiece ], [ vm_free_rally_attack_terror ], @@ -8092,16 +8161,16 @@ const CODE = [ [ vm_return ], // EVENT 70 [ vm_prompt, "Government Resources +6 for each Forest without Guerrillas." ], - [ vm_space, 0, 0, 0, (s)=>is_forest(s) && !has_any_guerrilla(s) ], + [ vm_space, false, 999, 999, (s)=>is_forest(s) && !has_any_guerrilla(s) ], [ vm_auto_resources, GOVT, 6 ], [ vm_endspace ], [ vm_return ], // SHADED 70 - [ vm_current, [FARC,AUC,CARTELS] ], + [ vm_current, FARC_AUC_CARTELS ], [ vm_prompt, "Free Terror in each Forest and +3 Resources per Terror." ], - [ vm_space, 1, 0, 0, (s)=>is_forest(s) && has_piece(s, game.current, GUERRILLA) ], + [ vm_space, true, 999, 999, (s)=>is_forest(s) && has_piece(s, game.current, GUERRILLA) ], [ vm_prompt, "Free Terror with any 1 Guerrilla." ], - [ vm_piece, 0, 0, 1, (p,s)=>is_piece_in_event_space(p) && is_piece(p, game.current, GUERRILLA) ], + [ vm_piece, false, 1, 1, (p,s)=>is_piece_in_event_space(p) && is_piece(p, game.current, GUERRILLA) ], [ vm_free_terror ], [ vm_auto_resources, ()=>(game.current), 3 ], [ vm_endpiece ], @@ -8111,26 +8180,32 @@ const CODE = [ // EVENT 71 [ vm_prompt, "Remove a Guerrilla from Chocó." ], [ vm_set_space, CHOCO ], - [ vm_piece, 0, 0, 1, (p,s)=>is_any_guerrilla(p) && s === CHOCO ], + [ vm_piece, false, 1, 1, (p,s)=>is_any_guerrilla(p) && s === CHOCO ], [ vm_remove ], [ vm_resources, ()=>(piece_faction(game.vm.p)), -5 ], [ vm_endpiece ], [ vm_return ], // SHADED 71 [ vm_capability, EVT_DARIEN ], + [ vm_if, ()=>true ], + [ vm_set_space, PANAMA ], + [ vm_place, false, 0, ()=>(game.current), BASE ], + [ vm_place, false, 1, ()=>(game.current), BASE ], + [ vm_else ], [ vm_prompt, "Place 1-2 Bases in Panamá." ], - [ vm_space, 1, 0, 1, (s)=>s === PANAMA ], - [ vm_auto_place, 0, 0, ()=>(game.current), BASE ], - [ vm_place, 0, 1, ()=>(game.current), BASE ], + [ vm_space, true, 1, 1, (s)=>s === PANAMA ], + [ vm_auto_place, false, 0, ()=>(game.current), BASE ], + [ vm_place, false, 1, ()=>(game.current), BASE ], [ vm_endspace ], + [ vm_endif ], [ vm_return ], // EVENT 72 [ vm_prompt, "Replace all Cartels Guerrillas in 2 spaces with other Guerrillas." ], - [ vm_space, 1, 0, 2, (s)=>has_cartels_guerrilla(s) && ( can_replace_with(s, FARC, GUERRILLA) || can_replace_with(s, AUC, GUERRILLA) ) ], + [ vm_space, true, 2, 2, (s)=>has_cartels_guerrilla(s) && ( can_replace_with(s, FARC, GUERRILLA) || can_replace_with(s, AUC, GUERRILLA) ) ], [ vm_prompt, "Replace all Cartels Guerrillas with other Guerrillas." ], - [ vm_piece, 1, 0, 0, (p,s)=>is_piece_in_event_space(p) && is_cartels_guerrilla(p) && ( can_replace_with(s, FARC, GUERRILLA) || can_replace_with(s, AUC, GUERRILLA) ) ], + [ vm_piece, true, 999, 999, (p,s)=>is_piece_in_event_space(p) && is_cartels_guerrilla(p) && ( can_replace_with(s, FARC, GUERRILLA) || can_replace_with(s, AUC, GUERRILLA) ) ], [ vm_remove ], - [ vm_place, 0, 0, [FARC,AUC], GUERRILLA ], + [ vm_place, false, 0, FARC_AUC, GUERRILLA ], [ vm_endpiece ], [ vm_endspace ], [ vm_return ], @@ -8139,12 +8214,12 @@ const CODE = [ [ vm_while, ()=>has_piece(AVAILABLE, CARTELS, GUERRILLA) ], [ vm_prompt, "Place all available Cartels Guerrillas into spaces with Cartels Bases." ], [ vm_asm, ()=>game.vm.p = find_piece(AVAILABLE, CARTELS, GUERRILLA) ], - [ vm_space, 1, 0, 1, (s)=>has_cartels_base(s) ], - [ vm_auto_place, 0, 0, CARTELS, GUERRILLA ], + [ vm_space, true, 1, 1, (s)=>has_cartels_base(s) && can_stack_piece(s, CARTELS, GUERRILLA) ], + [ vm_auto_place, false, 0, CARTELS, GUERRILLA ], [ vm_endspace ], [ vm_endwhile ], [ vm_endif ], [ vm_return ], ] -const UCODE = [0,1,7,13,19,29,47,61,67,74,80,86,92,98,104,125,133,140,146,153,165,181,193,201,221,239,254,265,273,290,311,323,337,344,356,366,382,392,408,424,438,463,477,487,504,516,528,545,571,585,596,628,642,656,684,722,737,748,765,780,803,822,836,846,861,880,886,896,901,923,950,966,980] -const SCODE = [0,4,10,16,24,41,52,64,72,77,83,89,95,101,113,128,138,143,149,0,174,187,198,213,227,247,260,270,281,300,320,332,342,351,358,376,0,398,416,429,446,472,483,497,510,521,0,554,580,590,606,637,647,0,0,732,739,756,771,790,812,831,841,0,871,0,891,898,918,0,955,973,989] +const UCODE = [0,1,7,13,19,29,47,61,67,74,80,86,92,98,104,144,152,159,165,172,184,200,212,220,240,258,273,284,292,309,330,346,360,367,387,403,419,429,445,461,475,500,514,524,546,558,574,591,616,630,646,678,692,710,738,760,775,786,803,818,841,860,874,884,899,918,929,939,944,966,993,1009,1029] +const SCODE = [0,4,10,16,24,41,52,64,72,77,83,89,95,101,120,147,157,162,168,0,193,206,217,232,246,266,279,289,300,319,343,355,365,374,389,413,0,435,453,466,483,509,520,539,552,563,0,600,625,635,656,687,697,0,0,770,777,794,809,828,850,869,879,0,909,0,934,941,961,0,998,1016,1038] diff --git a/tools/gencode.js b/tools/gencode.js index 4f5f421..30f12c9 100644 --- a/tools/gencode.js +++ b/tools/gencode.js @@ -10,10 +10,14 @@ function emit(line) { ++pc line[0] = "vm_" + line[0] for (let i = 1; i < line.length; ++i) { - if (typeof line[i] === "string" && line[i][0] === "(" && !line[i].match(/\)=>/)) - line[i] = "()=>" + line[i] - if (typeof line[i] === "string" && line[i][0] === "`") - line[i] = "()=>" + line[i] + if (typeof line[i] === "string") { + if (line[i] === "all") + line[i] = 999 + if (line[i][0] === "(" && !line[i].match(/\)=>/)) + line[i] = "()=>" + line[i] + if (line[i][0] === "`") + line[i] = "()=>" + line[i] + } } console.log("\t[ " + line.join(", ") + " ],") } @@ -39,65 +43,44 @@ for (let line of fs.readFileSync("events.txt", "utf-8").split("\n")) { console.log("// SHADED " + line[1]) break - case "space_opt": - emit([ "space", 1, 1, line[1], "(s)=>" + line.slice(2).join(" ") ]) - break - case "space": - emit([ "space", 1, 0, line[1], "(s)=>" + line.slice(2).join(" ") ]) - break - case "space_no_undo_opt": - emit([ "space", 0, 1, line[1], "(s)=>" + line.slice(2).join(" ") ]) - break case "space_no_undo": - emit([ "space", 0, 0, line[1], "(s)=>" + line.slice(2).join(" ") ]) + emit([ "space", false, line[1], line[1], "(s)=>" + line.slice(2).join(" ") ]) break - case "space_undo_opt": - emit([ "space", 1, 1, line[1], "(s)=>" + line.slice(2).join(" ") ]) + case "space": + emit([ "space", true, line[1], line[1], "(s)=>" + line.slice(2).join(" ") ]) break - case "space_undo": - emit([ "space", 1, 0, line[1], "(s)=>" + line.slice(2).join(" ") ]) + case "space_opt": + emit([ "space", true, 0, line[1], "(s)=>" + line.slice(2).join(" ") ]) break - case "piece_opt": - emit([ "piece", 0, 1, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) - break case "piece": - emit([ "piece", 0, 0, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) + emit([ "piece", false, line[1], line[1], "(p,s)=>" + line.slice(2).join(" ") ]) break - case "piece_no_undo_opt": - emit([ "piece", 0, 1, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) + case "piece_undo": + emit([ "piece", true, line[1], line[1], "(p,s)=>" + line.slice(2).join(" ") ]) break - case "piece_no_undo": - emit([ "piece", 0, 0, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) + case "piece_opt": + emit([ "piece", false, 0, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) break case "piece_undo_opt": - emit([ "piece", 1, 1, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) - break - case "piece_undo": - emit([ "piece", 1, 0, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) + emit([ "piece", true, 0, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) break - case "shipment_opt": - emit([ "shipment", 0, 1, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) - break case "shipment": - emit([ "shipment", 0, 0, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) + emit([ "shipment", false, line[1], line[1], "(p,s)=>" + line.slice(2).join(" ") ]) break - - case "place_opt": - emit([ "place", 0, 1, line[1], line[2] ]) + case "shipment_opt": + emit([ "shipment", false, 0, line[1], "(p,s)=>" + line.slice(2).join(" ") ]) break + case "place": - emit([ "place", 0, 0, line[1], line[2] ]) + emit([ "place", false, 0, line[1], line[2] ]) break - case "place_undo_opt": - emit([ "place", 1, 1, line[1], line[2] ]) - break - case "place_undo": - emit([ "place", 1, 0, line[1], line[2] ]) + case "place_opt": + emit([ "place", false, 1, line[1], line[2] ]) break case "auto_place": - emit([ "auto_place", 0, 0, line[1], line[2] ]) + emit([ "auto_place", false, 0, line[1], line[2] ]) break case "log": -- cgit v1.2.3