summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-04-19 17:27:21 +0200
committerTor Andersson <tor@ccxvii.net>2024-04-19 17:27:21 +0200
commit7a1977d97834a0ecd6184193aff17f9fde6e5a05 (patch)
tree8df8d873efbe3f3db3f74da7a267d4ee996b6312
parentc66979d1fb88b250a4d17976ff5706669117ad8f (diff)
downloadplantagenet-7a1977d97834a0ecd6184193aff17f9fde6e5a05.tar.gz
Feed doesn't need push_state. Feed both sides that fought!
-rw-r--r--rules.ts33
1 files changed, 23 insertions, 10 deletions
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() {