summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorteisuru <31881306+teisuru@users.noreply.github.com>2025-01-20 12:29:45 +0100
committerteisuru <31881306+teisuru@users.noreply.github.com>2025-01-20 12:29:45 +0100
commitde9e615c9cdb81e2ba09adc8f2be7ccdd48a0d92 (patch)
tree836ca4ee66856bd80a41bdceab0ac5bc1b6b3cf4
parent7ce679fa9898be1df134ea0518ba4f120f2f3e73 (diff)
downloadplantagenet-de9e615c9cdb81e2ba09adc8f2be7ccdd48a0d92.tar.gz
fix soldiers of fortune + irishmen and beloved warwick
fix for soldiers of fortune not applying to beloved warwick and irishmen
-rw-r--r--play.js1
-rw-r--r--rules.js38
-rw-r--r--rules.ts46
3 files changed, 75 insertions, 10 deletions
diff --git a/play.js b/play.js
index a9fcf69..1aa92da 100644
--- a/play.js
+++ b/play.js
@@ -1549,6 +1549,7 @@ function on_update() {
action_button("heralds", "Heralds")
action_button("levy_beloved_warwick", "Beloved Warwick")
action_button("levy_irishmen", "Irishmen")
+ action_button("soldiers_of_fortune_militia", "SoF & Militia")
action_button("loyalty_and_trust", "Loyalty and Trust")
action_button("merchants", "Merchants")
action_button("regroup", "Regroup")
diff --git a/rules.js b/rules.js
index b78f1c8..0deafa5 100644
--- a/rules.js
+++ b/rules.js
@@ -2607,6 +2607,8 @@ states.muster_lord = {
if (!is_rising_wages() || can_pay_from_shared(game.command, 2)) {
if (can_add_troops_sof(game.command, here))
view.actions.soldiers_of_fortune = 1;
+ if (can_add_troops_sof(game.command, here) && (can_add_troops_irishmen(game.command, here)) || can_add_troops_sof(game.command, here) && (can_add_troops_beloved_warwick(game.command, here)))
+ view.actions.soldiers_of_fortune_militia = 1;
}
}
}
@@ -2666,7 +2668,6 @@ states.muster_lord = {
},
levy_beloved_warwick() {
push_undo();
- push_the_kings_name();
log("Levy Troops.");
logcap(AOW_YORK_BELOVED_WARWICK);
add_lord_forces(game.command, MILITIA, 5);
@@ -2674,7 +2675,6 @@ states.muster_lord = {
},
levy_irishmen() {
push_undo();
- push_the_kings_name();
log("Levy Troops.");
logcap(AOW_YORK_IRISHMEN);
add_lord_forces(game.command, MILITIA, 5);
@@ -2682,11 +2682,20 @@ states.muster_lord = {
},
soldiers_of_fortune() {
push_undo();
- push_the_kings_name();
log("Levy Troops.");
logcap(AOW_YORK_SOLDIERS_OF_FORTUNE);
game.state = "soldiers_of_fortune";
},
+ soldiers_of_fortune_militia() {
+ push_undo();
+ log("Levy Troops.");
+ logcap(AOW_YORK_SOLDIERS_OF_FORTUNE);
+ if (lord_has_capability(game.command, AOW_YORK_IRISHMEN))
+ logcap(AOW_YORK_IRISHMEN);
+ if (lord_has_capability(game.command, AOW_YORK_BELOVED_WARWICK))
+ logcap(AOW_YORK_BELOVED_WARWICK);
+ game.state = "soldiers_of_fortune_militia";
+ },
commission_of_array() {
push_undo();
push_the_kings_name();
@@ -9437,6 +9446,29 @@ states.soldiers_of_fortune = {
do_levy_troops();
},
};
+
+states.soldiers_of_fortune_militia = {
+ inactive: "Muster",
+ prompt() {
+ view.prompt = `Soldiers of Fortune: Pay 1 coin to add 2 mercenaries to ${lord_name[game.command]}.`;
+ let here = get_lord_locale(game.command);
+ for (let lord of all_friendly_lords()) {
+ if (get_lord_locale(lord) === here) {
+ if (get_lord_assets(lord, COIN) > 0)
+ gen_action_coin(lord);
+ }
+ }
+ },
+ coin(lord) {
+ add_lord_assets(lord, COIN, -1);
+ let n = Math.min(2, count_available_mercenaries());
+ add_lord_forces(game.command, MERCENARIES, n);
+ add_lord_forces(game.command, MILITIA, 5);
+ end_levy_troops();
+ },
+};
+
+
// === MUSTER CAPABILITY: COMMISSION OF ARRAY ===
states.commission_of_array = {
inactive: "Muster",
diff --git a/rules.ts b/rules.ts
index f58baef..7282d7a 100644
--- a/rules.ts
+++ b/rules.ts
@@ -185,6 +185,7 @@ interface State {
heralds?(): void,
levy_beloved_warwick?(): void,
levy_irishmen?(): void,
+ soldiers_of_fortune_militia?(): void,
loyalty_and_trust?(): void,
merchants?(): void,
regroup?(): void,
@@ -3219,10 +3220,12 @@ states.muster_lord = {
if (can_add_troops_coa(game.command, here))
view.actions.commission_of_array = 1
}
- if (!is_rising_wages() || can_pay_from_shared(game.command, 2)) {
- if (can_add_troops_sof(game.command, here))
- view.actions.soldiers_of_fortune = 1
- }
+ if (!is_rising_wages() || can_pay_from_shared(game.command, 2)) {
+ if (can_add_troops_sof(game.command, here))
+ view.actions.soldiers_of_fortune = 1;
+ if (can_add_troops_sof(game.command, here) && (can_add_troops_irishmen(game.command, here)) || can_add_troops_sof(game.command, here) && (can_add_troops_beloved_warwick(game.command, here)))
+ view.actions.soldiers_of_fortune_militia = 1;
+ }
}
} else {
@@ -3290,7 +3293,6 @@ states.muster_lord = {
levy_beloved_warwick() {
push_undo()
- push_the_kings_name()
log("Levy Troops.")
logcap(AOW_YORK_BELOVED_WARWICK)
add_lord_forces(game.command, MILITIA, 5)
@@ -3299,7 +3301,6 @@ states.muster_lord = {
levy_irishmen() {
push_undo()
- push_the_kings_name()
log("Levy Troops.")
logcap(AOW_YORK_IRISHMEN)
add_lord_forces(game.command, MILITIA, 5)
@@ -3308,12 +3309,22 @@ states.muster_lord = {
soldiers_of_fortune() {
push_undo()
- push_the_kings_name()
log("Levy Troops.")
logcap(AOW_YORK_SOLDIERS_OF_FORTUNE)
game.state = "soldiers_of_fortune"
},
+ soldiers_of_fortune_militia() {
+ push_undo();
+ log("Levy Troops.");
+ logcap(AOW_YORK_SOLDIERS_OF_FORTUNE);
+ if (lord_has_capability(game.command, AOW_YORK_IRISHMEN))
+ logcap(AOW_YORK_IRISHMEN);
+ if (lord_has_capability(game.command, AOW_YORK_BELOVED_WARWICK))
+ logcap(AOW_YORK_BELOVED_WARWICK);
+ game.state = "soldiers_of_fortune_militia";
+ },
+
commission_of_array() {
push_undo()
push_the_kings_name()
@@ -10958,6 +10969,27 @@ states.soldiers_of_fortune = {
},
}
+states.soldiers_of_fortune_militia = {
+ inactive: "Muster",
+ prompt() {
+ view.prompt = `Soldiers of Fortune: Pay 1 coin to add 2 mercenaries to ${lord_name[game.command]}.`;
+ let here = get_lord_locale(game.command);
+ for (let lord of all_friendly_lords()) {
+ if (get_lord_locale(lord) === here) {
+ if (get_lord_assets(lord, COIN) > 0)
+ gen_action_coin(lord);
+ }
+ }
+ },
+ coin(lord) {
+ add_lord_assets(lord, COIN, -1);
+ let n = Math.min(2, count_available_mercenaries());
+ add_lord_forces(game.command, MERCENARIES, n);
+ add_lord_forces(game.command, MILITIA, 5);
+ end_levy_troops();
+ },
+};
+
// === MUSTER CAPABILITY: COMMISSION OF ARRAY ===
states.commission_of_array = {