[Hotfix] Fix System Data Conversion Failure 2 (#4159)

This commit is contained in:
Amani H. 2024-09-10 18:05:48 -04:00 committed by GitHub
parent bd4729b4c5
commit 4808c07cf9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -76,7 +76,7 @@ export function applySystemDataPatches(data: SystemSaveData) {
if (data.starterData) { if (data.starterData) {
// Migrate ability starter data if empty for caught species // Migrate ability starter data if empty for caught species
Object.keys(data.starterData).forEach(sd => { 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; data.starterData[sd].abilityAttr = 1;
} }
}); });
@ -104,9 +104,11 @@ export function applySystemDataPatches(data: SystemSaveData) {
// --- PATCHES --- // --- PATCHES ---
// Fix Starter Data // 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; data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
}
if (data.dexData[starterId]?.caughtAttr) {
data.dexData[starterId].caughtAttr |= DexAttr.FEMALE; data.dexData[starterId].caughtAttr |= DexAttr.FEMALE;
} }
} }