diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-12-21 17:14:34 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 13:02:38 +0100 |
commit | 6f3c4bdb9d983e7ad4f2a1ef89eb0dfee9d608e1 (patch) | |
tree | 78384c3bd488b6822dfc9ecaec4c81e3d17a608c | |
parent | bbfd640bf2b82ab390261fcc5d525454dff67cfe (diff) | |
download | nevsky-6f3c4bdb9d983e7ad4f2a1ef89eb0dfee9d608e1.tar.gz |
Don't manually click to build siegeworks.
-rw-r--r-- | play.js | 4 | ||||
-rw-r--r-- | rules.js | 43 |
2 files changed, 18 insertions, 29 deletions
@@ -940,7 +940,9 @@ function update_lord_mat(ix) { } function is_lord_mat_selected(ix) { - return ix === view.who + if (view.who >= 0) + return ix === view.who + return ix === view.command } function is_cylinder_selected(ix) { @@ -13,9 +13,9 @@ // TODO: show besieged lords differently in UI // TODO: mark moved/fought units (blue highlight?) -// CAPABILITIES -// TODO: Spoils -// TODO: BATTLE + STORM + SALLY +// TODO: BATTLE +// TODO: SALLY +// TODO: STORM // TODO: remove push_state/pop_state stuff - use explicit substates with common functions instead @@ -3849,7 +3849,7 @@ function count_besieging_lords(loc) { return count_friendly_lords_at(loc) } -function can_siegeworks() { +function can_build_siegeworks() { let here = get_lord_locale(game.command) if (count_besieging_lords(here) >= stronghold_strength(here)) if (count_siege_markers(here) < 4) @@ -3878,7 +3878,7 @@ function goto_surrender() { if (count_besieged_lords(here) === 0) game.state = "surrender" else - goto_siegeworks() + build_siegeworks() } function surrender_stronghold(here) { @@ -3906,12 +3906,13 @@ states.surrender = { prompt() { view.prompt = "Siege: You may roll for Surrender." view.actions.surrender = 1 - if (can_siegeworks()) + if (can_build_siegeworks()) view.actions.siegeworks = 1 else view.actions.pass = 1 }, surrender() { + clear_undo() let here = get_lord_locale(game.command) let die = roll_die() let n = count_siege_markers(here) @@ -3921,38 +3922,24 @@ states.surrender = { end_siege() } else { log(`Surrender ${die} > ${n} failed.`) - goto_siegeworks() + build_siegeworks() } }, siegeworks() { - log("Declined Surrender.") - goto_siegeworks() + build_siegeworks() }, pass() { - log("Declined Surrender.") - goto_siegeworks() - }, -} - -function goto_siegeworks() { - // TODO: automatic or manual placement? - if (can_siegeworks()) - game.state = "siegeworks" - else end_siege() + }, } -states.siegeworks = { - prompt() { - view.prompt = "Siege: Siegeworks - add one siege marker." - let here = get_lord_locale(game.command) - gen_action_locale(here) - }, - locale(here) { +function build_siegeworks() { + if (can_build_siegeworks()) { log("Added Siege marker.") + let here = get_lord_locale(game.command) add_siege_marker(here) - end_siege() - }, + } + end_siege() } function end_siege() { |