This commit is contained in:
WBHarry 2026-01-11 11:58:35 +01:00 committed by GitHub
commit c7dba71a79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 123 additions and 50 deletions

View file

@ -29,7 +29,21 @@ export default class DHDomainCard extends BaseDataItem {
required: true,
initial: CONFIG.DH.DOMAIN.cardTypes.ability.id
}),
inVault: new fields.BooleanField({ initial: false })
inVault: new fields.BooleanField({ initial: false }),
vaultActive: new fields.BooleanField({
required: true,
nullable: false,
initial: false
}),
loadoutIgnore: new fields.BooleanField({
required: true,
nullable: false,
initial: false
}),
domainTouched: new fields.NumberField({
nullable: true,
initial: null
})
};
}
@ -38,6 +52,30 @@ export default class DHDomainCard extends BaseDataItem {
return game.i18n.localize(allDomainData[this.domain].label);
}
get vaultSupressed() {
return this.inVault && !this.vaultActive;
}
get domainTouchedSuppressed() {
if (!this.parent.system.domainTouched || this.parent.parent?.type !== 'character') return false;
const matchingDomainCards = this.parent.parent.items.filter(
item => !item.system.inVault && item.system.domain === this.parent.system.domain
).length;
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 */