summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-01 16:56:45 +0200
committerTor Andersson <tor@ccxvii.net>2024-05-01 16:56:58 +0200
commit151ec0c6f6e98245b0bd06a6e66b6ec3a63077f2 (patch)
tree79b33a19db8b95719a40f4ae948e12809fa39301
parentb7b163ab45e87a9cb45abfff99cb11efa51f8588 (diff)
downloadplantagenet-151ec0c6f6e98245b0bd06a6e66b6ec3a63077f2.tar.gz
we done deeds of charity
-rw-r--r--rules.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/rules.ts b/rules.ts
index 460f705..56e9105 100644
--- a/rules.ts
+++ b/rules.ts
@@ -1396,7 +1396,7 @@ function lord_has_routed_troops(lord: Lord) {
}
function find_lord_with_capability_card(c: Card) {
- for (let lord of all_friendly_lords())
+ for (let lord of all_lords)
if (lord_has_capability_card(lord, c))
return lord
return NOBODY
@@ -1441,6 +1441,14 @@ function get_modified_valour(lord: Lord) {
// === STATE: LORD (SHARED) ===
+function get_york_shared_assets(loc: Locale, what: Asset) {
+ let n = 0
+ for (let lord of all_york_lords)
+ if (get_lord_locale(lord) === loc)
+ n += get_lord_assets(lord, what)
+ return n
+}
+
function get_shared_assets(loc: Locale, what: Asset) {
let n = 0
for (let lord of all_friendly_lords())
@@ -10551,7 +10559,7 @@ function eligible_charity() {
let lord = find_lord_with_capability_card(AOW_YORK_WE_DONE_DEEDS_OF_CHARITY)
if (lord !== NOBODY) {
let here = get_lord_locale(lord)
- if (get_shared_assets(here, PROV) > 0)
+ if (get_york_shared_assets(here, PROV) > 0)
return true
}
return false
@@ -10566,15 +10574,17 @@ function goto_we_done_deeds_of_charity() {
states.we_done_deeds_of_charity = {
inactive: "We done needs of charity",
prompt() {
- view.prompt = "We done deeds of charity: Pay up to two Provender for +1 Influence point each."
let lord = find_lord_with_capability_card(AOW_YORK_WE_DONE_DEEDS_OF_CHARITY)
let here = get_lord_locale(lord)
if (game.count > 0) {
+ view.prompt = "We done deeds of charity: Pay up to two Provender for +1 Influence point each."
for (let lord of all_friendly_lords()) {
if (get_lord_locale(lord) === here && (get_lord_assets(lord, PROV) > 0)) {
gen_action_prov(lord)
}
}
+ } else {
+ view.prompt = "We done deeds of charity: All done."
}
view.actions.done = 1
},