summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2024-02-14 14:34:08 +0100
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2024-02-14 14:34:08 +0100
commit63bdb2f68c49282845002523e4c58658ae50d680 (patch)
tree63dd3532a716cf74d0b8ec026316ea99e25a033a /rules.js
parent21768f8c7d77628e1cce7c5275e40ead39aaf685 (diff)
downloadplantagenet-63bdb2f68c49282845002523e4c58658ae50d680.tar.gz
assert all lords have troops or retinue outside of battle_losses and death_or_disband states
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index d2876e3..eeb1cf2 100644
--- a/rules.js
+++ b/rules.js
@@ -11879,10 +11879,19 @@ function assertMutuallyExclusiveLords() {
}
}
+function assertAllLordsHaveTroopsOrRetinue() {
+ for (let lord = first_york_lord; lord <= last_lancaster_lord; ++lord) {
+ if (is_lord_on_map(lord) && !count_lord_all_forces(lord) && !get_lord_forces(lord, RETINUE))
+ throw Error(`ASSERT: Lord "${data.lords[lord].name}" without troops or retinue`)
+ }
+}
+
exports.assertState = function (state) {
load_state(state)
- assertMutuallyExclusiveLords()
+ // assertMutuallyExclusiveLords()
+ if (game.state !== "battle_losses" && game.state !== "death_or_disband")
+ assertAllLordsHaveTroopsOrRetinue()
}
let log_sanity = []