Properly showing evolution text for Dunsparce and Maushold

This commit is contained in:
Wlowscha 2025-01-25 10:02:42 +01:00
parent 24a3a0bf8a
commit 23ae686f56
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
2 changed files with 29 additions and 16 deletions

View File

@ -1396,7 +1396,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
], ],
[Species.TANDEMAUS]: [ [Species.TANDEMAUS]: [
new SpeciesFormEvolution(Species.MAUSHOLD, "", "three", 25, null, new TandemausEvolutionCondition()), new SpeciesFormEvolution(Species.MAUSHOLD, "", "three", 25, null, new TandemausEvolutionCondition()),
new SpeciesEvolution(Species.MAUSHOLD, 25, null, null) new SpeciesFormEvolution(Species.MAUSHOLD, "", "four", 25, null, null)
], ],
[Species.FIDOUGH]: [ [Species.FIDOUGH]: [
new SpeciesEvolution(Species.DACHSBUN, 26, null, null) new SpeciesEvolution(Species.DACHSBUN, 26, null, null)
@ -1559,7 +1559,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
], ],
[Species.DUNSPARCE]: [ [Species.DUNSPARCE]: [
new SpeciesFormEvolution(Species.DUDUNSPARCE, "", "three-segment", 32, null, new DunsparceEvolutionCondition(), SpeciesWildEvolutionDelay.LONG), new SpeciesFormEvolution(Species.DUDUNSPARCE, "", "three-segment", 32, null, new DunsparceEvolutionCondition(), SpeciesWildEvolutionDelay.LONG),
new SpeciesEvolution(Species.DUDUNSPARCE, 32, null, new MoveEvolutionCondition(Moves.HYPER_DRILL), SpeciesWildEvolutionDelay.LONG) new SpeciesFormEvolution(Species.DUDUNSPARCE, "", "two-segment", 32, null, new MoveEvolutionCondition(Moves.HYPER_DRILL), SpeciesWildEvolutionDelay.LONG)
], ],
[Species.GLIGAR]: [ [Species.GLIGAR]: [
new SpeciesEvolution(Species.GLISCOR, 1, EvolutionItem.RAZOR_FANG, new TimeOfDayEvolutionCondition("night") /* Razor fang at night*/, SpeciesWildEvolutionDelay.VERY_LONG) new SpeciesEvolution(Species.GLISCOR, 1, EvolutionItem.RAZOR_FANG, new TimeOfDayEvolutionCondition("night") /* Razor fang at night*/, SpeciesWildEvolutionDelay.VERY_LONG)

View File

@ -665,7 +665,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
) )
) )
// This takes care of Burmy, Shellos etc // This takes care of Burmy, Shellos etc
|| e.evoFormKey === species.forms[formIndex]?.formKey) || e.evoFormKey === species.forms[formIndex]?.formKey
)
); );
} }
} }
@ -731,12 +732,24 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
return biomes; return biomes;
} }
isFormCaught(): boolean { /**
const allFormChanges = pokemonFormChanges.hasOwnProperty(this.species.speciesId) ? pokemonFormChanges[this.species.speciesId] : []; * Check whether a given form is caught for a given species.
// This shows battle forms such as megas and gmax as unlocked. * All forms that can be reached through a form change during battle
const formChangeAccess = allFormChanges.filter(f => (f.formKey === this.species.forms[this.formIndex].formKey)).length > 0; * are considered caught and show up in the dex as such.
const isFormCaught = this.speciesStarterDexEntry ? *
(this.speciesStarterDexEntry.caughtAttr & globalScene.gameData.getFormAttr(this.formIndex ?? 0)) > 0n || formChangeAccess * @param otherSpecies The species to check; defaults to current species
* @param otherFormIndex The form index of the form to check; defaults to current form
* @returns StarterAttributes for the species
*/
isFormCaught(otherSpecies?: PokemonSpecies, otherFormIndex?: integer | undefined): boolean {
const species = otherSpecies ? otherSpecies : this.species;
const formIndex = otherFormIndex !== undefined ? otherFormIndex : this.formIndex;
const dexEntry = globalScene.gameData.dexData[species.speciesId];
const allFormChanges = pokemonFormChanges.hasOwnProperty(species.speciesId) ? pokemonFormChanges[species.speciesId] : [];
const formChangeAccess = allFormChanges.filter(f => (f.formKey === species.forms[formIndex].formKey)).length > 0;
const isFormCaught = dexEntry ?
(dexEntry.caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n || formChangeAccess
: false; : false;
return isFormCaught; return isFormCaught;
} }
@ -1355,6 +1368,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
const evoSpecies = allSpecies.find(species => species.speciesId === evo.speciesId); const evoSpecies = allSpecies.find(species => species.speciesId === evo.speciesId);
const evoSpeciesStarterDexEntry = evoSpecies ? globalScene.gameData.dexData[evoSpecies.speciesId] : null; const evoSpeciesStarterDexEntry = evoSpecies ? globalScene.gameData.dexData[evoSpecies.speciesId] : null;
const isCaughtEvo = evoSpeciesStarterDexEntry?.caughtAttr ? true : false; const isCaughtEvo = evoSpeciesStarterDexEntry?.caughtAttr ? true : false;
// Attempts to find the formIndex of the evolved species
const newFormKey = evo.evoFormKey ? evo.evoFormKey : (this.species.forms.length > 0 ? this.species.forms[this.formIndex].formKey : "");
const matchingForm = evoSpecies?.forms.find(form => form.formKey === newFormKey);
const newFormIndex = matchingForm ? matchingForm.formIndex : 0;
const isFormCaughtEvo = this.isFormCaught(evoSpecies, newFormIndex);
const conditionText: string = evo.description; const conditionText: string = evo.description;
@ -1362,18 +1380,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
label: evo.evoFormKey ? label: evo.evoFormKey ?
this.getFormString(evo.evoFormKey, evoSpecies ?? this.species, true) : this.getFormString(evo.evoFormKey, evoSpecies ?? this.species, true) :
this.getRegionName(evoSpecies ?? this.species), this.getRegionName(evoSpecies ?? this.species),
style: isCaughtEvo ? TextStyle.WINDOW : TextStyle.SHADOW_TEXT, style: isCaughtEvo && isFormCaughtEvo ? TextStyle.WINDOW : TextStyle.SHADOW_TEXT,
handler: () => { handler: () => {
const newSpecies = allSpecies.find(species => species.speciesId === evo.speciesId);
// Attempts to find the formIndex of the evolved species
const newFormKey = evo.evoFormKey ? evo.evoFormKey : (this.species.forms.length > 0 ? this.species.forms[this.formIndex].formKey : "");
const matchingForm = newSpecies?.forms.find(form => form.formKey === newFormKey);
const newFormIndex = matchingForm ? matchingForm.formIndex : 0;
this.starterAttributes.form = newFormIndex; this.starterAttributes.form = newFormIndex;
this.savedStarterAttributes.form = newFormIndex; this.savedStarterAttributes.form = newFormIndex;
this.moveInfoOverlay.clear(); this.moveInfoOverlay.clear();
this.clearText(); this.clearText();
ui.setMode(Mode.POKEDEX_PAGE, newSpecies, newFormIndex, this.savedStarterAttributes); ui.setMode(Mode.POKEDEX_PAGE, evoSpecies, newFormIndex, this.savedStarterAttributes);
return true; return true;
}, },
onHover: () => this.showText(conditionText) onHover: () => this.showText(conditionText)