diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-12-21 17:35:24 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 13:02:38 +0100 |
commit | a5977fb9406897fda606694c9497565df82c4f8e (patch) | |
tree | a24d77f8f00ed8f73b4ee6920c6837f224414fea | |
parent | 6f3c4bdb9d983e7ad4f2a1ef89eb0dfee9d608e1 (diff) | |
download | nevsky-a5977fb9406897fda606694c9497565df82c4f8e.tar.gz |
2nd ed Ravage action cost.
-rw-r--r-- | rules.js | 32 |
1 files changed, 24 insertions, 8 deletions
@@ -4211,6 +4211,13 @@ function goto_forage() { // === ACTION: RAVAGE === +function has_adjacent_unbesieged_enemy_lord(loc) { + for (let next of data.locales[loc].adjacent) + if (has_unbesieged_enemy_lord(next)) + return true + return false +} + function has_not_used_teutonic_raiders() { return !game.flags.teutonic_raiders } @@ -4231,16 +4238,22 @@ function this_lord_has_russian_raiders() { } function can_ravage_locale(loc) { - return ( - is_enemy_territory(loc) && - !has_conquered_marker(loc) && - !has_ravaged_marker(loc) && - !is_friendly_locale(loc) // XXX same as no-enemy-lords/no friendly castle? - ) + // TODO: cost 2 if enemy lord is adjacent (2nd ed) + if (!is_enemy_territory(loc)) + return false + if (has_conquered_marker(loc)) + return false + if (has_ravaged_marker(loc)) + return false + if (is_friendly_locale(loc)) // faster check? + return false + if (has_adjacent_unbesieged_enemy_lord(loc)) + return game.actions >= 2 + else + return game.actions >= 1 } function can_action_ravage() { - // TODO: cost 2 if enemy lord is adjacent (2nd ed) if (game.actions < 1) return false @@ -4318,7 +4331,10 @@ function ravage_location(here, there) { add_lord_assets(game.command, LOOT, 1) } - spend_action(1) + if (has_adjacent_unbesieged_enemy_lord(there)) + spend_action(2) + else + spend_action(1) resume_actions() } |