Feature/163 actor subdatas (#346)

* Actor Roll bonuses

* Removed console log and comment

---------

Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
Dapoulp 2025-07-15 15:01:34 +02:00 committed by GitHub
parent 422f28c93c
commit 37c1d7ad88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 210 additions and 103 deletions

View file

@ -74,7 +74,6 @@ export default class D20Roll extends DHRoll {
}
constructFormula(config) {
// this.terms = [];
this.createBaseDice();
this.configureModifiers();
this.resetFormula();
@ -91,7 +90,10 @@ export default class D20Roll extends DHRoll {
configureModifiers() {
this.applyAdvantage();
this.applyBaseBonus();
this.baseTerms = foundry.utils.deepClone(this.terms);
this.options.roll.modifiers = this.applyBaseBonus();
this.options.experiences?.forEach(m => {
if (this.options.data.experiences?.[m])
@ -100,13 +102,8 @@ export default class D20Roll extends DHRoll {
value: this.options.data.experiences[m].value
});
});
this.options.roll.modifiers?.forEach(m => {
this.terms.push(...this.formatModifier(m.value));
});
this.baseTerms = foundry.utils.deepClone(this.terms);
this.addModifiers();
if (this.options.extraFormula) {
this.terms.push(
new foundry.dice.terms.OperatorTerm({ operator: '+' }),
@ -125,13 +122,18 @@ export default class D20Roll extends DHRoll {
}
applyBaseBonus() {
this.options.roll.modifiers = [];
if (!this.options.roll.bonus) return;
this.options.roll.modifiers.push({
label: 'Bonus to Hit',
value: this.options.roll.bonus
// value: Roll.replaceFormulaData('@attackBonus', this.data)
});
const modifiers = [];
if(this.options.roll.bonus)
modifiers.push({
label: 'Bonus to Hit',
value: this.options.roll.bonus
});
modifiers.push(...this.getBonus(`roll.${this.options.type}`, `${this.options.type.capitalize()} Bonus`));
modifiers.push(...this.getBonus(`roll.${this.options.roll.type}`, `${this.options.roll.type.capitalize()} Bonus`));
return modifiers;
}
static async buildEvaluate(roll, config = {}, message = {}) {