From a20f825cb1c99c2622cb09923106b0e43970fcf6 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Wed, 14 Feb 2024 14:43:50 +0100 Subject: assert all lords without routed troops during levy phase --- rules.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index a5daedd..7cdf519 100644 --- a/rules.js +++ b/rules.js @@ -11893,14 +11893,24 @@ function assertAllLordsOnLand() { } } +function assertAllLordsWithoutRoutedTroops() { + for (let lord = first_york_lord; lord <= last_lancaster_lord; ++lord) { + if (lord_has_routed_troops(lord)) + throw Error(`ASSERT: Lord "${data.lords[lord].name}" has routed troops during Levy phase.`) + } +} + exports.assertState = function (state) { load_state(state) // assertMutuallyExclusiveLords() if (game.state !== "battle_losses" && game.state !== "death_or_disband") assertAllLordsHaveTroopsOrRetinue() - if (is_levy_phase()) + + if (is_levy_phase()) { assertAllLordsOnLand() + assertAllLordsWithoutRoutedTroops() + } } let log_sanity = [] -- cgit v1.2.3