// SPDX-FileCopyrightText: 2021 Johannes Loher // // SPDX-License-Identifier: MIT import { getGame } from "../helpers"; import logger from "../logger"; export async function migrate(): Promise { for (const a of getGame().actors?.contents ?? []) { const updateData = getActorUpdateData(); logger.info(`Migrating actor ${a.name}`); await a.update(updateData); } } function getActorUpdateData(): Record { const updateData = { data: { combatValues: [ "hitPoints", "defense", "initiative", "movement", "meleeAttack", "rangedAttack", "spellcasting", "targetedSpellcasting", ].reduce((acc: Partial>, curr) => { acc[curr] = { "-=base": null }; return acc; }, {}), }, }; return updateData; }