mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-18 14:22:19 +02:00
Setting up filteredFormIndices
This commit is contained in:
parent
2e2f61ff5d
commit
a2c4f7eaf4
@ -257,7 +257,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
private menuDescriptions: string[];
|
||||
private isFormGender: boolean;
|
||||
private filteredIndices: Species[] | null = null;
|
||||
private filteredFormIndices: number[] | null = null;
|
||||
private filteredFormIndices: (number | null)[] | null = null;
|
||||
private filteredIndex: number;
|
||||
|
||||
private availableVariants: number;
|
||||
private unlockedVariants: boolean[];
|
||||
@ -699,9 +700,21 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.starterAttributes = this.initStarterPrefs();
|
||||
|
||||
console.log(this.filteredIndices);
|
||||
console.log(this.filteredFormIndices);
|
||||
console.log(this.savedStarterAttributes);
|
||||
console.log(this.starterAttributes);
|
||||
|
||||
if (this.filteredIndices) {
|
||||
this.filteredIndex = this.filteredIndices.findIndex(id => id === this.species.speciesId);
|
||||
}
|
||||
|
||||
if (this.filteredFormIndices) {
|
||||
const newForm = this.filteredFormIndices[this.filteredIndex];
|
||||
if (!isNullOrUndefined(newForm)) {
|
||||
this.starterAttributes.form = newForm;
|
||||
}
|
||||
}
|
||||
|
||||
this.menuOptions = Utils.getEnumKeys(MenuOptions).map(m => Number.parseInt(MenuOptions[m]) as MenuOptions);
|
||||
|
||||
this.menuContainer.setVisible(true);
|
||||
@ -984,7 +997,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
const caughtAttr = this.isCaught();
|
||||
|
||||
// no preferences or Pokemon wasn't caught, return empty attribute
|
||||
if (!starterAttributes || !caughtAttr) {
|
||||
if (!starterAttributes || !this.isSeen()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -1681,11 +1694,15 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.savedStarterAttributes.form = newFormIndex;
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
if (this.filteredFormIndices) {
|
||||
this.filteredFormIndices[this.filteredIndex] = null;
|
||||
}
|
||||
ui.setMode(
|
||||
Mode.POKEDEX_PAGE,
|
||||
newSpecies,
|
||||
this.savedStarterAttributes,
|
||||
this.filteredIndices,
|
||||
this.filteredFormIndices,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
@ -2062,6 +2079,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
newSpecies,
|
||||
this.savedStarterAttributes,
|
||||
this.filteredIndices,
|
||||
this.filteredFormIndices,
|
||||
);
|
||||
});
|
||||
this.blockInput = false;
|
||||
@ -2096,6 +2114,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
newSpecies,
|
||||
this.savedStarterAttributes,
|
||||
this.filteredIndices,
|
||||
this.filteredFormIndices,
|
||||
);
|
||||
});
|
||||
break;
|
||||
|
@ -220,6 +220,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
||||
private showFormTrayLabel: Phaser.GameObjects.Text;
|
||||
private canShowFormTray: boolean;
|
||||
private filteredIndices: Species[];
|
||||
private filteredFormIndices: Species[];
|
||||
|
||||
constructor() {
|
||||
super(Mode.POKEDEX);
|
||||
@ -1029,7 +1030,13 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
||||
} else if (this.showingTray) {
|
||||
if (button === Button.ACTION) {
|
||||
const formIndex = this.trayForms[this.trayCursor].formIndex;
|
||||
ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, { form: formIndex }, this.filteredIndices);
|
||||
ui.setOverlayMode(
|
||||
Mode.POKEDEX_PAGE,
|
||||
this.lastSpecies,
|
||||
{ form: formIndex },
|
||||
this.filteredIndices,
|
||||
this.filteredFormIndices,
|
||||
);
|
||||
success = true;
|
||||
} else {
|
||||
const numberOfForms = this.trayContainers.length;
|
||||
@ -1079,7 +1086,13 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
||||
} else {
|
||||
if (button === Button.ACTION) {
|
||||
const formIndex = this.pokemonContainers[this.cursor]?.formIndex;
|
||||
ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, { form: formIndex }, this.filteredIndices);
|
||||
ui.setOverlayMode(
|
||||
Mode.POKEDEX_PAGE,
|
||||
this.lastSpecies,
|
||||
{ form: formIndex },
|
||||
this.filteredIndices,
|
||||
this.filteredFormIndices,
|
||||
);
|
||||
success = true;
|
||||
} else {
|
||||
switch (button) {
|
||||
@ -1589,6 +1602,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
||||
});
|
||||
|
||||
this.filteredIndices = this.filteredPokemonData.map(c => c.species.speciesId);
|
||||
this.filteredFormIndices = this.filteredPokemonData.map(c => c.formIndex);
|
||||
|
||||
this.updateScroll();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user