From f3fb308eeb4fa57d0e5d00000b51e2ff0081a196 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 24 Sep 2023 14:12:01 +0200 Subject: The Deluge! --- play.js | 2 +- rules.js | 41 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/play.js b/play.js index f990c91..40c7920 100644 --- a/play.js +++ b/play.js @@ -404,7 +404,7 @@ function on_update() { } ui.turn.style.left = (40 + TURN_X + (view.turn-1) * TURN_DX) + "px" - ui.turn.classList.toggle("flip", view.rain > 0) + ui.turn.classList.toggle("flip", view.rain === 2) ui.remain.style.left = (20 + 109 + (view.remain % 10) * 47.5 | 0) + "px" ui.remain.classList.toggle("flip", view.remain > 9) diff --git a/rules.js b/rules.js index 2417b2e..b14549b 100644 --- a/rules.js +++ b/rules.js @@ -5,7 +5,6 @@ // TODO: inactive prompts // TODO: prompts - Done when no more to do -// TODO: rain effect on movement // TODO: forbidden - enemy or enemy zoc on entry or adjacent hex special case retreat/recall // TODO: june 15 special rules @@ -436,6 +435,34 @@ function update_zoc() { function goto_command_phase() { log(".h1 Turn " + game.turn) + + if (game.rain > 0) + game.rain-- + + if (game.turn === 1) { + log("Surprise!") + log("Road Congestion.") + } + + if (game.turn === 2) { + log("Delayed Reaction.") + log("Concentrating the Army.") + log("Road Congestion.") + } + + if (game.turn === 5 || game.turn === 6) { + let die = roll_die() + if (die <= 4) { + log("The Deluge:\nD" + die + " \u2013 Rain.") + game.rain = 2 + } else { + log("The Deluge:\nD" + die + " \u2013 No effect.") + } + } + + if (game.rain > 0) + log("Artillery Ricochet Ineffective.") + log(".h2 Command") bring_on_reinforcements() goto_hq_placement_step() @@ -1262,6 +1289,12 @@ function must_stop_zoc_zoi(here, next, is_cav) { return false } +function must_stop_deluge(here, next) { + if (game.rain === 2 && !is_road_hexside(here, next)) + return true + return false +} + function must_stop_stream(here, next) { if (is_stream_hex(next) && !is_road_hexside(here, next)) return true @@ -1426,7 +1459,9 @@ function search_move_normal(start, ma, hq_hex, hq_range, is_cav) { return let next_mp = mp - 1 - if (must_stop_stream(here, next)) + if (must_stop_deluge(here, next)) + next_mp = -1 + else if (must_stop_stream(here, next)) next_mp = -1 else if (must_flip_zoc(here, next, is_cav)) next_mp = -1 @@ -1784,7 +1819,7 @@ function goto_resolve_attack() { log("Attacker P" + a_unit) - if (game.rain) + if (game.rain > 0) a_drm += log_drm(-1, "Artillery Ricochet Ineffective") // Unless Cav charging into town -- cgit v1.2.3