[Bug][UI/UX] Dex bug fixes 12 feb (#5307)

* Fixed bug when setting tint of eggs for egg move filter

* Form text is properly hidden when going to filters

* Displaying level up moves of alternate forms

* Offsetting form cycle button when uncaught text is shown

* Pokedex buttons now appear on mobile touchpad

* Hotfix to prevent "Normal" form to showing the text

* Preventing filter texts from showing gibberish

* Moving cursor to input text when pressing on filter

* Introducing method to get full obtainable unlocks for a given species

* Filtering obtainable unlocks in dex

* Buying eggs in dex does not crash the game

* Shiny icon does not overlap with luck text for evolutions

* Shiny is maintained correctly when cycling through different pages

* Displacing text elements to avoid overlap for localized form names

* Checking starter caughtAttr in addition to pokemon caughtAttr
This commit is contained in:
Wlowscha 2025-02-13 04:14:22 +01:00 committed by GitHub
parent 595413edd7
commit be0f3b2ab3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 127 additions and 47 deletions

View File

@ -164,13 +164,13 @@ input:-internal-autofill-selected {
}
/* Show cycle buttons only on STARTER_SELECT and on touch configuration panel */
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadOpenFilters,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='RUN_INFO']) #apadCycleForm,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='RUN_INFO']) #apadCycleShiny,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='POKEDEX'], [data-ui-mode='POKEDEX_PAGE']) #apadOpenFilters,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='POKEDEX'], [data-ui-mode='POKEDEX_PAGE'], [data-ui-mode='RUN_INFO']) #apadCycleForm,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='POKEDEX'], [data-ui-mode='POKEDEX_PAGE'], [data-ui-mode='RUN_INFO']) #apadCycleShiny,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleNature,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='RUN_INFO']) #apadCycleAbility,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleGender,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleVariant {
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='POKEDEX_PAGE'], [data-ui-mode='RUN_INFO']) #apadCycleAbility,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='POKEDEX_PAGE']) #apadCycleGender,
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='POKEDEX']) #apadCycleVariant {
display: none;
}

View File

