mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 02:19:54 +02:00
[Fix] V13 Migration Fixes (#2044)
* Fixed so that damageParts without an applyTo field is assumed to be hitPoints * Added the applyTo field to the basic attack for Adversaries and Companions * Tentative blindfix to issues of entities being null. Can't replicate it * Added some safety for missing things if someone was on a REALLY old system version and then updated all the way * Moved v13 countdown migration over to a migrateData * .
This commit is contained in:
parent
1ebbad4797
commit
9c58f7058e
6 changed files with 61 additions and 51 deletions
|
|
@ -451,7 +451,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;
|
||||
}, {});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue