summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-04-20 12:46:14 +0200
committerTor Andersson <tor@ccxvii.net>2024-04-20 12:46:14 +0200
commitb26583409418c352f2691eab1d36e4b2d7f172c6 (patch)
treed140ef799ef35d1d25eeecfe2bd5976127668f0c
parent88587b9c247bcfe65b8653978a8fe25688fafd56 (diff)
downloadplantagenet-b26583409418c352f2691eab1d36e4b2d7f172c6.tar.gz
Choose exile when sailing into battle with the high admiral.
-rw-r--r--rules.ts40
1 files changed, 38 insertions, 2 deletions
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)