From 71e9b55381f573a19919e89f1dcf444551401ed3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 9 Jan 2022 16:10:26 +0100 Subject: Manually reduce blocks during plague event. --- rules.js | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/rules.js b/rules.js index 84b8e17..2ba78e6 100644 --- a/rules.js +++ b/rules.js @@ -1531,17 +1531,38 @@ states.plague_event = { }, area: function (where) { log("Plague ravages " + has_city(where) + "!"); - for (let b in BLOCKS) { + game.where = where; + game.plague = []; + for (let b in BLOCKS) if (game.location[b] === where) - reduce_block(b); - } - end_player_turn(); + game.plague.push(b); + game.active = game.p2; + game.state = 'apply_plague'; }, pass: function () { end_player_turn(); } } +states.apply_plague = { + prompt: function (view, current) { + if (is_inactive_player(current)) + return view.prompt = "Plague: Waiting for " + game.active + " to reduce blocks in " + has_city(game.where) + "."; + view.prompt = "Plague: Reduce blocks in " + has_city(game.where) + "."; + for (let b of game.plague) + gen_action(view, 'block', b); + }, + block: function (b) { + reduce_block(b); + remove_from_array(game.plague, b); + if (game.plague.length === 0) { + delete game.plague; + game.active = game.p1; + end_player_turn(); + } + }, +} + function goto_muster_event() { game.state = 'muster_event'; game.turn_log = []; -- cgit v1.2.3