From b26583409418c352f2691eab1d36e4b2d7f172c6 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 20 Apr 2024 12:46:14 +0200 Subject: Choose exile when sailing into battle with the high admiral. --- rules.ts | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'rules.ts') diff --git a/rules.ts b/rules.ts index df39bd0..7c9a933 100644 --- a/rules.ts +++ b/rules.ts @@ -4100,8 +4100,7 @@ states.confirm_approach_sail = { view.actions.approach = 1 }, approach() { - push_undo() - goto_battle() + goto_choose_exile_from_sail() }, } @@ -5116,6 +5115,12 @@ function goto_choose_exile() { } } +function goto_choose_exile_from_sail() { + spend_all_actions() // end command upon any approach + game.state = "choose_exile_from_sail" + set_active_enemy() +} + function end_choose_exile() { if (has_friendly_lord(get_lord_locale(game.command))) { // still some lords not exiled to fight. @@ -5128,6 +5133,18 @@ function end_choose_exile() { } } +function end_choose_exile_from_sail() { + if (has_friendly_lord(get_lord_locale(game.command))) { + // still some lords not exiled to fight. + set_active_enemy() + goto_battle() + } else { + // no one left, goto finish sailing. + set_active_enemy() + resume_command() + } +} + states.choose_exile = { inactive: "Exiles", prompt() { @@ -5147,6 +5164,25 @@ states.choose_exile = { }, } +states.choose_exile_from_sail = { + inactive: "Exiles", + prompt() { + view.prompt = "Select Lords to go into Exile." + for_each_friendly_lord_in_locale(get_lord_locale(game.command), lord => { + gen_action_lord(lord) + }) + view.actions.done = 1 + }, + lord(lord) { + push_undo() + // TODO: give up assets as if spoils? + exile_lord(lord) + }, + done() { + end_choose_exile_from_sail() + }, +} + function exile_lord(lord: Lord) { if (lord_has_capability(lord, AOW_YORK_ENGLAND_IS_MY_HOME)) { disband_lord(lord, false) -- cgit v1.2.3