mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-05-03 06:54:34 +01:00
[BUG] Fix broken forms of Pichu starter (#5616)
* Unlock base Pichu form when catching a Pikachu form * Implementing migrator for broken Pichu forms
This commit is contained in:
parent
db7ed43ad7
commit
c6721521ab
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "pokemon-rogue-battle",
|
"name": "pokemon-rogue-battle",
|
||||||
"version": "1.8.2",
|
"version": "1.8.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pokemon-rogue-battle",
|
"name": "pokemon-rogue-battle",
|
||||||
"version": "1.8.2",
|
"version": "1.8.3",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@material/material-color-utilities": "^0.2.7",
|
"@material/material-color-utilities": "^0.2.7",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "pokemon-rogue-battle",
|
"name": "pokemon-rogue-battle",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.8.2",
|
"version": "1.8.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vite",
|
"start": "vite",
|
||||||
|
@ -1793,7 +1793,9 @@ export class GameData {
|
|||||||
const dexEntry = this.dexData[species.speciesId];
|
const dexEntry = this.dexData[species.speciesId];
|
||||||
const caughtAttr = dexEntry.caughtAttr;
|
const caughtAttr = dexEntry.caughtAttr;
|
||||||
const formIndex = pokemon.formIndex;
|
const formIndex = pokemon.formIndex;
|
||||||
const dexAttr = pokemon.getDexAttr();
|
|
||||||
|
// This makes sure that we do not try to unlock data which cannot be unlocked
|
||||||
|
const dexAttr = pokemon.getDexAttr() & species.getFullUnlocksData();
|
||||||
|
|
||||||
// Mark as caught
|
// Mark as caught
|
||||||
dexEntry.caughtAttr |= dexAttr;
|
dexEntry.caughtAttr |= dexAttr;
|
||||||
@ -1803,6 +1805,10 @@ export class GameData {
|
|||||||
// always true except for the case of Urshifu.
|
// always true except for the case of Urshifu.
|
||||||
const formKey = pokemon.getFormKey();
|
const formKey = pokemon.getFormKey();
|
||||||
if (formIndex > 0) {
|
if (formIndex > 0) {
|
||||||
|
// In case a Pikachu with formIndex > 0 was unlocked, base form Pichu is also unlocked
|
||||||
|
if (pokemon.species.speciesId === Species.PIKACHU && species.speciesId === Species.PICHU) {
|
||||||
|
dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(0);
|
||||||
|
}
|
||||||
if (pokemon.species.speciesId === Species.URSHIFU) {
|
if (pokemon.species.speciesId === Species.URSHIFU) {
|
||||||
if (formIndex === 2) {
|
if (formIndex === 2) {
|
||||||
dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(0);
|
dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(0);
|
||||||
|
@ -10,6 +10,9 @@ import * as v1_1_0 from "./versions/v1_1_0";
|
|||||||
// --- v1.7.0 PATCHES --- //
|
// --- v1.7.0 PATCHES --- //
|
||||||
import * as v1_7_0 from "./versions/v1_7_0";
|
import * as v1_7_0 from "./versions/v1_7_0";
|
||||||
|
|
||||||
|
// --- v1.8.3 PATCHES --- //
|
||||||
|
import * as v1_8_3 from "./versions/v1_8_3";
|
||||||
|
|
||||||
const LATEST_VERSION = version.split(".").map(value => Number.parseInt(value));
|
const LATEST_VERSION = version.split(".").map(value => Number.parseInt(value));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -174,6 +177,12 @@ class SystemVersionConverter extends VersionConverter {
|
|||||||
console.log("Applying v1.7.0 system data migration!");
|
console.log("Applying v1.7.0 system data migration!");
|
||||||
this.callMigrators(data, v1_7_0.systemMigrators);
|
this.callMigrators(data, v1_7_0.systemMigrators);
|
||||||
}
|
}
|
||||||
|
if (curMinor === 8) {
|
||||||
|
if (curPatch <= 2) {
|
||||||
|
console.log("Applying v1.8.3 system data migration!");
|
||||||
|
this.callMigrators(data, v1_8_3.systemMigrators);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`System data successfully migrated to v${version}!`);
|
console.log(`System data successfully migrated to v${version}!`);
|
||||||
|
30
src/system/version_migration/versions/v1_8_3.ts
Normal file
30
src/system/version_migration/versions/v1_8_3.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||||
|
import { DexAttr, type SystemSaveData } from "#app/system/game-data";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
|
||||||
|
export const systemMigrators = [
|
||||||
|
/**
|
||||||
|
* If a starter is caught, but the only forms registered as caught are not starterSelectable,
|
||||||
|
* unlock the default form.
|
||||||
|
* @param data {@linkcode SystemSaveData}
|
||||||
|
*/
|
||||||
|
function migratePichuForms(data: SystemSaveData) {
|
||||||
|
if (data.starterData && data.dexData) {
|
||||||
|
// This is Pichu's Pokédex number
|
||||||
|
const sd = 172;
|
||||||
|
const caughtAttr = data.dexData[sd]?.caughtAttr;
|
||||||
|
const species = getPokemonSpecies(sd);
|
||||||
|
// An extra check because you never know
|
||||||
|
if (species.speciesId === Species.PICHU && caughtAttr) {
|
||||||
|
// Ensuring that only existing forms are unlocked
|
||||||
|
data.dexData[sd].caughtAttr &= species.getFullUnlocksData();
|
||||||
|
// If no forms are unlocked now, since Pichu is caught, we unlock form 0
|
||||||
|
data.dexData[sd].caughtAttr |= DexAttr.DEFAULT_FORM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export const settingsMigrators = [] as const;
|
||||||
|
|
||||||
|
export const sessionMigrators = [] as const;
|
Loading…
x
Reference in New Issue
Block a user