From 44a474bd5bd9f6fd5b6362a0e97cb462901252af Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 23 May 2024 21:39:26 +0200 Subject: use common levy troops code for both commission of array and other levy --- rules.js | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 963f758..e451346 100644 --- a/rules.js +++ b/rules.js @@ -2716,7 +2716,9 @@ function chamberlains_eligible_levy(loc) { return false; } function do_levy_troops() { - let here = get_lord_locale(game.command); + do_levy_troops_from(get_lord_locale(game.command)); +} +function do_levy_troops_from(here) { if (lord_has_capability(game.command, AOW_YORK_WOODVILLES)) logcap(AOW_YORK_WOODVILLES); else if (lord_has_capability(game.command, AOW_LANCASTER_QUARTERMASTERS)) @@ -9403,35 +9405,7 @@ states.commission_of_array = { } }, locale(loc) { - let loc_type = data.locales[loc].type; - deplete_locale(loc); - switch (loc_type) { - case "calais": - add_lord_forces(game.command, MEN_AT_ARMS, 2); - add_lord_forces(game.command, LONGBOWMEN, 1); - break; - case "london": - add_lord_forces(game.command, MEN_AT_ARMS, 1); - add_lord_forces(game.command, LONGBOWMEN, 1); - add_lord_forces(game.command, MILITIA, 1); - break; - case "harlech": - add_lord_forces(game.command, MEN_AT_ARMS, 1); - add_lord_forces(game.command, LONGBOWMEN, 2); - break; - case "city": - add_lord_forces(game.command, LONGBOWMEN, 1); - add_lord_forces(game.command, MILITIA, 1); - break; - case "town": - add_lord_forces(game.command, MILITIA, 2); - break; - case "fortress": - add_lord_forces(game.command, MEN_AT_ARMS, 1); - add_lord_forces(game.command, MILITIA, 1); - break; - } - end_levy_troops(); + do_levy_troops_from(loc); }, }; // === TIDES OF WAR CAPABILITY: WE DONE DEEDS OF CHARITY === -- cgit v1.2.3