diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-02-11 00:37:37 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-02-11 00:49:01 +0100 |
commit | 66ab66382df82246789b39072e0c0949e3e0f917 (patch) | |
tree | 23f254035f4262fca61314e3e41adb1f723e9677 /rules.js | |
parent | 4f2dfe5f6d69499f9224d52e65b6f5b4dcba466a (diff) | |
download | plantagenet-66ab66382df82246789b39072e0c0949e3e0f917.tar.gz |
Put KP/PT code after interception code, before exile code.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 126 |
1 files changed, 77 insertions, 49 deletions
@@ -6307,7 +6307,7 @@ function march_with_group_2() { for (let lord of game.group) { set_lord_locale(lord, to) - // Note: We flag the lords moved and levy burgundians after king's parley has resolved. + // Note: We flag the lords moved and levy burgundians after king's parley and parliament's truce have resolved. // See end_kings_parley. } @@ -6332,6 +6332,7 @@ function end_march() { function goto_intercept() { let here = get_lord_locale(game.command) 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)) { if (!is_wales_forbidden(next)) { clear_undo() @@ -6352,54 +6353,6 @@ function end_intercept() { goto_kings_parley() } -function goto_kings_parley() { - // If Henry VI in space, with King's Parley capability - if (game.active === YORK) { - if (get_lord_locale(LORD_HENRY_VI) === game.march.to) { - if (lord_has_capability(LORD_HENRY_VI, AOW_LANCASTER_KINGS_PARLEY)) { - set_active_enemy() - game.state = "kings_parley" - return - } - } - } - end_kings_parley() -} - -states.kings_parley = { - inactive: "King's Parley?", - prompt() { - view.prompt = "You may discard King's Parley to cancel Yorkist approach." - gen_action_card(AOW_LANCASTER_KINGS_PARLEY) - view.actions.pass = 1 - }, - card(c) { - push_undo() - discard_lord_capability(LORD_HENRY_VI, AOW_LANCASTER_KINGS_PARLEY) - - // Cancel approach! - for (let lord of game.group) - set_lord_locale(lord, game.march.from) - - set_active_enemy() - end_march() - }, - pass() { - set_active_enemy() - end_kings_parley() - }, -} - -function end_kings_parley() { - // Note: we flag the lords moved and levy burgundians after king's parley has resolved - for (let lord of game.group) { - set_lord_moved(lord, 1) - levy_burgundians(lord) - } - - goto_exiles() -} - states.intercept = { inactive: "Intercept", prompt() { @@ -6521,6 +6474,81 @@ function for_each_friendly_lord_in_locale(loc, f) { f(lord) } +// === King's Parley / Parliament's Truce -- cancel Approach === + +// TODO: merge states into one question + +function goto_kings_parley() { + // If Henry VI in space, with King's Parley capability + // TODO: ... unless he intercepted York lords already present ? + // TODO: ... or remove possibility for above case. + if (game.active === YORK) { + if (get_lord_locale(LORD_HENRY_VI) === game.march.to) { + if (lord_has_capability(LORD_HENRY_VI, AOW_LANCASTER_KINGS_PARLEY)) { + set_active_enemy() + game.state = "kings_parley" + return + } + } + } + end_kings_parley() +} + +states.kings_parley = { + inactive: "King's Parley?", + prompt() { + view.prompt = "You may discard King's Parley to cancel Yorkist approach." + gen_action_card(AOW_LANCASTER_KINGS_PARLEY) + view.actions.pass = 1 + }, + card(c) { + push_undo() + discard_lord_capability(LORD_HENRY_VI, AOW_LANCASTER_KINGS_PARLEY) + + // Cancel approach! + for (let lord of game.group) + set_lord_locale(lord, game.march.from) + + set_active_enemy() + end_march() + }, + pass() { + set_active_enemy() + end_kings_parley() + }, +} + +function end_kings_parley() { + goto_parliaments_truce() +} + +function goto_parliaments_truce() { + + // The non-active player can cancel approach with parliament's truce + + // We don't allow the active player to cancel an intercept -- if they want to cancel + // an interception, they should have played the event before marching. + + end_parliaments_truce() +} + +function end_parliaments_truce() { + + // Note: we flag the lords moved and levy burgundians after king's parley and parliament's truce have resolved + for (let lord of game.group) { + set_lord_moved(lord, 1) + levy_burgundians(lord) + } + + goto_blocked_ford() +} + +function goto_blocked_ford() { + // The marching lord can now play blocked ford to prevent going into exile. + + goto_exiles() +} + // === Exile === function goto_exiles() { |