ItemFeatures are now prepended to the description

This commit is contained in:
WBHarry 2026-01-10 15:32:32 +01:00
parent 0b343c9f52
commit 9d353fe54a
9 changed files with 97 additions and 16 deletions

View file

@ -110,6 +110,22 @@ export default class DHWeapon extends AttachableItem {
);
}
/**@inheritdoc */
async getDescriptionData(large) {
const baseDescription = await super.getDescriptionData();
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
const features = this.weaponFeatures.map(x => allFeatures[x.value]);
if (!features.length) return baseDescription;
const prepend = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',
{ features, large }
);
const mainDescription = baseDescription ? `\n<hr>\n${baseDescription}` : '';
return `${prepend}${mainDescription}`;
}
prepareDerivedData() {
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
}