mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-26 04:19:54 +02:00
[Fix] Improve HP Damage Multiplier Active Effect (#2110)
This commit is contained in:
parent
7fd2a7f17e
commit
82ce2f3052
3 changed files with 49 additions and 3 deletions
|
|
@ -131,7 +131,9 @@ export default class DamageRoll extends DHRoll {
|
|||
|
||||
getActionChangeKeys() {
|
||||
const type = this.options.messageType ?? (this.options.hasHealing ? 'healing' : 'damage');
|
||||
const changeKeys = [];
|
||||
const changeKeys = [
|
||||
'system.rules.attack.damage.hpDamageMultiplier'
|
||||
];
|
||||
|
||||
for (const damageType of this.options.damageFormula?.damageTypes?.values?.() ?? []) {
|
||||
changeKeys.push(`system.bonuses.${type}.${damageType}`);
|
||||
|
|
@ -210,6 +212,22 @@ export default class DamageRoll extends DHRoll {
|
|||
formulaData.roll.terms.push(...this.formatModifier(total));
|
||||
}
|
||||
}
|
||||
|
||||
const damageTakenMultiplier = this.getTotalBonus('system.rules.attack.damage.hpDamageMultiplier');
|
||||
if (damageTakenMultiplier && damageTakenMultiplier !== 1) {
|
||||
// The fully built up roll needs to be set inside of a paranthetical term, so we build the dice anew with all the pushed in terms.
|
||||
// We clone it to avoid infinite recursion.
|
||||
formulaData.roll = Roll.fromTerms(formulaData.roll.terms);
|
||||
|
||||
formulaData.roll.terms = [
|
||||
new foundry.dice.terms.ParentheticalTerm({
|
||||
roll: formulaData.roll.clone(),
|
||||
term: formulaData.formula
|
||||
}),
|
||||
new foundry.dice.terms.OperatorTerm({ operator: '*' }),
|
||||
new foundry.dice.terms.NumericTerm({ number: damageTakenMultiplier })
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
formulaData.roll._formula = this.constructor.getFormula(formulaData.roll.terms);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue