mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-03-01 15:39:08 +00:00
[UI/UX] Pokedex - Ensure gender forms loop correctly with either button (#5387)
This commit is contained in:
parent
4128d09a1d
commit
b95bedce7a
@ -244,6 +244,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
private menuOptions: MenuOptions[];
|
private menuOptions: MenuOptions[];
|
||||||
protected scale: number = 0.1666666667;
|
protected scale: number = 0.1666666667;
|
||||||
private menuDescriptions: string[];
|
private menuDescriptions: string[];
|
||||||
|
private isFormGender: boolean;
|
||||||
private filteredIndices: Species[] | null = null;
|
private filteredIndices: Species[] | null = null;
|
||||||
|
|
||||||
private availableVariants: number;
|
private availableVariants: number;
|
||||||
@ -633,6 +634,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
this.tmMoves = speciesTmMoves[species.speciesId]?.filter(m => Array.isArray(m) ? (m[0] === formKey ? true : false ) : true)
|
this.tmMoves = speciesTmMoves[species.speciesId]?.filter(m => Array.isArray(m) ? (m[0] === formKey ? true : false ) : true)
|
||||||
.map(m => Array.isArray(m) ? m[1] : m).sort((a, b) => allMoves[a].name > allMoves[b].name ? 1 : -1) ?? [];
|
.map(m => Array.isArray(m) ? m[1] : m).sort((a, b) => allMoves[a].name > allMoves[b].name ? 1 : -1) ?? [];
|
||||||
|
|
||||||
|
this.isFormGender = formKey === "male" || formKey === "female";
|
||||||
|
|
||||||
const passiveId = starterPassiveAbilities.hasOwnProperty(species.speciesId) ? species.speciesId :
|
const passiveId = starterPassiveAbilities.hasOwnProperty(species.speciesId) ? species.speciesId :
|
||||||
starterPassiveAbilities.hasOwnProperty(this.starterId) ? this.starterId : pokemonPrevolutions[this.starterId];
|
starterPassiveAbilities.hasOwnProperty(this.starterId) ? this.starterId : pokemonPrevolutions[this.starterId];
|
||||||
const passives = starterPassiveAbilities[passiveId];
|
const passives = starterPassiveAbilities[passiveId];
|
||||||
@ -1593,8 +1596,15 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
starterAttributes.form = newFormIndex; // store the selected form
|
starterAttributes.form = newFormIndex; // store the selected form
|
||||||
this.savedStarterAttributes.form = starterAttributes.form;
|
this.savedStarterAttributes.form = starterAttributes.form;
|
||||||
this.formIndex = newFormIndex;
|
this.formIndex = newFormIndex;
|
||||||
|
// Some forms are tied to the gender and should change accordingly
|
||||||
|
let newFemale = props.female;
|
||||||
|
if (this.isFormGender) {
|
||||||
|
newFemale = !props.female;
|
||||||
|
}
|
||||||
|
starterAttributes.female = newFemale;
|
||||||
|
this.savedStarterAttributes.female = starterAttributes.female;
|
||||||
this.starterSetup();
|
this.starterSetup();
|
||||||
this.setSpeciesDetails(this.species, { formIndex: newFormIndex });
|
this.setSpeciesDetails(this.species, { formIndex: newFormIndex, female: newFemale });
|
||||||
success = this.setCursor(this.cursor);
|
success = this.setCursor(this.cursor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1602,7 +1612,16 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
if (this.canCycleGender) {
|
if (this.canCycleGender) {
|
||||||
starterAttributes.female = !props.female;
|
starterAttributes.female = !props.female;
|
||||||
this.savedStarterAttributes.female = starterAttributes.female;
|
this.savedStarterAttributes.female = starterAttributes.female;
|
||||||
this.setSpeciesDetails(this.species, { female: !props.female });
|
let newFormIndex = this.formIndex;
|
||||||
|
// Some forms are tied to the gender and should change accordingly
|
||||||
|
if (this.isFormGender) {
|
||||||
|
newFormIndex = this.formIndex === 0 ? 1 : 0;
|
||||||
|
}
|
||||||
|
starterAttributes.form = newFormIndex; // store the selected form
|
||||||
|
this.savedStarterAttributes.form = starterAttributes.form;
|
||||||
|
this.formIndex = newFormIndex;
|
||||||
|
this.starterSetup();
|
||||||
|
this.setSpeciesDetails(this.species, { female: !props.female, formIndex: newFormIndex });
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user