Skip to content

Commit 24e1797

Browse files
committed
FIX - mastery die formula replace
1 parent 7c4dbe8 commit 24e1797

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/module/actor/ABFActor.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,13 @@ export class ABFActor extends Actor {
113113
const abilityValue = this.system.secondaries[groupPath][ability].final.value;
114114
const label = name ? `Rolling ${name}` : '';
115115
const mod = await openModDialog();
116-
let formula = `1d100xa + ${abilityValue} + ${mod ?? 0}`;
116+
let formula = `${
117+
this.system.general.diceSettings.abilityDie.value
118+
} + ${abilityValue} + ${mod ?? 0}`;
117119
if (abilityValue >= 200)
118120
formula = formula.replace(
119-
this.system.general.diceSettings.abilityDie,
120-
this.system.general.diceSettings.abilityMasteryDie
121+
this.system.general.diceSettings.abilityDie.value,
122+
this.system.general.diceSettings.abilityMasteryDie.value
121123
);
122124
const roll = new ABFFoundryRoll(formula, this.system);
123125
await roll.roll();

src/module/actor/ABFActorSheet.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,18 @@ export default class ABFActorSheet extends ActorSheet {
177177
const label = dataset.label ? `Rolling ${dataset.label}` : '';
178178
const mod = await openModDialog();
179179
let formula = `${dataset.roll}+ ${mod}`;
180-
if (parseInt(dataset.extra) >= 200) formula = formula.replace('xa', 'xamastery');
180+
if (parseInt(dataset.extra) >= 200) {
181+
formula = formula.replace(
182+
this.actor.system.general.diceSettings.abilityDie.value,
183+
this.actor.system.general.diceSettings.abilityMasteryDie.value
184+
);
185+
// let splittedFormula = formula.split(
186+
// this.actor.system.general.diceSettings.abilityDie.value
187+
// );
188+
// formula = splittedFormula.join(
189+
// this.actor.system.general.diceSettings.abilityMasteryDie.value
190+
// );
191+
}
181192
const roll = new ABFFoundryRoll(formula, this.actor.system);
182193

183194
roll.toMessage({

0 commit comments

Comments
 (0)