From 5d2e477744142a1c2906f7843c3dee88ffba96be Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Sun, 16 Mar 2025 13:59:00 +0100 Subject: [PATCH] Removed redundant form index argument in show() of pokedex page --- src/ui/party-ui-handler.ts | 4 +--- src/ui/pokedex-page-ui-handler.ts | 16 ++++++++-------- src/ui/pokedex-ui-handler.ts | 4 ++-- src/ui/starter-select-ui-handler.ts | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 21e5f9077f4..6a9b565989d 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -574,9 +574,7 @@ export default class PartyUiHandler extends MessageUiHandler { form: pokemon.formIndex, female: pokemon.gender === Gender.FEMALE, }; - ui.setOverlayMode(Mode.POKEDEX_PAGE, pokemon.species, pokemon.formIndex, attributes).then(() => - this.clearOptions(), - ); + ui.setOverlayMode(Mode.POKEDEX_PAGE, pokemon.species, attributes).then(() => this.clearOptions()); return true; } else if (option === PartyOption.UNPAUSE_EVOLUTION) { this.clearOptions(); diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 74921f13683..60a872caafc 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -242,6 +242,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler { private starterAttributes: StarterAttributes; private savedStarterAttributes: StarterAttributes; + private previousSpecies: PokemonSpecies[]; + private previousStarterAttributes: StarterAttributes[]; + protected blockInput = false; protected blockInputOverlay = false; @@ -668,14 +671,14 @@ export default class PokedexPageUiHandler extends MessageUiHandler { return false; } this.species = args[0]; - this.formIndex = args[1] ?? 0; - this.savedStarterAttributes = args[2] ?? { + this.savedStarterAttributes = args[1] ?? { shiny: false, female: true, variant: 0, form: 0, }; - this.filteredIndices = args[3] ?? null; + this.formIndex = this.savedStarterAttributes.form ?? 0; + this.filteredIndices = args[2] ?? null; this.starterSetup(); this.moveInfoOverlay.clear(); // clear this when removing a menu; the cancel button doesn't seem to trigger this automatically on controllers @@ -1522,7 +1525,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.savedStarterAttributes.form = newFormIndex; this.moveInfoOverlay.clear(); this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, newSpecies, newFormIndex, this.savedStarterAttributes); + ui.setMode(Mode.POKEDEX_PAGE, newSpecies, this.savedStarterAttributes); return true; }, onHover: () => this.showText(conditionText), @@ -1562,7 +1565,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.savedStarterAttributes.form = newFormIndex; this.moveInfoOverlay.clear(); this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, evoSpecies, newFormIndex, this.savedStarterAttributes); + ui.setMode(Mode.POKEDEX_PAGE, evoSpecies, this.savedStarterAttributes); return true; }, onHover: () => this.showText(conditionText), @@ -1607,7 +1610,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler { ui.setMode( Mode.POKEDEX_PAGE, newSpecies, - newFormIndex, this.savedStarterAttributes, this.filteredIndices, ); @@ -1979,7 +1981,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler { ui.setModeForceTransition( Mode.POKEDEX_PAGE, newSpecies, - newFormIndex, this.savedStarterAttributes, this.filteredIndices, ); @@ -2009,7 +2010,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler { ui.setModeForceTransition( Mode.POKEDEX_PAGE, newSpecies, - newFormIndex, this.savedStarterAttributes, this.filteredIndices, ); diff --git a/src/ui/pokedex-ui-handler.ts b/src/ui/pokedex-ui-handler.ts index f4cb9f51c16..9b3cecb1170 100644 --- a/src/ui/pokedex-ui-handler.ts +++ b/src/ui/pokedex-ui-handler.ts @@ -1125,7 +1125,7 @@ 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, formIndex, { form: formIndex }, this.filteredIndices); + ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, { form: formIndex }, this.filteredIndices); success = true; } else { const numberOfForms = this.trayContainers.length; @@ -1174,7 +1174,7 @@ export default class PokedexUiHandler extends MessageUiHandler { } } else { if (button === Button.ACTION) { - ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, 0, null, this.filteredIndices); + ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, null, this.filteredIndices); success = true; } else { switch (button) { diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index ccc56f38368..ebad8e9ee14 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -2336,7 +2336,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { form: starterAttributes.form, female: starterAttributes.female, }; - ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, starterAttributes.form, attributes); + ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, attributes); }); return true; },