summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-04-20 14:57:56 +0200
committerTor Andersson <tor@ccxvii.net>2024-04-20 14:57:56 +0200
commit16e1d1cd86c2d87ce59091756eed50db62d3f5c3 (patch)
treed038d903d02b6ddebacc64714f7917c9f700bcde
parente7520ade6d68744932b1edfb4d5e610b4e9c6d15 (diff)
downloadplantagenet-16e1d1cd86c2d87ce59091756eed50db62d3f5c3.tar.gz
Disband lords that end up without troops in Welsh Rebellion.
-rw-r--r--rules.ts25
1 files changed, 15 insertions, 10 deletions
diff --git a/rules.ts b/rules.ts
index 00203a0..f4a25af 100644
--- a/rules.ts
+++ b/rules.ts
@@ -10538,34 +10538,39 @@ states.welsh_rebellion_remove_troops = {
},
burgundians(lord) {
add_lord_forces(lord, BURGUNDIANS, -1)
- if (--game.count === 0 || !lord_has_unrouted_units(lord))
- game.who = NOBODY
+ resume_welsh_rebellion_remove_troops(lord)
},
mercenaries(lord) {
add_lord_forces(lord, MERCENARIES, -1)
- if (--game.count === 0 || !lord_has_unrouted_units(lord))
- game.who = NOBODY
+ resume_welsh_rebellion_remove_troops(lord)
},
longbowmen(lord) {
add_lord_forces(lord, LONGBOWMEN, -1)
- if (--game.count === 0 || !lord_has_unrouted_units(lord))
- game.who = NOBODY
+ resume_welsh_rebellion_remove_troops(lord)
},
men_at_arms(lord) {
add_lord_forces(lord, MEN_AT_ARMS, -1)
- if (--game.count === 0 || !lord_has_unrouted_units(lord))
- game.who = NOBODY
+ resume_welsh_rebellion_remove_troops(lord)
},
militia(lord) {
add_lord_forces(lord, MILITIA, -1)
- if (--game.count === 0 || !lord_has_unrouted_units(lord))
- game.who = NOBODY
+ resume_welsh_rebellion_remove_troops(lord)
},
done() {
end_welsh_rebellion_remove_troops()
},
}
+function resume_welsh_rebellion_remove_troops(lord: Lord) {
+ if (!lord_has_unrouted_troops(lord)) {
+ disband_lord(lord)
+ game.who = NOBODY
+ }
+ if (--game.count === 0) {
+ game.who = NOBODY
+ }
+}
+
function end_welsh_rebellion_remove_troops() {
for (let lord of all_york_lords) {
if (is_lord_on_map(lord) && is_lord_in_wales(lord) && !lord_has_unrouted_units(lord))