// SPDX-FileCopyrightText: 2021 Johannes Loher // // SPDX-License-Identifier: MIT import { getSceneMigrator, migrateCollection, migrateCompendiums, getCompendiumMigrator } from "./migrationHelpers.js"; /** @type {import("./migration.js").Migration["migrate"]} */ async function migrate() { await migrateCollection(game.actors, migrateActor); await migrateCollection(game.scenes, migrateScene); await migrateCompendiums(migrateCompendium); } /** @type {import('./migrationHelpers.js').Migrator} */ async function migrateActor(actor) { await actor.update({ system: { combatValues: [ "hitPoints", "defense", "initiative", "movement", "meleeAttack", "rangedAttack", "spellcasting", "targetedSpellcasting", ].reduce((acc, curr) => { acc[curr] = { "-=base": null }; return acc; }, {}), }, }); } const migrateScene = getSceneMigrator(migrateActor); const migrateCompendium = getCompendiumMigrator({ migrateActor, migrateScene }); /** @type {import("./migration.js").Migration} */ export const migration = { migrate, migrateCompendium, };