mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 22:46:12 +01:00
Added migration for overleveled companions
This commit is contained in:
parent
2fcad0ff25
commit
b52bfa8a87
1 changed files with 16 additions and 0 deletions
|
|
@ -212,6 +212,7 @@ export async function runMigrations() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundry.utils.isNewerVersion('1.5.5', lastMigrationVersion)) {
|
if (foundry.utils.isNewerVersion('1.5.5', lastMigrationVersion)) {
|
||||||
|
/* Clear out Environments that were added directly from compendium */
|
||||||
for (const scene of game.scenes) {
|
for (const scene of game.scenes) {
|
||||||
if (!scene.flags.daggerheart) continue;
|
if (!scene.flags.daggerheart) continue;
|
||||||
const systemData = new game.system.api.data.scenes.DHScene(scene.flags.daggerheart);
|
const systemData = new game.system.api.data.scenes.DHScene(scene.flags.daggerheart);
|
||||||
|
|
@ -224,6 +225,21 @@ export async function runMigrations() {
|
||||||
|
|
||||||
ui.nav.render(true);
|
ui.nav.render(true);
|
||||||
|
|
||||||
|
/* Delevel any companions that are higher level than their partner character */
|
||||||
|
for (const companion of game.actors.filter(x => x.type === 'companion')) {
|
||||||
|
if (companion.system.levelData.level.current <= 1) continue;
|
||||||
|
|
||||||
|
if (!companion.system.partner) {
|
||||||
|
await companion.updateLevel(1);
|
||||||
|
} else {
|
||||||
|
const endLevel = companion.system.partner.system.levelData.level.current;
|
||||||
|
if (endLevel < companion.system.levelData.level.current) {
|
||||||
|
companion.system.levelData.level.changed = companion.system.levelData.level.current;
|
||||||
|
await companion.updateLevel(endLevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lastMigrationVersion = '1.5.5';
|
lastMigrationVersion = '1.5.5';
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue