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) {
|
static migrateData(source) {
|
||||||
if (source.damage?.parts && Array.isArray(source.damage.parts)) {
|
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) => {
|
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;
|
acc[part.applyTo] = part;
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ export default class DhCharacter extends DhCreature {
|
||||||
parts: {
|
parts: {
|
||||||
hitPoints: {
|
hitPoints: {
|
||||||
type: ['physical'],
|
type: ['physical'],
|
||||||
|
applyTo: 'hitPoints',
|
||||||
value: {
|
value: {
|
||||||
custom: {
|
custom: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue