This commit is contained in:
Dapoolp 2025-07-25 00:46:33 +02:00
parent cb92667892
commit 5b4b4affb1
3 changed files with 8 additions and 7 deletions

View file

@ -195,7 +195,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
if (!this.action.damage.parts) return;
const data = this.action.toObject(),
part = {};
if(this.action.actor.isNPC) part.value = { multiplier: 'flat' };
if(this.action.actor?.isNPC) part.value = { multiplier: 'flat' };
data.damage.parts.push(part);
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
}

View file

@ -12,6 +12,7 @@ export default class DamageRoll extends DHRoll {
static async buildEvaluate(roll, config = {}, message = {}) {
if (config.evaluate !== false) {
if(config.dialog.configure === false) roll.constructFormula(config);
for (const roll of config.roll) await roll.roll.evaluate();
}
roll._evaluated = true;

View file

@ -56,13 +56,13 @@ export default class DHRoll extends Roll {
}
// Create Chat Message
if (roll instanceof CONFIG.Dice.daggerheart.DamageRoll && Object.values(config.roll)?.length) {
const pool = foundry.dice.terms.PoolTerm.fromRolls(
Object.values(config.roll).flatMap(r => r.parts.map(p => p.roll))
);
roll = Roll.fromTerms([pool]);
}
if (config.source?.message) {
if (Object.values(config.roll)?.length) {
const pool = foundry.dice.terms.PoolTerm.fromRolls(
Object.values(config.roll).flatMap(r => r.parts.map(p => p.roll))
);
roll = Roll.fromTerms([pool]);
}
if (game.modules.get('dice-so-nice')?.active) await game.dice3d.showForRoll(roll, game.user, true);
} else config.message = await this.toMessage(roll, config);
}