From 4808c07cf9e92714e4b7c0ba77a6b5e96fbe9c34 Mon Sep 17 00:00:00 2001 From: "Amani H." <109637146+xsn34kzx@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:05:48 -0400 Subject: [PATCH] [Hotfix] Fix System Data Conversion Failure 2 (#4159) --- src/system/version-converter.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/system/version-converter.ts b/src/system/version-converter.ts index d54238812c8..f7996124886 100644 --- a/src/system/version-converter.ts +++ b/src/system/version-converter.ts @@ -76,7 +76,7 @@ export function applySystemDataPatches(data: SystemSaveData) { if (data.starterData) { // Migrate ability starter data if empty for caught species Object.keys(data.starterData).forEach(sd => { - if (data.dexData[sd].caughtAttr && !data.starterData[sd].abilityAttr) { + if (data.dexData[sd]?.caughtAttr && (data.starterData[sd] && !data.starterData[sd].abilityAttr)) { data.starterData[sd].abilityAttr = 1; } }); @@ -104,9 +104,11 @@ export function applySystemDataPatches(data: SystemSaveData) { // --- PATCHES --- // Fix Starter Data - if (data.starterData) { - for (const starterId of defaultStarterSpecies) { + for (const starterId of defaultStarterSpecies) { + if (data.starterData[starterId]?.abilityAttr) { data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1; + } + if (data.dexData[starterId]?.caughtAttr) { data.dexData[starterId].caughtAttr |= DexAttr.FEMALE; } }