mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Merge 8ab795b6ba into 454507ba7b
This commit is contained in:
commit
c7dba71a79
30 changed files with 123 additions and 50 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue