Fixed so that damageParts without an applyTo field is assumed to be hitPoints

This commit is contained in:
WBHarry 2026-06-27 15:14:13 +02:00
parent 2c1f52413d
commit 29a8f547bb
2 changed files with 9 additions and 0 deletions

View file

@ -447,7 +447,15 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
static migrateData(source) {
if (source.damage?.parts && Array.isArray(source.damage.parts)) {
let hitPointsExists = source.damage.parts.some(x => x.applyTo === 'hitPoints');
source.damage.parts = source.damage.parts.reduce((acc, part) => {
if (!part.applyTo && hitPointsExists) return acc;
if (!part.applyTo) {
hitPointsExists = true;
part.applyTo = 'hitPoints';
}
acc[part.applyTo] = part;
return acc;
}, {});