From f0571073f874a5f7e10f4a7797f9d61c201802f4 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 24 Jan 2023 16:04:42 +0100 Subject: Only show "Capability" button if there are capabilities available. --- rules.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index ef17ff4..458a07b 100644 --- a/rules.js +++ b/rules.js @@ -3427,7 +3427,8 @@ states.levy_muster_lord = { view.actions.take_sled = 1 // Add Capability - view.actions.capability = 1 + if (can_muster_capability()) + view.actions.capability = 1 } view.actions.done = 1 @@ -3623,6 +3624,24 @@ function discard_lord_capability(lord, c) { throw new Error("capability not found") } +function can_muster_capability() { + let deck = list_deck() + for (let c of deck) { + if (is_no_event_card(c)) + continue + if (!data.cards[c].lords || set_has(data.cards[c].lords, game.who)) { + if (data.cards[c].this_lord) { + if (!lord_already_has_capability(game.who, c)) + return true + } else { + if (can_deploy_global_capability(c)) + return true + } + } + } + return false +} + states.muster_capability = { inactive: "Levy", prompt() { -- cgit v1.2.3