mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-27 17:26:11 +00:00
[P1] Fix System Data Conversion Failure 3 (#4866)
* [P1] Fix System Data Conversion Failure 3 * Use `isNullOrUndefined`, Clean Up Imports * fix pre candy update save data migration for candy * fix pre candy update save data migration for candy part 2... --------- Co-authored-by: Moka <millennium.stitcher@gmail.com>
This commit is contained in:
parent
4aff2ffa1d
commit
c22b48f903
@ -506,9 +506,9 @@ export class GameData {
|
|||||||
|
|
||||||
const starterIds = Object.keys(this.starterData).map(s => parseInt(s) as Species);
|
const starterIds = Object.keys(this.starterData).map(s => parseInt(s) as Species);
|
||||||
for (const s of starterIds) {
|
for (const s of starterIds) {
|
||||||
this.starterData[s].candyCount += this.dexData[s].caughtCount;
|
this.starterData[s].candyCount += systemData.dexData[s].caughtCount;
|
||||||
this.starterData[s].candyCount += this.dexData[s].hatchedCount * 2;
|
this.starterData[s].candyCount += systemData.dexData[s].hatchedCount * 2;
|
||||||
if (this.dexData[s].caughtAttr & DexAttr.SHINY) {
|
if (systemData.dexData[s].caughtAttr & DexAttr.SHINY) {
|
||||||
this.starterData[s].candyCount += 4;
|
this.starterData[s].candyCount += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { SettingKeys } from "../../settings/settings";
|
import { SettingKeys } from "#app/system/settings/settings";
|
||||||
import { AbilityAttr, defaultStarterSpecies, DexAttr, SystemSaveData, SessionSaveData } from "../../game-data";
|
import { AbilityAttr, defaultStarterSpecies, DexAttr, SystemSaveData, SessionSaveData } from "#app/system/game-data";
|
||||||
import { allSpecies } from "../../../data/pokemon-species";
|
import { allSpecies } from "#app/data/pokemon-species";
|
||||||
|
import { isNullOrUndefined } from "#app/utils";
|
||||||
|
|
||||||
export const systemMigrators = [
|
export const systemMigrators = [
|
||||||
/**
|
/**
|
||||||
@ -46,12 +47,14 @@ export const systemMigrators = [
|
|||||||
* @param data {@linkcode SystemSaveData}
|
* @param data {@linkcode SystemSaveData}
|
||||||
*/
|
*/
|
||||||
function fixStarterData(data: SystemSaveData) {
|
function fixStarterData(data: SystemSaveData) {
|
||||||
for (const starterId of defaultStarterSpecies) {
|
if (!isNullOrUndefined(data.starterData)) {
|
||||||
if (data.starterData[starterId]?.abilityAttr) {
|
for (const starterId of defaultStarterSpecies) {
|
||||||
data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
|
if (data.starterData[starterId]?.abilityAttr) {
|
||||||
}
|
data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
|
||||||
if (data.dexData[starterId]?.caughtAttr) {
|
}
|
||||||
data.dexData[starterId].caughtAttr |= DexAttr.FEMALE;
|
if (data.dexData[starterId]?.caughtAttr) {
|
||||||
|
data.dexData[starterId].caughtAttr |= DexAttr.FEMALE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user