Base forms are counted as caught when catching a battle form

This commit is contained in:
Wlowscha 2025-02-20 23:38:59 +01:00
parent 5b1950a1ae
commit 681503a36b
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -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";
export const defaultStarterSpecies: Species[] = [
Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE,
@ -1625,11 +1626,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