From 4a374a395750dd97f375871d72764b4c5a74b784 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 24 Mar 2023 22:39:03 +0100 Subject: Automatic Sabotage. --- rules.js | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/rules.js b/rules.js index aa2d3bf..9db7d6e 100644 --- a/rules.js +++ b/rules.js @@ -4772,10 +4772,17 @@ function goto_final_victory() { function goto_sabotage_phase() { game.prop.step = 2 game.current = GOVT - if (can_sabotage_phase()) - game.state = "sabotage" - else - goto_resources_phase() + + log_h2("Sabotage Phase") + + for (let s = first_loc; s <= last_loc; ++s) { + if (can_sabotage_phase_space(s)) { + log("Sabotaged S" + s + ".") + place_sabotage(s) + } + } + + goto_resources_phase() } function is_adjacent_to_city_farc_control(s) { @@ -4796,26 +4803,6 @@ function can_sabotage_phase_space(s) { return false } -function can_sabotage_phase() { - for (let s = first_loc; s <= last_loc; ++s) - if (can_sabotage_phase_space(s)) - return true -} - -states.sabotage = { - prompt() { - view.prompt = "Sabotage LoCs." - for (let s = first_loc; s <= last_loc; ++s) - if (can_sabotage_phase_space(s)) - gen_action_space(s) - }, - space(s) { - place_sabotage(s) - if (!can_sabotage_phase()) - goto_resources_phase() - }, -} - // PROPAGANDA: RESOURCES PHASE function calc_govt_earnings() { -- cgit v1.2.3