diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-04-21 21:23:11 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-04-21 21:25:23 +0200 |
commit | a58213a5f473f2920c57480f4a5c59a2189fcf43 (patch) | |
tree | 0061edf84bdd9b9796c5fa771fe9183b3846442d | |
parent | 6c154f4834b3d23bc87dcee81f89c65636bd817e (diff) | |
download | plantagenet-a58213a5f473f2920c57480f4a5c59a2189fcf43.tar.gz |
Check if Lord can actually levy a capability.
-rw-r--r-- | rules.ts | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -3286,10 +3286,11 @@ function can_add_transport(who: Lord, what: Asset) { // === 3.4.6 LEVY CAPABILITY === function can_add_lord_capability(lord: Lord) { - if (get_lord_capability(lord, 0) < 0) - return true - if (get_lord_capability(lord, 1) < 0) - return true + if (get_lord_capability(lord, 0) < 0 || get_lord_capability(lord, 1) < 0) { + for (let c of list_deck()) + if (can_lord_levy_capability_card(lord, c)) + return true + } return false } @@ -3333,18 +3334,22 @@ function discard_lord_capability(lord: Lord, c: Card) { throw new Error("capability not found") } +function can_lord_levy_capability_card(lord: Lord, c: Card) { + if (!data.cards[c].lords || set_has(data.cards[c].lords, lord)) + if (!lord_already_has_capability(lord, c) && forbidden_levy_capabilities(c)) + return true + return false +} + states.levy_capability = { inactive: "Muster", prompt() { let deck = list_deck() view.prompt = `Levy Capability for ${lord_name[game.command]}.` view.arts_of_war = deck - for (let c of deck) { - if (!data.cards[c].lords || set_has(data.cards[c].lords, game.command)) { - if (!lord_already_has_capability(game.command, c) && forbidden_levy_capabilities(c)) - gen_action_card(c) - } - } + for (let c of deck) + if (can_lord_levy_capability_card(game.command, c)) + gen_action_card(c) }, card(c) { add_lord_capability(game.command, c) |