FEAT: new FormulaField class

FEAT: add getRollData on BaseDataItem Class
FEAT: weapon
FIX: remove inventoryWeapon field on Weapon Data Model
This commit is contained in:
Joaquin Pereyra 2025-05-31 12:46:26 -03:00
parent ec7f32cdc7
commit 527a0cd419
6 changed files with 96 additions and 18 deletions

View file

@ -24,9 +24,20 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
if (this.metadata.hasDescription)
schema.description = new fields.HTMLField({ required: true, nullable: true });
if (this.metadata.isQuantifiable)
if (this.metadata.isQuantifiable)
schema.quantity = new fields.NumberField({ integer: true, initial: 1, min: 0, required: true });
return schema;
}
/**
* Obtain a data object used to evaluate any dice rolls associated with this Item
* @param {object} [options]
* @returns {object}
*/
getRollData(options = {}) {
const actorRollData = this.parent.actor?.getRollData() ?? {};
const data = { ...actorRollData, item: { ...this } };
return data;
}
}