diff --git a/module/data/item/domainCard.mjs b/module/data/item/domainCard.mjs index 129b0864..327dafce 100644 --- a/module/data/item/domainCard.mjs +++ b/module/data/item/domainCard.mjs @@ -52,11 +52,11 @@ export default class DHDomainCard extends BaseDataItem { return game.i18n.localize(allDomainData[this.domain].label); } - get vaultSupressed() { + get isVaultSupressed() { return this.inVault && !this.vaultActive; } - get domainTouchedSuppressed() { + get isDomainTouchedSuppressed() { if (!this.parent.system.domainTouched || this.parent.parent?.type !== 'character') return false; const matchingDomainCards = this.parent.parent.items.filter( @@ -65,17 +65,6 @@ export default class DHDomainCard extends BaseDataItem { return matchingDomainCards < this.parent.system.domainTouched; } - get cannotUse() { - if (this.domainTouchedSuppressed) { - return ui.notifications.warn( - game.i18n.format('DAGGERHEART.UI.Notifications.domainTouchRequirement', { - nr: this.domainTouched, - domain: game.i18n.localize(CONFIG.DH.DOMAIN.allDomains()[this.domain].label) - }) - ); - } - } - /* -------------------------------------------- */ /**@override */ diff --git a/module/documents/activeEffect.mjs b/module/documents/activeEffect.mjs index ad5a5d83..caf99803 100644 --- a/module/documents/activeEffect.mjs +++ b/module/documents/activeEffect.mjs @@ -20,10 +20,10 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect { } if (this.parent?.type === 'domainCard') { - const vaultSupressed = this.parent.system.vaultSupressed; - const domainTouchedSupressed = this.parent.system.domainTouchedSuppressed; + const isVaultSupressed = this.parent.system.isVaultSupressed; + const domainTouchedSupressed = this.parent.system.isDomainTouchedSuppressed; - return vaultSupressed || domainTouchedSupressed; + return isVaultSupressed || domainTouchedSupressed; } return super.isSuppressed; diff --git a/module/documents/item.mjs b/module/documents/item.mjs index 8fbe2929..7607658c 100644 --- a/module/documents/item.mjs +++ b/module/documents/item.mjs @@ -146,7 +146,15 @@ export default class DHItem extends foundry.documents.Item { /* -------------------------------------------- */ async use(event) { - if (this.system.cannotUse) return; + /* DomainCard check. Can be expanded or made neater */ + if (this.system.isDomainTouchedSuppressed) { + return ui.notifications.warn( + game.i18n.format('DAGGERHEART.UI.Notifications.domainTouchRequirement', { + nr: this.domainTouched, + domain: game.i18n.localize(CONFIG.DH.DOMAIN.allDomains()[this.domain].label) + }) + ); + } const actions = new Set(this.system.actionsList); if (actions?.size) {