made roll modifier in percentile dialog persistent

This commit is contained in:
TheLastScrub
2024-07-29 13:11:51 -07:00
parent 94053f2a4d
commit 6eb0890a4c
+19 -1
View File
@@ -132,11 +132,21 @@ export class DGPercentileRoll extends DGRoll {
hideSanTarget = true;
}
let customModifierTarget = 20;
if (this.actor != null) {
try {
customModifierTarget = parseInt(
this.actor.system.settings.rolling.defaultPercentileModifier,
);
} catch {}
}
const backingData = {
data: {
label: this.localizedKey,
originalTarget: this.target,
targetModifier: 20,
targetModifier: customModifierTarget,
hideTarget: hideSanTarget,
},
};
@@ -172,6 +182,14 @@ export class DGPercentileRoll extends DGRoll {
if (plusMinus === "-") {
targetModifier *= -1;
}
// update the custom target modifier so it 'persists' between dialogs
if (this.actor != null) {
this.actor.update({
"system.settings.rolling.defaultPercentileModifier":
targetModifier,
});
}
}
resolve({ targetModifier, rollMode });
} catch (ex) {