From 7a1977d97834a0ecd6184193aff17f9fde6e5a05 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 19 Apr 2024 17:27:21 +0200 Subject: Feed doesn't need push_state. Feed both sides that fought! --- rules.ts | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'rules.ts') diff --git a/rules.ts b/rules.ts index 978b1c9..6420b95 100644 --- a/rules.ts +++ b/rules.ts @@ -1014,6 +1014,14 @@ function set_active_command() { set_active(LANCASTER) } +function is_active_command() { + if (is_york_lord(game.command)) + return game.active === YORK + else + return game.active === LANCASTER +} + + // === STATE: TURN === function current_turn() { @@ -7591,11 +7599,23 @@ function goto_feed() { log_br() set_lord_feed_requirements() if (has_friendly_lord_who_must_feed()) { - push_state("feed") + game.state = "feed" } else { - // TODO: clean up transitions for End Command -> Feed and Disembark -> Feed - if (game.state !== "disembark") + end_feed() + } +} + +function end_feed() { + if (game.command !== NOBODY) { + // during campaign + set_active_enemy() + if (is_active_command()) goto_remove_markers() + else + goto_feed() + } else { + // during disembark + game.state = "disembark" } } @@ -7693,13 +7713,6 @@ states.feed_lord_shared = { }, } -function end_feed() { - pop_state() - // TODO: clean up transitions for End Command -> Feed and Disembark -> Feed - if (game.state !== "disembark") - goto_remove_markers() -} - // === 4.7 FEED: REMOVE MARKERS === function goto_remove_markers() { -- cgit v1.2.3