diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 6b25013795f..57e25325ba4 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -55,6 +55,7 @@ import { MysteryEncounterSaveData } from "#app/data/mystery-encounters/mystery-e import type { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import { ArenaTrapTag } from "#app/data/arena-tag"; +import { pokemonFormChanges } from "#app/data/pokemon-forms"; import type { Type } from "#enums/type"; export const defaultStarterSpecies: Species[] = [ @@ -1629,11 +1630,29 @@ export class GameData { const caughtAttr = dexEntry.caughtAttr; const formIndex = pokemon.formIndex; const dexAttr = pokemon.getDexAttr(); - pokemon.formIndex = formIndex; // Mark as caught 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 if (speciesStarterCosts.hasOwnProperty(species.speciesId)) { this.starterData[species.speciesId].abilityAttr |= pokemon.abilityIndex !== 1 || pokemon.species.ability2 diff --git a/src/ui/pokedex-ui-handler.ts b/src/ui/pokedex-ui-handler.ts index 1ba1b846224..6b8fdc41539 100644 --- a/src/ui/pokedex-ui-handler.ts +++ b/src/ui/pokedex-ui-handler.ts @@ -1207,7 +1207,7 @@ export default class PokedexUiHandler extends MessageUiHandler { shiny: false, female: props.female, variant: 0, - formIndex: 0, + formIndex: props.formIndex, }; return sanitizedProps; } @@ -1906,7 +1906,7 @@ export default class PokedexUiHandler extends MessageUiHandler { const dexEntry = globalScene.gameData.dexData[species.speciesId]; 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))); if (shiny === undefined) {