mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-05-03 06:54:34 +01:00
[BUG] Base forms are now counted as caught when catching a battle form (#5385)
* Base forms are counted as caught when catching a battle form * Ensuring that correct form shows up in Pokédex Index
This commit is contained in:
parent
0cb3a28dfa
commit
cc7e1af827
@ -55,6 +55,7 @@ import { MysteryEncounterSaveData } from "#app/data/mystery-encounters/mystery-e
|
|||||||
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||||
import { ArenaTrapTag } from "#app/data/arena-tag";
|
import { ArenaTrapTag } from "#app/data/arena-tag";
|
||||||
|
import { pokemonFormChanges } from "#app/data/pokemon-forms";
|
||||||
import type { Type } from "#enums/type";
|
import type { Type } from "#enums/type";
|
||||||
|
|
||||||
export const defaultStarterSpecies: Species[] = [
|
export const defaultStarterSpecies: Species[] = [
|
||||||
@ -1629,11 +1630,29 @@ export class GameData {
|
|||||||
const caughtAttr = dexEntry.caughtAttr;
|
const caughtAttr = dexEntry.caughtAttr;
|
||||||
const formIndex = pokemon.formIndex;
|
const formIndex = pokemon.formIndex;
|
||||||
const dexAttr = pokemon.getDexAttr();
|
const dexAttr = pokemon.getDexAttr();
|
||||||
pokemon.formIndex = formIndex;
|
|
||||||
|
|
||||||
// Mark as caught
|
// Mark as caught
|
||||||
dexEntry.caughtAttr |= dexAttr;
|
dexEntry.caughtAttr |= dexAttr;
|
||||||
|
|
||||||
|
// If the caught form is a battleform, we want to also mark the base form as caught.
|
||||||
|
// This snippet assumes that the base form has formIndex equal to 0, which should be
|
||||||
|
// always true except for the case of Urshifu.
|
||||||
|
const formKey = pokemon.getFormKey();
|
||||||
|
if (formIndex > 0) {
|
||||||
|
if (pokemon.species.speciesId === Species.URSHIFU) {
|
||||||
|
if (formIndex === 2) {
|
||||||
|
dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(0);
|
||||||
|
} else if (formIndex === 3) {
|
||||||
|
dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allFormChanges = pokemonFormChanges.hasOwnProperty(species.speciesId) ? pokemonFormChanges[species.speciesId] : [];
|
||||||
|
const toCurrentFormChanges = allFormChanges.filter(f => (f.formKey === formKey));
|
||||||
|
if (toCurrentFormChanges.length > 0) {
|
||||||
|
dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Unlock ability
|
// Unlock ability
|
||||||
if (speciesStarterCosts.hasOwnProperty(species.speciesId)) {
|
if (speciesStarterCosts.hasOwnProperty(species.speciesId)) {
|
||||||
this.starterData[species.speciesId].abilityAttr |= pokemon.abilityIndex !== 1 || pokemon.species.ability2
|
this.starterData[species.speciesId].abilityAttr |= pokemon.abilityIndex !== 1 || pokemon.species.ability2
|
||||||
|
@ -1207,7 +1207,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||||||
shiny: false,
|
shiny: false,
|
||||||
female: props.female,
|
female: props.female,
|
||||||
variant: 0,
|
variant: 0,
|
||||||
formIndex: 0,
|
formIndex: props.formIndex,
|
||||||
};
|
};
|
||||||
return sanitizedProps;
|
return sanitizedProps;
|
||||||
}
|
}
|
||||||
@ -1906,7 +1906,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||||||
const dexEntry = globalScene.gameData.dexData[species.speciesId];
|
const dexEntry = globalScene.gameData.dexData[species.speciesId];
|
||||||
const caughtAttr = dexEntry.caughtAttr & globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)].caughtAttr & species.getFullUnlocksData();
|
const caughtAttr = dexEntry.caughtAttr & globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)].caughtAttr & species.getFullUnlocksData();
|
||||||
|
|
||||||
if (!caughtAttr) {
|
if (caughtAttr) {
|
||||||
const props = this.getSanitizedProps(globalScene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)));
|
const props = this.getSanitizedProps(globalScene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)));
|
||||||
|
|
||||||
if (shiny === undefined) {
|
if (shiny === undefined) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user