[Bug] Fix Pokemon in pre-patch saves swapping abilities (#3173)
This commit is contained in:
parent
e98ef1c757
commit
bb005bb506
|
@ -41,6 +41,7 @@ import { Moves } from "#enums/moves";
|
||||||
import { PlayerGender } from "#enums/player-gender";
|
import { PlayerGender } from "#enums/player-gender";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { applyChallenges, ChallengeType } from "#app/data/challenge.js";
|
import { applyChallenges, ChallengeType } from "#app/data/challenge.js";
|
||||||
|
import { Abilities } from "#app/enums/abilities.js";
|
||||||
|
|
||||||
export const defaultStarterSpecies: Species[] = [
|
export const defaultStarterSpecies: Species[] = [
|
||||||
Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE,
|
Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE,
|
||||||
|
@ -851,6 +852,15 @@ export class GameData {
|
||||||
const handleSessionData = async (sessionDataStr: string) => {
|
const handleSessionData = async (sessionDataStr: string) => {
|
||||||
try {
|
try {
|
||||||
const sessionData = this.parseSessionData(sessionDataStr);
|
const sessionData = this.parseSessionData(sessionDataStr);
|
||||||
|
for (let i = 0; i <= 5; i++) {
|
||||||
|
if (sessionData.party[i]?.abilityIndex === 1) {
|
||||||
|
if (allSpecies[sessionData.party[i].species].ability1 === allSpecies[sessionData.party[i].species].ability2 &&
|
||||||
|
allSpecies[sessionData.party[i].species].abilityHidden !== Abilities.NONE &&
|
||||||
|
allSpecies[sessionData.party[i].species].abilityHidden !== allSpecies[sessionData.party[i].species].ability1) {
|
||||||
|
sessionData.party[i].abilityIndex = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
resolve(sessionData);
|
resolve(sessionData);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
|
|
Loading…
Reference in New Issue