summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-23 21:39:26 +0200
committerTor Andersson <tor@ccxvii.net>2024-05-23 21:39:26 +0200
commit44a474bd5bd9f6fd5b6362a0e97cb462901252af (patch)
tree2ca14337e527200e4fb19114aeef04f0731fde3a
parent5a431ab673874228584089fc3e40b38c8b3c883c (diff)
downloadplantagenet-44a474bd5bd9f6fd5b6362a0e97cb462901252af.tar.gz
use common levy troops code for both commission of array and other levy
-rw-r--r--rules.js34
-rw-r--r--rules.ts36
2 files changed, 8 insertions, 62 deletions
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 ===
diff --git a/rules.ts b/rules.ts
index 69d81ef..0473b25 100644
--- a/rules.ts
+++ b/rules.ts
@@ -3346,8 +3346,10 @@ function chamberlains_eligible_levy(loc: Locale) {
}
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: Locale) {
if (lord_has_capability(game.command, AOW_YORK_WOODVILLES))
logcap(AOW_YORK_WOODVILLES)
else if (lord_has_capability(game.command, AOW_LANCASTER_QUARTERMASTERS))
@@ -10922,37 +10924,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)
},
}