Compare commits

..

No commits in common. "0d967a2fe4235843913aafa5bf54012a68314e56" and "8ab795b6ba9438459fb6b2eb8147e301781214ad" have entirely different histories.

3 changed files with 17 additions and 14 deletions

View file

@ -52,11 +52,11 @@ export default class DHDomainCard extends BaseDataItem {
return game.i18n.localize(allDomainData[this.domain].label); return game.i18n.localize(allDomainData[this.domain].label);
} }
get isVaultSupressed() { get vaultSupressed() {
return this.inVault && !this.vaultActive; return this.inVault && !this.vaultActive;
} }
get isDomainTouchedSuppressed() { get domainTouchedSuppressed() {
if (!this.parent.system.domainTouched || this.parent.parent?.type !== 'character') return false; if (!this.parent.system.domainTouched || this.parent.parent?.type !== 'character') return false;
const matchingDomainCards = this.parent.parent.items.filter( const matchingDomainCards = this.parent.parent.items.filter(
@ -65,6 +65,17 @@ export default class DHDomainCard extends BaseDataItem {
return matchingDomainCards < this.parent.system.domainTouched; 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 */ /**@override */

View file

@ -20,10 +20,10 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
} }
if (this.parent?.type === 'domainCard') { if (this.parent?.type === 'domainCard') {
const isVaultSupressed = this.parent.system.isVaultSupressed; const vaultSupressed = this.parent.system.vaultSupressed;
const domainTouchedSupressed = this.parent.system.isDomainTouchedSuppressed; const domainTouchedSupressed = this.parent.system.domainTouchedSuppressed;
return isVaultSupressed || domainTouchedSupressed; return vaultSupressed || domainTouchedSupressed;
} }
return super.isSuppressed; return super.isSuppressed;

View file

@ -146,15 +146,7 @@ export default class DHItem extends foundry.documents.Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
async use(event) { async use(event) {
/* DomainCard check. Can be expanded or made neater */ if (this.system.cannotUse) return;
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); const actions = new Set(this.system.actionsList);
if (actions?.size) { if (actions?.size) {