diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-12-17 20:22:36 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 13:02:38 +0100 |
commit | 8755434e50f4e34cc135b0e939894472d7b331a4 (patch) | |
tree | 1c27000e61d55b8b3523b6604c0e2f7534fa4bad | |
parent | 4406a730314dd97654b4545685b305a12a76d6fb (diff) | |
download | nevsky-8755434e50f4e34cc135b0e939894472d7b331a4.tar.gz |
Stone Kremlin.
-rw-r--r-- | play.js | 2 | ||||
-rw-r--r-- | rules.js | 35 |
2 files changed, 26 insertions, 11 deletions
@@ -1044,6 +1044,7 @@ function update_locale(loc) { ui.locale_markers[loc].appendChild(get_cached_element(cn)) } + // TODO: max 2 castles - reuse elements if (set_has(view.locales.castles1, loc)) { let cn = "marker rectangle castle teutonic" ui.locale_markers[loc].appendChild(get_cached_element(cn)) @@ -1054,6 +1055,7 @@ function update_locale(loc) { ui.locale_markers[loc].appendChild(get_cached_element(cn)) } + // TODO: max 4 walls - reuse elements if (set_has(view.locales.walls, loc)) { let cn = "marker square walls" ui.locale_markers[loc].appendChild(get_cached_element(cn)) @@ -3821,27 +3821,40 @@ function goto_stone_kremlin() { log("Stone Kremlin.") - if (count_walls() > 0) + if (count_walls() > 0) { game.state = "stone_kremlin" - else + game.count = 1 + } else { end_stone_kremlin() + } } states.stone_kremlin = { prompt() { - if (count_walls() === 4) { - view.prompt = `Stone Kremlin: You must remove one Walls marker.` + let here = get_lord_locale(game.command) + if (game.count > 0) { + if (count_walls() === 4) { + view.prompt = `Stone Kremlin: Move one Walls marker.` + } else { + view.prompt = `Stone Kremlin: Place or move Walls.` + gen_action_locale(here) + } + for (let loc of game.locales.walls) + gen_action_locale(loc) } else { - view.prompt = `Stone Kremlin: You may remove one Walls marker.` - view.actions.pass = 1 + view.prompt = `Stone Kremlin: Place Walls.` + gen_action_locale(here) } - for (let wall of game.locales.walls) - gen_action_locale(wall) }, locale(loc) { - log(`Removed Walls at %${loc}.`) - remove_walls(loc) - end_stone_kremlin() + let here = get_lord_locale(game.command) + if (loc !== here) { + log(`Removed Walls at %${loc}.`) + remove_walls(loc) + game.count = 0 + } else { + end_stone_kremlin() + } }, pass() { end_stone_kremlin() |