From 4809a68ae6bd1ffb7d6ff2015a7554fc70f5aeff Mon Sep 17 00:00:00 2001 From: WBHarry Date: Sun, 8 Mar 2026 15:51:10 +0100 Subject: [PATCH] Added Homebrew setting migration --- module/data/settings/Homebrew.mjs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/module/data/settings/Homebrew.mjs b/module/data/settings/Homebrew.mjs index b8804fa7..618413b0 100644 --- a/module/data/settings/Homebrew.mjs +++ b/module/data/settings/Homebrew.mjs @@ -183,6 +183,24 @@ export default class DhHomebrew extends foundry.abstract.DataModel { const initial = this.schema.fields.currency.fields[type].getInitialValue(); source.currency[type] = foundry.utils.mergeObject(initial, source.currency[type], { inplace: false }); } + + /* Migrate to v14 setup */ + const migrateEffects = features => { + for (const featureKey of Object.keys(features)) { + const feature = features[featureKey]; + for (const effect of feature.effects) { + if (effect.changes) effect.system.changes = effect.changes; + if (!effect.system.changes) effect.system.changes = []; + if (!effect.system.conditionals) effect.system.conditionals = []; + } + } + }; + + migrateEffects(source.restMoves.longRest.moves); + migrateEffects(source.restMoves.shortRest.moves); + migrateEffects(source.itemFeatures.weaponFeatures); + migrateEffects(source.itemFeatures.armorFeatures); + return source; } }