mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 04:44:16 +02:00
Went ahead and made IncludeItemDamage work again, smashing the formulas together
This commit is contained in:
parent
e6d5a2f7d3
commit
e420dcbf18
5 changed files with 53 additions and 54 deletions
|
|
@ -12,8 +12,20 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
super.prepareData();
|
||||
if (!!this.item?.system?.attack) {
|
||||
if (this.damage.includeBase) {
|
||||
const baseDamage = this.getParentDamage();
|
||||
this.damage.parts.hitPoints = new DHDamageData(baseDamage);
|
||||
const baseDamage = this.getParentHitPointDamage();
|
||||
if(baseDamage) {
|
||||
if (!this.damage.parts.hitPoints) {
|
||||
this.damage.parts.hitPoints = baseDamage;
|
||||
} else {
|
||||
for (const type of baseDamage.type)
|
||||
this.damage.parts.hitPoints.type.add(type);
|
||||
|
||||
this.damage.parts.hitPoints.value.custom = {
|
||||
enabled: true,
|
||||
formula: `${baseDamage.value.getFormula()} + ${this.damage.parts.hitPoints.value.getFormula()}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.roll.useDefault) {
|
||||
this.roll.trait = this.item.system.attack.roll.trait;
|
||||
|
|
@ -22,16 +34,8 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
}
|
||||
}
|
||||
|
||||
getParentDamage() {
|
||||
return {
|
||||
value: {
|
||||
multiplier: 'prof',
|
||||
dice: this.item?.system?.attack.damage.parts.hitPoints.value.dice,
|
||||
bonus: this.item?.system?.attack.damage.parts.hitPoints.value.bonus ?? 0
|
||||
},
|
||||
type: this.item?.system?.attack.damage.parts.hitPoints.type,
|
||||
base: true
|
||||
};
|
||||
getParentHitPointDamage() {
|
||||
return this.item?.system?.attack.damage.parts.hitPoints;
|
||||
}
|
||||
|
||||
get damageFormula() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue