summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-01-24 16:04:42 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:39 +0100
commitf0571073f874a5f7e10f4a7797f9d61c201802f4 (patch)
treea6e7fb410a0c8fa1ea2a21b11bd09452923cfa6c
parent95d14a958d55996f6762f24204e1373f11c1edf7 (diff)
downloadnevsky-f0571073f874a5f7e10f4a7797f9d61c201802f4.tar.gz
Only show "Capability" button if there are capabilities available.
-rw-r--r--rules.js21
1 files changed, 20 insertions, 1 deletions
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() {