summaryrefslogtreecommitdiff
path: root/rules.ts
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-04-19 23:59:09 +0200
committerTor Andersson <tor@ccxvii.net>2024-04-19 23:59:09 +0200
commit1080f804ea5f8fcb5fca4e4b9026185677de1b7a (patch)
tree36bf56eab0dc5cf33fa5f8faa956fc874f64b6ab /rules.ts
parent8629acc5a2471a30ae29df679268437e73ebf721 (diff)
downloadplantagenet-1080f804ea5f8fcb5fca4e4b9026185677de1b7a.tar.gz
Move lord_has_capability_card to LORD section.
Diffstat (limited to 'rules.ts')
-rw-r--r--rules.ts67
1 files changed, 34 insertions, 33 deletions
diff --git a/rules.ts b/rules.ts
index 5683b24..1ea3b87 100644
--- a/rules.ts
+++ b/rules.ts
@@ -7,12 +7,13 @@
/*
TODO
+ EVENTS and CAPABILITIES trigger - Pass instead of Done
+
+ handle both lords at same sea...
+
NAVAL BLOCKADE - for Tax and Tax Collectors
Y15 LONDON FOR YORK - except by Event exception
- scenario card lists
- number of roses in data
-
Scenario special rules.
Review all undo steps.
@@ -1208,6 +1209,36 @@ function set_lord_capability(lord: Lord, n: 0 | 1, x: Card) {
map2_set(game.pieces.capabilities, lord, n, x)
}
+function lord_has_capability_card(lord: Lord, c: Card) {
+ if (get_lord_capability(lord, 0) === c)
+ return true
+ if (get_lord_capability(lord, 1) === c)
+ return true
+ return false
+}
+
+function lord_has_capability(lord: Lord, card_or_list: Card | Card[]) {
+ if (Array.isArray(card_or_list)) {
+ for (let card of card_or_list)
+ if (lord_has_capability_card(lord, card))
+ return true
+ return false
+ }
+ return lord_has_capability_card(lord, card_or_list)
+}
+
+function lord_already_has_capability(lord: Lord, c: Card) {
+ // compare capabilities by name...
+ let name = data.cards[c].capability
+ let c1 = get_lord_capability(lord, 0)
+ if (c1 >= 0 && data.cards[c1].capability === name)
+ return true
+ let c2 = get_lord_capability(lord, 1)
+ if (c2 >= 0 && data.cards[c2].capability === name)
+ return true
+ return false
+}
+
function get_lord_assets(lord: Lord, n: Asset): number {
return map_get_pack4(game.pieces.assets, lord, n)
}
@@ -3219,36 +3250,6 @@ function can_add_transport(who: Lord, what: Asset) {
// === 3.4.6 LEVY CAPABILITY ===
-function lord_has_capability_card(lord: Lord, c: Card) {
- if (get_lord_capability(lord, 0) === c)
- return true
- if (get_lord_capability(lord, 1) === c)
- return true
- return false
-}
-
-function lord_has_capability(lord: Lord, card_or_list: Card | Card[]) {
- if (Array.isArray(card_or_list)) {
- for (let card of card_or_list)
- if (lord_has_capability_card(lord, card))
- return true
- return false
- }
- return lord_has_capability_card(lord, card_or_list)
-}
-
-function lord_already_has_capability(lord: Lord, c: Card) {
- // compare capabilities by name...
- let name = data.cards[c].capability
- let c1 = get_lord_capability(lord, 0)
- if (c1 >= 0 && data.cards[c1].capability === name)
- return true
- let c2 = get_lord_capability(lord, 1)
- if (c2 >= 0 && data.cards[c2].capability === name)
- return true
- return false
-}
-
function can_add_lord_capability(lord: Lord) {
if (get_lord_capability(lord, 0) < 0)
return true