diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-02-11 14:08:39 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-02-11 14:08:39 +0100 |
commit | dcc99c931b22873cfbcec3f7848be1b691e6e76c (patch) | |
tree | a064aa4ad20cedbebf9ba0ac64ef029e00e10b1d | |
parent | f82fd94601c14d60060b08eb213f7ac9c580f6c8 (diff) | |
download | plantagenet-dcc99c931b22873cfbcec3f7848be1b691e6e76c.tar.gz |
Fix Wales forbidden to enemy intercept.
-rw-r--r-- | rules.js | 36 |
1 files changed, 24 insertions, 12 deletions
@@ -6156,6 +6156,13 @@ function is_wales_forbidden(loc) { return false } +function is_wales_forbidden_to_enemy(loc) { + if (game.active !== LANCASTER && is_event_in_play(EVENT_YORK_OWAIN_GLYNDWR) && data.locales[loc].region === "Wales") + return true + return false +} + + function can_march_to(to) { if (is_wales_forbidden(to)) return false @@ -6307,21 +6314,26 @@ function end_march() { // === Interception === +function can_intercept_to(to) { + // TODO: forbid lancaster intercept into york moving to york, and vice versa + if (is_truce_in_effect()) + return false + if (is_wales_forbidden_to_enemy(to)) + return false + return true +} + function goto_intercept() { - if (!is_truce_in_effect()) { - let here = get_lord_locale(game.command) + let here = get_lord_locale(game.command) + if (can_intercept_to(here)) { for (let next of data.locales[here].not_paths) { - // TODO: forbid lancaster intercept into york moving to york, and vice versa if (has_enemy_lord(next)) { - // FIXME: wales forbidden _here_ rather than _next_ ??? - if (!is_wales_forbidden(next)) { - clear_undo() - game.state = "intercept" - set_active_enemy() - game.intercept_group = [] - game.who = NOBODY - return - } + clear_undo() + game.state = "intercept" + set_active_enemy() + game.intercept_group = [] + game.who = NOBODY + return } } } |