@ -7,7 +7,7 @@ import i18next from "i18next";
import type { AnySound } from "#app/battle-scene";
import { globalScene } from "#app/global-scene";
import type { GameMode } from "#app/game-mode";
import type { StarterMoveset } from "#app/system/game-data";
import { DexAttr, type StarterMoveset } from "#app/system/game-data";
import * as Utils from "#app/utils";
import { uncatchableSpecies } from "#app/data/balance/biomes";
import { speciesEggMoves } from "#app/data/balance/egg-moves";
@ -32,6 +32,37 @@ export enum Region {
PALDEA
}
// TODO: this is horrible and will need to be removed once a refactor/cleanup of forms is executed.
export const normalForm: Species[] = [
Species.PIKACHU,
Species.RAICHU,
Species.EEVEE,
Species.JOLTEON,
Species.FLAREON,
Species.VAPOREON,
Species.ESPEON,
Species.UMBREON,
Species.LEAFEON,
Species.GLACEON,
Species.SYLVEON,
Species.PICHU,
Species.ROTOM,
Species.DIALGA,
Species.PALKIA,
Species.KYUREM,
Species.GENESECT,
Species.FROAKIE,
Species.FROGADIER,
Species.GRENINJA,
Species.ROCKRUFF,
Species.NECROZMA,
Species.MAGEARNA,
Species.MARSHADOW,
Species.CRAMORANT,
Species.ZARUDE,
Species.CALYREX
];
/**
* Gets the {@linkcode PokemonSpecies} object associated with the {@linkcode Species} enum given
* @param species The species to fetch
@ -997,6 +1028,33 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
? this.forms[formIndex || 0].getFormSpriteKey()
: "";
}
/**
* Generates a {@linkcode bigint} corresponding to the maximum unlocks possible for this species,
* taking into account if the species has a male/female gender, and which variants are implemented.
* @returns {@linkcode bigint} Maximum unlocks, can be compared with {@linkcode DexEntry.caughtAttr}.
*/
getFullUnlocksData(): bigint {
let caughtAttr: bigint = 0n;
caughtAttr += DexAttr.NON_SHINY;
caughtAttr += DexAttr.SHINY;
if (this.malePercent !== null) {
if (this.malePercent > 0) {
caughtAttr += DexAttr.MALE;
}
if (this.malePercent < 100) {
caughtAttr += DexAttr.FEMALE;
}
}
caughtAttr += DexAttr.DEFAULT_VARIANT;
if (this.hasVariants()) {
caughtAttr += DexAttr.VARIANT_2;
caughtAttr += DexAttr.VARIANT_3;
}
caughtAttr += DexAttr.DEFAULT_FORM;
return caughtAttr;
}
}
export class PokemonForm extends PokemonSpeciesForm {

View File

@ -133,7 +133,7 @@ export class FilterText extends Phaser.GameObjects.Container {
const handler = ui.getHandler() as AwaitableUiHandler;
handler.tutorialActive = true;
// Switch to the dialog test window
this.selections[index].setText(String(i18next.t(dialogueName)));
this.selections[index].setText( dialogueName === "" ? this.defaultText : String(i18next.t(dialogueName)));
ui.revertMode();
this.onChange();
},

View File

@ -16,7 +16,7 @@ import { pokemonFormChanges } from "#app/data/pokemon-forms";
import type { LevelMoves } from "#app/data/balance/pokemon-level-moves";
import { pokemonFormLevelMoves, pokemonSpeciesLevelMoves } from "#app/data/balance/pokemon-level-moves";
import type PokemonSpecies from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpeciesForm, normalForm } from "#app/data/pokemon-species";
import { getStarterValueFriendshipCap, speciesStarterCosts } from "#app/data/balance/starters";
import { starterPassiveAbilities } from "#app/data/balance/passives";
import { Type } from "#enums/type";
@ -383,7 +383,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.pokemonHatchedIcon.setScale(0.8);
this.pokemonCaughtHatchedContainer.add(this.pokemonHatchedIcon);
this.pokemonShinyIcon = globalScene.add.sprite(14, 76, "shiny_icons");
this.pokemonShinyIcon = globalScene.add.sprite(14, 117, "shiny_icons");
this.pokemonShinyIcon.setOrigin(0.15, 0.2);
this.pokemonShinyIcon.setScale(1);
this.pokemonCaughtHatchedContainer.add(this.pokemonShinyIcon);
@ -601,7 +601,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
const form = species.forms[formIndex];
// If this form has a specific set of moves, we get them.
this.levelMoves = (formIndex > 0 && pokemonFormLevelMoves.hasOwnProperty(formIndex)) ? pokemonFormLevelMoves[species.speciesId][formIndex] : pokemonSpeciesLevelMoves[species.speciesId];
this.levelMoves = (formIndex > 0 && pokemonFormLevelMoves.hasOwnProperty(species.speciesId) && pokemonFormLevelMoves[species.speciesId].hasOwnProperty(formIndex)) ? pokemonFormLevelMoves[species.speciesId][formIndex] : pokemonSpeciesLevelMoves[species.speciesId];
this.ability1 = form.ability1;
this.ability2 = (form.ability2 === form.ability1) ? undefined : form.ability2;
this.abilityHidden = (form.abilityHidden === form.ability1) ? undefined : form.abilityHidden;
@ -741,14 +741,16 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
return biomes;
}
isCaught(otherSpeciesDexEntry?: DexEntry): bigint {
isCaught(otherSpecies?: PokemonSpecies): bigint {
if (globalScene.dexForDevs) {
return 255n;
}
const dexEntry = otherSpeciesDexEntry ? otherSpeciesDexEntry : this.speciesStarterDexEntry;
const species = otherSpecies ? otherSpecies : this.species;
const dexEntry = globalScene.gameData.dexData[species.speciesId];
const starterDexEntry = globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)];
return dexEntry?.caughtAttr ?? 0n;
return (dexEntry?.caughtAttr ?? 0n) & (starterDexEntry?.caughtAttr ?? 0n) & species.getFullUnlocksData();
}
/**
* Check whether a given form is caught for a given species.
@ -765,11 +767,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
}
const species = otherSpecies ? otherSpecies : this.species;
const formIndex = otherFormIndex !== undefined ? otherFormIndex : this.formIndex;
const dexEntry = globalScene.gameData.dexData[species.speciesId];
const caughtAttr = this.isCaught(species);
const isFormCaught = dexEntry ?
(dexEntry.caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n
: false;
const isFormCaught = (caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n;
return isFormCaught;
}
@ -783,8 +783,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
*/
initStarterPrefs(): StarterAttributes {
const starterAttributes : StarterAttributes | null = this.species ? { ...this.savedStarterAttributes } : null;
const dexEntry = globalScene.gameData.dexData[this.species.speciesId];
const caughtAttr = this.isCaught(dexEntry);
const caughtAttr = this.isCaught();
// no preferences or Pokemon wasn't caught, return empty attribute
if (!starterAttributes || !caughtAttr) {
@ -1235,7 +1234,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
case MenuOptions.BIOMES:
if (!(this.isCaught() || this.speciesStarterDexEntry?.seenAttr)) {
if (!(isCaught || this.speciesStarterDexEntry?.seenAttr)) {
error = true;
} else {
this.blockInput = true;
@ -1372,8 +1371,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
});
this.evolutions.map(evo => {
const evoSpecies = allSpecies.find(species => species.speciesId === evo.speciesId);
const evoSpeciesStarterDexEntry = evoSpecies ? globalScene.gameData.dexData[evoSpecies.speciesId] : undefined;
const isCaughtEvo = this.isCaught(evoSpeciesStarterDexEntry) ? true : false;
const isCaughtEvo = this.isCaught(evoSpecies) ? 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);
@ -1535,6 +1533,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.pokemonShinyIcon.setVisible(true);
starterAttributes.shiny = true;
this.savedStarterAttributes.shiny = starterAttributes.shiny;
} else {
let newVariant = props.variant;
do {
@ -1688,7 +1687,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
}
this.pokemonCandyCountText.setText(`x${starterData.candyCount}`);
const egg = new Egg({ scene: globalScene, species: this.species.speciesId, sourceType: EggSourceType.SAME_SPECIES_EGG });
const egg = new Egg({ scene: globalScene, species: this.starterId, sourceType: EggSourceType.SAME_SPECIES_EGG });
egg.addEggToGameData();
globalScene.gameData.saveSystem().then(success => {
@ -1856,6 +1855,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
if (this.canCycleGender) {
this.updateButtonIcon(SettingKeyboard.Button_Cycle_Gender, gamepadType, this.genderIconElement, this.genderLabel);
}
} else {
// Making space for "Uncaught" text
this.instructionRowY += 8;
}
if (this.canCycleForm) {
this.updateButtonIcon(SettingKeyboard.Button_Cycle_Form, gamepadType, this.formIconElement, this.formLabel);
@ -2093,7 +2095,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
if (species) {
const dexEntry = globalScene.gameData.dexData[species.speciesId];
const caughtAttr = this.isCaught(dexEntry);
const caughtAttr = this.isCaught(species);
if (!caughtAttr) {
const props = this.starterAttributes;
@ -2240,13 +2242,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.pokemonCandyContainer.setVisible(true);
if (pokemonPrevolutions.hasOwnProperty(species.speciesId)) {
this.pokemonShinyIcon.setY(135);
this.pokemonShinyIcon.setFrame(getVariantIcon(variant));
this.pokemonHatchedIcon.setVisible(false);
this.pokemonHatchedCountText.setVisible(false);
this.pokemonFormText.setY(36);
} else {
this.pokemonShinyIcon.setY(117);
this.pokemonHatchedIcon.setVisible(true);
this.pokemonHatchedCountText.setVisible(true);
this.pokemonFormText.setY(42);
@ -2276,7 +2276,12 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
if (isFormCaught || isFormSeen) {
const speciesForm = getPokemonSpeciesForm(species.speciesId, formIndex!); // TODO: is the bang correct?
this.setTypeIcons(speciesForm.type1, speciesForm.type2);
this.pokemonFormText.setText(species.getFormNameToDisplay(formIndex));
// TODO: change this once forms are refactored
if (normalForm.includes(species.speciesId) && !formIndex) {
this.pokemonFormText.setText("");
} else {
this.pokemonFormText.setText(species.getFormNameToDisplay(formIndex));
}
this.pokemonFormText.setVisible(true);
if (!isFormCaught) {
this.pokemonFormText.setY(18);
@ -2321,7 +2326,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
*/
getCurrentDexProps(speciesId: number): bigint {
let props = 0n;
const caughtAttr = globalScene.gameData.dexData[speciesId].caughtAttr;
const species = allSpecies.find(sp => sp.speciesId === speciesId);
const caughtAttr = globalScene.gameData.dexData[speciesId].caughtAttr & globalScene.gameData.dexData[this.getStarterSpeciesId(speciesId)].caughtAttr & (species?.getFullUnlocksData() ?? 0n);
/* this checks the gender of the pokemon; this works by checking a) that the starter preferences for the species exist, and if so, is it female. If so, it'll add DexAttr.FEMALE to our temp props
* It then checks b) if the caughtAttr for the pokemon is female and NOT male - this means that the ONLY gender we've gotten is female, and we need to add DexAttr.FEMALE to our temp props

View File

@ -115,6 +115,10 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
this.reduceKeys();
setTimeout(() => {
input.setFocus(); // Focus after a short delay to avoid unwanted input
}, 50);
input.on("keydown", (inputObject, evt: KeyboardEvent) => {
if ([ "escape", "space" ].some((v) => v === evt.key.toLowerCase() || v === evt.code.toLowerCase()) && ui.getMode() === Mode.AUTO_COMPLETE) {
// Delete autocomplete list and recovery focus.
@ -169,7 +173,8 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
this.submitAction = (_) => {
if (ui.getMode() === Mode.POKEDEX_SCAN) {
this.sanitizeInputs();
const sanitizedName = btoa(unescape(encodeURIComponent(this.inputs[0].text)));
const outputName = this.reducedKeys.includes(this.inputs[0].text) ? this.inputs[0].text : "";
const sanitizedName = btoa(unescape(encodeURIComponent(outputName)));
config.buttonActions[0](sanitizedName);
return true;
}

View File

@ -7,7 +7,7 @@ import { speciesEggMoves } from "#app/data/balance/egg-moves";
import { pokemonFormLevelMoves, pokemonSpeciesLevelMoves } from "#app/data/balance/pokemon-level-moves";
import type { PokemonForm } from "#app/data/pokemon-species";
import type PokemonSpecies from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpeciesForm, getPokerusStarters } from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpeciesForm, getPokerusStarters, normalForm } from "#app/data/pokemon-species";
import { getStarterValueFriendshipCap, speciesStarterCosts, POKERUS_STARTER_COUNT } from "#app/data/balance/starters";
import { catchableSpecies } from "#app/data/balance/biomes";
import { Type } from "#enums/type";
@ -411,15 +411,15 @@ export default class PokedexUiHandler extends MessageUiHandler {
this.iconAnimHandler = new PokemonIconAnimHandler();
this.iconAnimHandler.setup();
this.pokemonNumberText = addTextObject(6, 140, "", TextStyle.SUMMARY);
this.pokemonNumberText = addTextObject(6, 141, "", TextStyle.SUMMARY);
this.pokemonNumberText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonNumberText);
this.pokemonNameText = addTextObject(6, 127, "", TextStyle.SUMMARY);
this.pokemonNameText = addTextObject(6, 128, "", TextStyle.SUMMARY);
this.pokemonNameText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonNameText);
this.pokemonFormText = addTextObject(6, 122, "", TextStyle.PARTY, { fontSize: textSettings.instructionTextSize });
this.pokemonFormText = addTextObject(6, 121, "", TextStyle.PARTY, { fontSize: textSettings.instructionTextSize });
this.pokemonFormText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonFormText);
@ -565,7 +565,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
this.starterPreferences[species.speciesId] = this.initStarterPrefs(species);
if (dexEntry.caughtAttr || globalScene.dexForDevs) {
if ((dexEntry.caughtAttr & species.getFullUnlocksData()) || globalScene.dexForDevs) {
icon.clearTint();
} else if (dexEntry.seenAttr) {
icon.setTint(0x808080);
@ -606,7 +606,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
return {};
}
const caughtAttr = dexEntry.caughtAttr;
const caughtAttr = dexEntry.caughtAttr & species.getFullUnlocksData();
const hasShiny = caughtAttr & DexAttr.SHINY;
const hasNonShiny = caughtAttr & DexAttr.NON_SHINY;
@ -1255,7 +1255,9 @@ export default class PokedexUiHandler extends MessageUiHandler {
// First, ensure you have the caught attributes for the species else default to bigint 0
// TODO: This might be removed depending on how accessible we want the pokedex function to be
const caughtAttr = globalScene.gameData.dexData[container.species.speciesId]?.caughtAttr || BigInt(0);
const caughtAttr = (globalScene.gameData.dexData[container.species.speciesId]?.caughtAttr || BigInt(0)) &
(globalScene.gameData.dexData[this.getStarterSpeciesId(container.species.speciesId)]?.caughtAttr || BigInt(0)) &
container.species.getFullUnlocksData();
const starterData = globalScene.gameData.starterData[starterId];
const isStarterProgressable = speciesEggMoves.hasOwnProperty(starterId);
@ -1292,7 +1294,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
if (fitsEggMove1 && !fitsLevelMove1) {
container.eggMove1Icon.setVisible(true);
const em1 = eggMoves.findIndex(name => name === selectedMove1);
if ((starterData[starterId].eggMoves & (1 << em1)) === 0) {
if ((starterData.eggMoves & (1 << em1)) === 0) {
container.eggMove1Icon.setTint(0x808080);
} else {
container.eggMove1Icon.clearTint();
@ -1303,7 +1305,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
if (fitsEggMove2 && !fitsLevelMove2) {
container.eggMove2Icon.setVisible(true);
const em2 = eggMoves.findIndex(name => name === selectedMove2);
if ((starterData[starterId].eggMoves & (1 << em2)) === 0) {
if ((starterData.eggMoves & (1 << em2)) === 0) {
container.eggMove2Icon.setTint(0x808080);
} else {
container.eggMove2Icon.clearTint();
@ -1580,11 +1582,12 @@ export default class PokedexUiHandler extends MessageUiHandler {
}
const speciesId = container.species.speciesId;
const caughtAttr = globalScene.gameData.dexData[speciesId].caughtAttr & globalScene.gameData.dexData[this.getStarterSpeciesId(speciesId)].caughtAttr & container.species.getFullUnlocksData();
this.updateStarterValueLabel(container);
container.label.setVisible(true);
const speciesVariants = speciesId && globalScene.gameData.dexData[speciesId].caughtAttr & DexAttr.SHINY
? [ DexAttr.DEFAULT_VARIANT, DexAttr.VARIANT_2, DexAttr.VARIANT_3 ].filter(v => !!(globalScene.gameData.dexData[speciesId].caughtAttr & v))
const speciesVariants = speciesId && caughtAttr & DexAttr.SHINY
? [ DexAttr.DEFAULT_VARIANT, DexAttr.VARIANT_2, DexAttr.VARIANT_3 ].filter(v => !!(caughtAttr & v))
: [];
for (let v = 0; v < 3; v++) {
const hasVariant = speciesVariants.length > v;
@ -1595,7 +1598,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
}
container.starterPassiveBgs.setVisible(!!globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)].passiveAttr);
container.hiddenAbilityIcon.setVisible(!!globalScene.gameData.dexData[speciesId].caughtAttr && !!(globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)].abilityAttr & 4));
container.hiddenAbilityIcon.setVisible(!!caughtAttr && !!(globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)].abilityAttr & 4));
container.classicWinIcon.setVisible(globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)].classicWinCount > 0);
container.favoriteIcon.setVisible(this.starterPreferences[speciesId]?.favorite ?? false);
@ -1729,7 +1732,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
this.trayContainers = [];
this.trayForms.map((f, index) => {
const isFormCaught = dexEntry ? (dexEntry.caughtAttr & globalScene.gameData.getFormAttr(f.formIndex ?? 0)) > 0n : false;
const isFormCaught = dexEntry ? (dexEntry.caughtAttr & species.getFullUnlocksData() & globalScene.gameData.getFormAttr(f.formIndex ?? 0)) > 0n : false;
const isFormSeen = dexEntry ? (dexEntry.seenAttr & globalScene.gameData.getFormAttr(f.formIndex ?? 0)) > 0n : false;
const formContainer = new PokedexMonContainer(species, { formIndex: f.formIndex, female: props.female, shiny: props.shiny, variant: props.variant });
this.iconAnimHandler.addOrUpdate(formContainer.icon, PokemonIconAnimMode.NONE);
@ -1866,6 +1869,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
} else {
this.pokemonNumberText.setText(species ? i18next.t("pokedexUiHandler:pokemonNumber") + padInt(species.speciesId, 4) : "");
this.pokemonNameText.setText(species ? "???" : "");
this.pokemonFormText.setText("");
this.type1Icon.setVisible(false);
this.type2Icon.setVisible(false);
if (species) {
@ -1899,8 +1903,9 @@ export default class PokedexUiHandler extends MessageUiHandler {
if (species) {
const dexEntry = globalScene.gameData.dexData[species.speciesId];
const caughtAttr = dexEntry.caughtAttr & globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)].caughtAttr & species.getFullUnlocksData();
if (!dexEntry.caughtAttr) {
if (!caughtAttr) {
const props = this.getSanitizedProps(globalScene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)));
if (shiny === undefined) {
@ -1917,7 +1922,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
}
}
const isFormCaught = dexEntry ? (dexEntry.caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n : false;
const isFormCaught = dexEntry ? (caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n : false;
const isFormSeen = dexEntry ? (dexEntry.seenAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n : false;
const assetLoadCancelled = new BooleanHolder(false);
@ -1949,7 +1954,12 @@ export default class PokedexUiHandler extends MessageUiHandler {
}
if (isFormCaught || isFormSeen || globalScene.dexForDevs) {
this.pokemonFormText.setText(species.getFormNameToDisplay(formIndex, false));
// TODO: change this once forms are refactored
if (normalForm.includes(species.speciesId) && !formIndex) {
this.pokemonFormText.setText("");
} else {
this.pokemonFormText.setText(species.getFormNameToDisplay(formIndex, false));
}
} else {
this.pokemonFormText.setText("");
}
@ -2054,7 +2064,8 @@ export default class PokedexUiHandler extends MessageUiHandler {
*/
getCurrentDexProps(speciesId: number): bigint {
let props = 0n;
const caughtAttr = globalScene.gameData.dexData[speciesId].caughtAttr;
const species = allSpecies.find(sp => sp.speciesId === speciesId);
const caughtAttr = globalScene.gameData.dexData[speciesId].caughtAttr & globalScene.gameData.dexData[this.getStarterSpeciesId(speciesId)].caughtAttr & (species?.getFullUnlocksData() ?? 0n);
/* this checks the gender of the pokemon; this works by checking a) that the starter preferences for the species exist, and if so, is it female. If so, it'll add DexAttr.FEMALE to our temp props
* It then checks b) if the caughtAttr for the pokemon is female and NOT male - this means that the ONLY gender we've gotten is female, and we need to add DexAttr.FEMALE to our temp props