mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 02:19:54 +02:00
Fixed so that damageParts without an applyTo field is assumed to be hitPoints
This commit is contained in:
parent
2c1f52413d
commit
29a8f547bb
2 changed files with 9 additions and 0 deletions
|
|
@ -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;
|
||||
}, {});
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ export default class DhCharacter extends DhCreature {
|
|||
parts: {
|
||||
hitPoints: {
|
||||
type: ['physical'],
|
||||
applyTo: 'hitPoints',
|
||||
value: {
|
||||
custom: {
|
||||
enabled: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue