Fixed rollData for actions and fallback for lookup enricher

This commit is contained in:
WBHarry 2025-12-25 02:54:35 +01:00
parent c63ba3b41d
commit 61fcbf6851
2 changed files with 15 additions and 12 deletions

View file

@ -162,18 +162,16 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
* @returns {object}
*/
getRollData(data = {}) {
if (!this.actor) return null;
const actorData = this.actor.getRollData(false);
const actorData = this.actor ? this.actor.getRollData(false) : {};
// Add Roll results to RollDatas
actorData.result = data.roll?.total ?? 1;
actorData.scale = data.costs?.length // Right now only return the first scalable cost.
? (data.costs.find(c => c.scalable)?.total ?? 1)
: 1;
actorData.roll = {};
return actorData;
return {
...actorData,
result: data.roll?.total ?? 1,
scale: data.costs?.length // Right now only return the first scalable cost.
? (data.costs.find(c => c.scalable)?.total ?? 1)
: 1,
roll: {}
};
}
/**