mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Feature: add methods for generate tags and labels for documents and actions (#499)
* FEAT: getTags and getLabels for weapons items * FEAT: add _gettags and _getLabels to armor, domainCard, weapons and ActiveEffect * define tags for actions --------- Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
parent
9d025bf105
commit
a27ee1578e
8 changed files with 237 additions and 165 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import BaseDataItem from './base.mjs';
|
||||
import { ActionField } from '../fields/actionField.mjs';
|
||||
|
||||
export default class DHDomainCard extends BaseDataItem {
|
||||
/** @inheritDoc */
|
||||
|
|
@ -34,6 +33,7 @@ export default class DHDomainCard extends BaseDataItem {
|
|||
};
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
async _preCreate(data, options, user) {
|
||||
const allowed = await super._preCreate(data, options, user);
|
||||
if (allowed === false) return;
|
||||
|
|
@ -55,4 +55,35 @@ export default class DHDomainCard extends BaseDataItem {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a list of localized tags based on this item's type-specific properties.
|
||||
* @returns {string[]} An array of localized tag strings.
|
||||
*/
|
||||
_getTags() {
|
||||
const tags = [
|
||||
game.i18n.localize(`DAGGERHEART.CONFIG.DomainCardTypes.${this.type}`),
|
||||
game.i18n.localize(`DAGGERHEART.GENERAL.Domain.${this.domain}.label`),
|
||||
`${game.i18n.localize('DAGGERHEART.ITEMS.DomainCard.recallCost')}: ${this.recallCost}`
|
||||
];
|
||||
|
||||
return tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a localized label array for this item subtype.
|
||||
* @returns {(string | { value: string, icons: string[] })[]} An array of localized strings and damage label objects.
|
||||
*/
|
||||
_getLabels() {
|
||||
const labels = [
|
||||
game.i18n.localize(`DAGGERHEART.CONFIG.DomainCardTypes.${this.type}`),
|
||||
game.i18n.localize(`DAGGERHEART.GENERAL.Domain.${this.domain}.label`),
|
||||
{
|
||||
value: `${this.recallCost}`, //converts the number to a string
|
||||
icons: ['fa-bolt']
|
||||
}
|
||||
];
|
||||
|
||||
return labels;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue