This commit is contained in:
WBHarry 2026-02-23 23:12:12 +01:00
parent 340abbc98c
commit ef128b88eb
19 changed files with 80 additions and 203 deletions

View file

@ -89,14 +89,14 @@ export default class DhpAdversary extends DhCreature {
type: 'attack'
},
damage: {
parts: [
{
parts: {
hitPoints: {
type: ['physical'],
value: {
multiplier: 'flat'
}
}
]
}
}
}
}),
@ -374,13 +374,9 @@ export default class DhpAdversary extends DhCreature {
* @returns the converted formula and value as a simplified term
*/
#adjustActionDamage(action, damageMeta) {
// The current algorithm only returns a value if there is a single damage part
const hpDamageParts = action.damage.parts.filter(d => d.applyTo === 'hitPoints');
if (hpDamageParts.length !== 1) throw new Error('incorrect number of hp parts');
const result = {};
for (const property of ['value', 'valueAlt']) {
const data = hpDamageParts[0][property];
const data = action.damage.parts.hitPoints[property];
const previousFormula = data.custom.enabled
? data.custom.formula
: [data.flatMultiplier ? `${data.flatMultiplier}${data.dice}` : 0, data.bonus ?? 0]

View file

@ -118,8 +118,8 @@ export default class DhCharacter extends DhCreature {
trait: 'strength'
},
damage: {
parts: [
{
parts: {
hitPoints: {
type: ['physical'],
value: {
custom: {
@ -128,7 +128,7 @@ export default class DhCharacter extends DhCreature {
}
}
}
]
}
}
}
}),
@ -704,7 +704,7 @@ export default class DhCharacter extends DhCreature {
isReversed: true
};
this.attack.damage.parts[0].value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
this.attack.damage.parts.hitPoints.value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
}
getRollData() {

View file

@ -85,15 +85,15 @@ export default class DhCompanion extends DhCreature {
bonus: 0
},
damage: {
parts: [
{
parts: {
hitPoints: {
type: ['physical'],
value: {
dice: 'd6',
multiplier: 'prof'
}
}
]
}
}
}
}),
@ -138,7 +138,9 @@ export default class DhCompanion extends DhCreature {
break;
case 'vicious':
if (selection.data[0] === 'damage') {
this.attack.damage.parts[0].value.dice = adjustDice(this.attack.damage.parts[0].value.dice);
this.attack.damage.parts.hitPoints.value.dice = adjustDice(
this.attack.damage.parts.hitPoints.value.dice
);
} else {
this.attack.range = adjustRange(this.attack.range).id;
}