mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-21 07:42:25 +02:00
Ensure that gender forms loop correctly with either button
This commit is contained in:
parent
5b1950a1ae
commit
82da65efb8
@ -246,6 +246,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;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(Mode.POKEDEX_PAGE);
|
super(Mode.POKEDEX_PAGE);
|
||||||
@ -628,6 +629,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];
|
||||||
@ -1586,8 +1589,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;
|
||||||
@ -1595,7 +1605,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…
Reference in New Issue
Block a user