From 152da57135e508527a0bd24ce56347af84be0f94 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 9 Mar 2023 19:17:11 +0100 Subject: Insurgent Momentum. --- play.css | 1 + play.html | 1 + play.js | 9 +++++++ rules.js | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++------------ 4 files changed, 79 insertions(+), 15 deletions(-) diff --git a/play.css b/play.css index 2f41c08..be8588e 100644 --- a/play.css +++ b/play.css @@ -162,6 +162,7 @@ path.selected { stroke: yellow; } background-size: 36px 36px; width: 36px; height: 36px; + margin: 4px 5px 5px 4px; } .token.shipment diff --git a/play.html b/play.html index c9735a2..a45b7b7 100644 --- a/play.html +++ b/play.html @@ -167,6 +167,7 @@
+
diff --git a/play.js b/play.js index 5685063..00ac551 100644 --- a/play.js +++ b/play.js @@ -63,6 +63,13 @@ const MOM_MISIL_ANTIAEREO = 27 const MOM_SENADO_CAMARA = 42 const MOM_MEXICAN_TRAFFICKERS = 67 +const senado_class_list = [ + "token reminder hide", + "token reminder senado_farc", + "token reminder senado_auc", + "token reminder senado_cartels", +] + let ui = { favicon: document.getElementById("favicon"), header: document.querySelector("header"), @@ -117,6 +124,7 @@ let ui = { oppose_plus_bases: document.getElementById("token_oppose_plus_bases"), president: document.getElementById("token_el_presidente"), propaganda: document.getElementById("token_prop_card"), + senado: document.getElementById("rem_senado"), }, pieces: [], resources: [ @@ -717,6 +725,7 @@ function on_update() { ui.player[AUC_CARTELS].classList.toggle("active", view.current === AUC || view.current === CARTELS) ui.tokens.president.style.left = [ 0, "254px", "337px", "420px" ][view.president] + ui.tokens.senado.classList = senado_class_list[view.senado] for (let cap of capability_events) { let shaded = set_has(view.capabilities, -cap) diff --git a/rules.js b/rules.js index 2a9f2a4..f144449 100644 --- a/rules.js +++ b/rules.js @@ -26,6 +26,8 @@ const capability_events = [ 1, 2, 3, 7, 9, 10, 11, 13 ] const momentum_events = [ 12, 17, 22, 27, 42, 67 ] // TODO: 7th SF - sabotage phase +// TODO: Alfonso Cane - agitation phase +// TODO: Mexican Traffickres - resources phase const CAP_1ST_DIV = 1 const CAP_OSPINA = 2 @@ -248,6 +250,7 @@ exports.setup = function (seed, scenario, options) { deck: [], president: 0, + senado: 0, aid: 0, cylinder: [ ELIGIBLE, ELIGIBLE, ELIGIBLE, ELIGIBLE ], resources: [ 0, 0, 0, 0 ], @@ -1563,6 +1566,13 @@ states.patrol = { function goto_patrol_activate() { push_undo() + + if (has_momentum(MOM_PLAN_COLOMBIA)) { + log("No Activation by Patrol.") + goto_patrol_assault() + return + } + game.state = "patrol_activate" game.op.count = [] for (let s = first_loc; s <= last_loc; ++s) @@ -1713,6 +1723,10 @@ states.patrol_done = { function can_sweep_move(here) { if (has_piece(here, GOVT, TROOPS) || has_piece(here, GOVT, POLICE)) return true + + if (is_dept(here) && has_momentum(MOM_MADRID_DONORS)) + return false + let ndsc = has_capability(CAP_NDSC) for (let next of data.spaces[here].adjacent) { if (has_piece(next, GOVT, TROOPS)) @@ -1824,9 +1838,20 @@ states.sweep_move = { if (is_forest(game.op.where)) game.op.count >>= 1 + + if (game.op.count === 0 || !can_sweep_activate(game.op.where)) + game.state = "sweep" }, } +function can_sweep_activate(s) { + return ( + (game.senado !== FARC && has_underground_guerrilla(s, FARC)) || + (game.senado !== AUC && has_underground_guerrilla(s, AUC)) || + (game.senado !== CARTELS && has_underground_guerrilla(s, CARTELS)) + ) +} + states.sweep_activate = { prompt() { view.prompt = `Sweep: Activate ${game.op.count} Guerrillas in ${space_name[game.op.where]}.` @@ -1834,9 +1859,12 @@ states.sweep_activate = { gen_any_govt_special() - gen_underground_guerrillas(game.op.where, FARC) - gen_underground_guerrillas(game.op.where, AUC) - gen_underground_guerrillas(game.op.where, CARTELS) + if (game.senado !== FARC) + gen_underground_guerrillas(game.op.where, FARC) + if (game.senado !== AUC) + gen_underground_guerrillas(game.op.where, AUC) + if (game.senado !== CARTELS) + gen_underground_guerrillas(game.op.where, CARTELS) if (did_maximum_damage(game.op.targeted)) view.actions.next = 1 @@ -1847,7 +1875,7 @@ states.sweep_activate = { push_undo() game.op.targeted |= target_faction(p) set_active(p) - if (--game.op.count === 0 || !has_any_underground_guerrilla(game.op.where)) + if (--game.op.count === 0 || !can_sweep_activate(game.op.where)) game.state = "sweep" }, next() { @@ -1859,7 +1887,11 @@ states.sweep_activate = { // OPERATION: ASSAULT function can_assault_space(s) { + if (is_dept(s) && has_momentum(MOM_MADRID_DONORS)) + return false for (let faction = 1; faction < 4; ++faction) { + if (game.senado === faction) + continue if (has_piece(s, faction, GUERRILLA)) { if (has_active_guerrilla(s, faction)) return true @@ -1937,9 +1969,12 @@ states.assault_space = { gen_any_govt_special() - gen_exposed_piece(game.op.where, FARC) - gen_exposed_piece(game.op.where, AUC) - gen_exposed_piece(game.op.where, CARTELS) + if (game.senado !== FARC) + gen_exposed_piece(game.op.where, FARC) + if (game.senado !== AUC) + gen_exposed_piece(game.op.where, AUC) + if (game.senado !== CARTELS) + gen_exposed_piece(game.op.where, CARTELS) if (did_maximum_damage(game.op.targeted)) view.actions.next = 1 @@ -2532,8 +2567,11 @@ function gen_special(faction, action, disable = false) { function gen_any_govt_special() { if (game.sa) { view.actions.air_lift = 1 - view.actions.air_strike = 1 view.actions.eradicate = 1 + if (has_momentum(MOM_PLAN_COLOMBIA)) + view.actions.air_strike = 0 + else + view.actions.air_strike = 1 } } @@ -2565,9 +2603,11 @@ function goto_air_lift() { states.air_lift_from = { prompt() { view.prompt = "Air Lift: Select origin space." + let manpad = has_momentum(MOM_MISIL_ANTIAEREO) for (let s = first_space; s <= last_space; ++s) if (has_piece(s, GOVT, TROOPS)) - gen_action_space(s) + if (!manpad || !has_any_guerrilla(s)) + gen_action_space(s) }, space(s) { push_undo() @@ -2580,9 +2620,11 @@ states.air_lift_to = { prompt() { view.prompt = "Air Lift: Select destination space." view.where = game.sa.from + let manpad = has_momentum(MOM_MISIL_ANTIAEREO) for (let s = first_space; s <= last_space; ++s) - if (s !== game.sa.from && !is_farc_zone(s)) // TODO: Foreign? - gen_action_space(s) + if (s !== game.sa.from && !is_farc_zone(s)) + if (!manpad || !has_any_guerrilla(s)) + gen_action_space(s) }, space(s) { push_undo() @@ -2624,10 +2666,13 @@ function goto_air_strike() { states.air_strike = { prompt() { view.prompt = "Air Strike: Destroy exposed Insurgent unit." + let manpad = has_momentum(MOM_MISIL_ANTIAEREO) for (let s = first_space; s <= last_space; ++s) { - gen_exposed_piece(s, FARC) - gen_exposed_piece(s, AUC) - gen_exposed_piece(s, CARTELS) + if (!manpad || !has_any_guerrilla(s)) { + gen_exposed_piece(s, FARC) + gen_exposed_piece(s, AUC) + gen_exposed_piece(s, CARTELS) + } } }, piece(p) { @@ -2655,9 +2700,11 @@ function goto_eradicate() { states.eradicate = { prompt() { view.prompt = "Eradicate: Destroy rural Cartels Bases." + let manpad = has_momentum(MOM_MISIL_ANTIAEREO) for (let s = first_dept; s <= last_dept; ++s) if (has_piece(s, CARTELS, GUERRILLA) || has_piece(s, CARTELS, BASE)) - gen_action_space(s) + if (!manpad || !has_any_guerrilla(s)) + gen_action_space(s) }, space(s) { push_undo() @@ -3440,6 +3487,7 @@ exports.view = function (state, role) { current: game.current, deck: [ this_card, next_card, deck_size ], president: game.president, + senado: game.senado, aid: game.aid, cylinder: game.cylinder, resources: game.resources, @@ -3572,6 +3620,11 @@ function execute_shaded_event() { let c = this_card() log(`C${c} - Shaded`) + if (c === MOM_SENADO_CAMARA) { + log("No Sweep or Assault against " + faction_name[game.current] + " until next Propaganda.") + game.senado = game.current + } + if (set_has(capability_events, c)) { logi(event_name_shaded[c]) set_add(game.capabilities, -c) -- cgit v1.2.3