Merged with development

This commit is contained in:
WBHarry 2025-09-06 23:23:07 +02:00
commit 19a07139ff
548 changed files with 4997 additions and 2887 deletions

View file

@ -128,7 +128,9 @@ export default class D20Roll extends DHRoll {
applyBaseBonus() {
const modifiers = foundry.utils.deepClone(this.options.roll.baseModifiers) ?? [];
modifiers.push(...this.getBonus(`roll.${this.options.type}`, `${this.options.type?.capitalize()} Bonus`));
modifiers.push(
...this.getBonus(`roll.${this.options.actionType}`, `${this.options.actionType?.capitalize()} Bonus`)
);
modifiers.push(
...this.getBonus(`roll.${this.options.roll.type}`, `${this.options.roll.type?.capitalize()} Bonus`)
);
@ -138,7 +140,7 @@ export default class D20Roll extends DHRoll {
static postEvaluate(roll, config = {}) {
const data = super.postEvaluate(roll, config);
data.type = config.roll?.type;
data.type = config.actionType;
data.difficulty = config.roll.difficulty;
if (config.targets?.length) {
config.targets.forEach(target => {
@ -147,6 +149,7 @@ export default class D20Roll extends DHRoll {
});
data.success = config.targets.some(target => target.hit);
} else if (config.roll.difficulty) data.success = roll.isCritical || roll.total >= config.roll.difficulty;
config.successConsumed = data.success;
data.advantage = {
type: config.roll.advantage,

View file

@ -9,6 +9,7 @@ export default class DamageRoll extends DHRoll {
static DefaultDialog = DamageDialog;
static async buildEvaluate(roll, config = {}, message = {}) {
if (config.dialog.configure === false) roll.constructFormula(config);
if (config.evaluate !== false) for (const roll of config.roll) await roll.roll.evaluate();
roll._evaluated = true;
@ -46,9 +47,7 @@ export default class DamageRoll extends DHRoll {
);
}
await super.buildPost(roll, config, message);
if (config.source?.message) {
chatMessage.update({ 'system.damage': config.damage });
}
if (config.source?.message) chatMessage.update({ 'system.damage': config.damage });
}
static unifyDamageRoll(rolls) {

View file

@ -28,6 +28,7 @@ export default class DHRoll extends Roll {
static async buildConfigure(config = {}, message = {}) {
config.hooks = [...this.getHooks(), ''];
config.dialog ??= {};
for (const hook of config.hooks) {
if (Hooks.call(`${CONFIG.DH.id}.preRoll${hook.capitalize()}`, config, message) === false) return null;
}
@ -88,11 +89,12 @@ export default class DHRoll extends Roll {
type: this.messageType,
user: game.user.id,
title: roll.title,
speaker: cls.getSpeaker(),
speaker: cls.getSpeaker({ actor: roll.data?.parent }),
sound: config.mute ? null : CONFIG.sounds.dice,
system: config,
rolls: [roll]
};
config.selectedRollMode ??= game.settings.get('core', 'rollMode');
if (roll._evaluated) {
@ -226,7 +228,7 @@ export const registerRollDiceHooks = () => {
if (
!config.source?.actor ||
(game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) ||
config.roll.type === 'reaction'
config.actionType === 'reaction'
)
return;

View file

@ -19,7 +19,7 @@ export default class DualityRoll extends D20Roll {
get title() {
return game.i18n.localize(
`DAGGERHEART.GENERAL.${this.options?.roll?.type === CONFIG.DH.ITEM.actionTypes.reaction.id ? 'reactionRoll' : 'dualityRoll'}`
`DAGGERHEART.GENERAL.${this.options?.actionType === CONFIG.DH.ITEM.actionTypes.reaction.id ? 'reactionRoll' : 'dualityRoll'}`
);
}
@ -154,9 +154,12 @@ export default class DualityRoll extends D20Roll {
applyBaseBonus() {
const modifiers = super.applyBaseBonus();
if (this.options.roll.trait && this.data.traits[this.options.roll.trait])
if (this.options.roll.trait && this.data.traits?.[this.options.roll.trait])
modifiers.unshift({
label: `DAGGERHEART.CONFIG.Traits.${this.options.roll.trait}.name`,
label:
this.options.roll.type === CONFIG.DH.GENERAL.rollTypes.spellcast.id
? 'DAGGERHEART.CONFIG.RollTypes.spellcast.name'
: `DAGGERHEART.CONFIG.Traits.${this.options.roll.trait}.name`,
value: this.data.traits[this.options.roll.trait].value
});