Compare commits

..

No commits in common. "5b61340fee0bd73ced82dd646ded6f301f4c0061" and "c958acabe6d2554b0153be788ac3d39fcbea91ad" have entirely different histories.

5 changed files with 9 additions and 15 deletions

View file

@ -309,7 +309,7 @@ Hooks.on('chatMessage', (_, message) => {
target, target,
difficulty, difficulty,
title, title,
label: game.i18n.localize('DAGGERHEART.GENERAL.dualityRoll'), label: 'test',
actionType: null, actionType: null,
advantage advantage
}); });

View file

@ -87,7 +87,7 @@ export class DHActionRollData extends foundry.abstract.DataModel {
if (this.type === CONFIG.DH.GENERAL.rollTypes.attack.id) if (this.type === CONFIG.DH.GENERAL.rollTypes.attack.id)
modifiers.push({ modifiers.push({
label: 'Bonus to Hit', label: 'Bonus to Hit',
value: this.bonus ?? this.parent.actor.system.attack.roll.bonus ?? 0 value: this.bonus ?? this.parent.actor.system.attack.roll.bonus
}); });
break; break;
default: default:

View file

@ -35,9 +35,7 @@ export default class D20Roll extends DHRoll {
get isCritical() { get isCritical() {
if (!this.d20._evaluated) return; if (!this.d20._evaluated) return;
return this.d20.total >= this.data.system.criticalThreshold;
const criticalThreshold = this.options.actionType === 'reaction' ? 20 : this.data.system.criticalThreshold;
return this.d20.total >= criticalThreshold;
} }
get hasAdvantage() { get hasAdvantage() {

View file

@ -131,13 +131,11 @@ export default class DualityRoll extends D20Roll {
return; return;
} }
this.terms[0] = new foundry.dice.terms.Die({ const { defaultHopeDice, defaultFearDice } = this.data.rules.dualityRoll;
faces: this.data.rules.dualityRoll?.defaultHopeDice ?? 12
}); this.terms[0] = new foundry.dice.terms.Die({ faces: defaultHopeDice });
this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' }); this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' });
this.terms[2] = new foundry.dice.terms.Die({ this.terms[2] = new foundry.dice.terms.Die({ faces: defaultFearDice });
faces: this.data.rules.dualityRoll?.defaultFearDice ?? 12
});
} }
applyAdvantage() { applyAdvantage() {
@ -261,8 +259,6 @@ export default class DualityRoll extends D20Roll {
} }
static async handleTriggers(roll, config) { static async handleTriggers(roll, config) {
if (!config.source?.actor) return;
const updates = []; const updates = [];
const dualityUpdates = await game.system.registeredTriggers.runTrigger( const dualityUpdates = await game.system.registeredTriggers.runTrigger(
CONFIG.DH.TRIGGER.triggers.dualityRoll.id, CONFIG.DH.TRIGGER.triggers.dualityRoll.id,

View file

@ -86,9 +86,9 @@ export const enrichedDualityRoll = async (
const config = { const config = {
event: event ?? {}, event: event ?? {},
title: title, title: title,
headerTitle: label,
roll: { roll: {
trait: traitValue && target ? traitValue : null, trait: traitValue && target ? traitValue : null,
label: label,
difficulty: difficulty, difficulty: difficulty,
advantage, advantage,
type: reaction ? 'reaction' : null type: reaction ? 'reaction' : null
@ -101,7 +101,7 @@ export const enrichedDualityRoll = async (
await target.diceRoll(config); await target.diceRoll(config);
} else { } else {
// For no target, call DualityRoll directly with basic data // For no target, call DualityRoll directly with basic data
config.data = { experiences: {}, traits: {}, rules: {} }; config.data = { experiences: {}, traits: {} };
config.source = { actor: null }; config.source = { actor: null };
await CONFIG.Dice.daggerheart.DualityRoll.build(config); await CONFIG.Dice.daggerheart.DualityRoll.build(config);
} }