FEAT: formatting code

FIX: fix fields used
FEAT: add jsdoc
This commit is contained in:
Joaquin Pereyra 2025-06-06 18:17:14 -03:00
parent 6c147a5c00
commit f3942280b6
13 changed files with 96 additions and 114 deletions

View file

@ -12,6 +12,26 @@ export default class DhpItem extends Item {
}
}
/**
* @inheritdoc
* @param {object} options - Options which modify the getRollData method.
* @returns
*/
getRollData(options = {}) {
let data;
if (this.system.getRollData) data = this.system.getRollData(options);
else {
const actorRollData = this.actor?.getRollData(options) ?? {};
data = { ...actorRollData, item: { ...this.system } };
}
if (data?.item) {
data.item.flags = { ...this.flags };
data.item.name = this.name;
}
return data;
}
isInventoryItem() {
return ['weapon', 'armor', 'miscellaneous', 'consumable'].includes(this.type);
}