mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Fix duplicate messages
This commit is contained in:
parent
c7f3ec8ab3
commit
a8b98bed38
16 changed files with 96 additions and 171 deletions
|
|
@ -141,6 +141,7 @@ export default class D20Roll extends DHRoll {
|
|||
static postEvaluate(roll, config = {}) {
|
||||
const data = super.postEvaluate(roll, config);
|
||||
data.type = config.roll?.type;
|
||||
data.difficulty = config.roll.difficulty;
|
||||
if (config.targets?.length) {
|
||||
config.targetSelection = true;
|
||||
config.targets.forEach(target => {
|
||||
|
|
@ -148,10 +149,9 @@ export default class D20Roll extends DHRoll {
|
|||
target.hit = roll.isCritical || roll.total >= difficulty;
|
||||
});
|
||||
data.success = config.targets.some(target => target.hit)
|
||||
} else if (config.roll.difficulty) {
|
||||
data.difficulty = config.roll.difficulty;
|
||||
} else if (config.roll.difficulty)
|
||||
data.success = roll.isCritical || roll.total >= config.roll.difficulty;
|
||||
}
|
||||
|
||||
data.advantage = {
|
||||
type: config.roll.advantage,
|
||||
dice: roll.dAdvantage?.denomination,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import D20RollDialog from '../applications/dialogs/d20RollDialog.mjs';
|
|||
|
||||
export default class DHRoll extends Roll {
|
||||
baseTerms = [];
|
||||
constructor(formula, data, options) {
|
||||
constructor(formula, data = {}, options = {}) {
|
||||
super(formula, data, options);
|
||||
if (!this.data || !Object.keys(this.data).length) this.data = options.data;
|
||||
}
|
||||
|
|
@ -94,6 +94,7 @@ export default class DHRoll extends Roll {
|
|||
system: config,
|
||||
rolls: [roll]
|
||||
};
|
||||
config.selectedRollMode ??= game.settings.get('core', 'rollMode');
|
||||
if(roll._evaluated) return await cls.create(msg, { rollMode: config.selectedRollMode });
|
||||
return msg;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue