Fixed d20 modifiers

This commit is contained in:
WBHarry 2026-05-27 20:56:07 +02:00
parent 126a8e4660
commit 505cc634d3
2 changed files with 23 additions and 20 deletions

View file

@ -128,8 +128,30 @@ export default class D20Roll extends DHRoll {
}
}
getBaseModifiers() {
const modifiers = [];
const actor = foundry.utils.fromUuidSync(this.options.source.actor);
if (!actor) return modifiers;
switch (actor.type) {
case 'companion':
case 'adversary':
if (
this.options.roll.type === CONFIG.DH.GENERAL.rollTypes.attack.id ||
this.options.source.action === actor.system.attack.id
)
modifiers.push({
label: 'Bonus to Hit',
value: this.data.attack.roll.bonus ?? 0
});
break;
default:
break;
}
return modifiers;
}
applyBaseBonus() {
const modifiers = foundry.utils.deepClone(this.options.roll.baseModifiers) ?? [];
const modifiers = this.getBaseModifiers();
modifiers.push(
...this.getBonus(