From 7f11b3d4fb069730424427f70c1d60e0ecac37f0 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 21 May 2024 14:14:15 +0200 Subject: Percy's Power affects all lords in the north. --- rules.js | 15 +++++++++++---- rules.ts | 20 ++++++++++++++++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/rules.js b/rules.js index 1b235b7..0864b57 100644 --- a/rules.js +++ b/rules.js @@ -1908,6 +1908,8 @@ function reset_unpaid_lords(here) { } } function goto_pay_troops() { + if (is_percys_power_triggered()) + logcap(AOW_LANCASTER_PERCYS_POWER); for (let lord of all_friendly_lords()) { let here = get_lord_locale(lord); let n = Math.ceil(count_lord_all_forces(lord) / 6); @@ -1915,8 +1917,7 @@ function goto_pay_troops() { logcap(AOW_LANCASTER_MADAME_LA_GRANDE); add_lord_assets(lord, COIN, 1); } - if (lord_has_capability(lord, AOW_LANCASTER_PERCYS_POWER) && is_lord_in_north(lord)) { - logcap(AOW_LANCASTER_PERCYS_POWER); + if (is_percys_power_triggered() && is_lord_in_north(lord)) { n = 0; } set_lord_unfed(lord, n); @@ -2086,7 +2087,7 @@ function goto_pay_lords() { log_br(); for (let lord of all_friendly_lords()) { if (is_lord_on_map(lord)) { - if (lord_has_capability(lord, AOW_LANCASTER_PERCYS_POWER) && is_lord_in_north(lord)) + if (is_percys_power_triggered() && is_lord_in_north(lord)) continue; set_lord_unfed(lord, 1); } @@ -2168,7 +2169,7 @@ function for_each_unpaid_vassal(f) { for (let v of all_vassals) { let lord = get_vassal_lord(v); if (is_friendly_lord(lord) && get_vassal_service(v) === current_turn()) { - if (lord_has_capability(lord, AOW_LANCASTER_PERCYS_POWER) && is_lord_in_north(lord)) + if (is_percys_power_triggered() && is_lord_in_north(lord)) continue; f(v); } @@ -9680,6 +9681,12 @@ function end_heralds_attempt() { spend_all_actions(); resume_command(); } +// === CAPABILITY: PERCY'S POWER === +function is_percys_power_triggered() { + return (game.active === LANCASTER && + lord_has_capability(LORD_NORTHUMBERLAND_L, AOW_LANCASTER_PERCYS_POWER) && + is_lord_in_north(LORD_NORTHUMBERLAND_L)); +} // === EVENTS: IMMEDIATE === function goto_immediate_event(c) { set_add(game.events, c); diff --git a/rules.ts b/rules.ts index 4f38744..88f718a 100644 --- a/rules.ts +++ b/rules.ts @@ -2424,6 +2424,9 @@ function reset_unpaid_lords(here: Locale) { } function goto_pay_troops() { + if (is_percys_power_triggered()) + logcap(AOW_LANCASTER_PERCYS_POWER) + for (let lord of all_friendly_lords()) { let here = get_lord_locale(lord) let n = Math.ceil(count_lord_all_forces(lord) / 6) @@ -2431,8 +2434,7 @@ function goto_pay_troops() { logcap(AOW_LANCASTER_MADAME_LA_GRANDE) add_lord_assets(lord, COIN, 1) } - if (lord_has_capability(lord, AOW_LANCASTER_PERCYS_POWER) && is_lord_in_north(lord)) { - logcap(AOW_LANCASTER_PERCYS_POWER) + if (is_percys_power_triggered() && is_lord_in_north(lord)) { n = 0 } set_lord_unfed(lord, n) @@ -2623,7 +2625,7 @@ function goto_pay_lords() { for (let lord of all_friendly_lords()) { if (is_lord_on_map(lord)) { - if (lord_has_capability(lord, AOW_LANCASTER_PERCYS_POWER) && is_lord_in_north(lord)) + if (is_percys_power_triggered() && is_lord_in_north(lord)) continue set_lord_unfed(lord, 1) } @@ -2711,7 +2713,7 @@ function for_each_unpaid_vassal(f) { for (let v of all_vassals) { let lord = get_vassal_lord(v) if (is_friendly_lord(lord) && get_vassal_service(v) === current_turn()) { - if (lord_has_capability(lord, AOW_LANCASTER_PERCYS_POWER) && is_lord_in_north(lord)) + if (is_percys_power_triggered() && is_lord_in_north(lord)) continue f(v) } @@ -11231,6 +11233,16 @@ function end_heralds_attempt() { resume_command() } +// === CAPABILITY: PERCY'S POWER === + +function is_percys_power_triggered() { + return ( + game.active === LANCASTER && + lord_has_capability(LORD_NORTHUMBERLAND_L, AOW_LANCASTER_PERCYS_POWER) && + is_lord_in_north(LORD_NORTHUMBERLAND_L) + ) +} + // === EVENTS: IMMEDIATE === function goto_immediate_event(c: Card) { -- cgit v1.2.3