[Bug][Hotfix] Restrict Use Candies option in the Pokédex during Shop (#5446)

This commit is contained in:
Wlowscha 2025-02-28 22:22:22 +01:00 committed by GitHub
parent 13429446d3
commit 942bcacb56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 5 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "pokemon-rogue-battle",
"version": "1.7.4",
"version": "1.7.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pokemon-rogue-battle",
"version": "1.7.4",
"version": "1.7.5",
"hasInstallScript": true,
"dependencies": {
"@material/material-color-utilities": "^0.2.7",

View File

@ -1,7 +1,7 @@
{
"name": "pokemon-rogue-battle",
"private": true,
"version": "1.7.4",
"version": "1.7.5",
"type": "module",
"scripts": {
"start": "vite",

View File

@ -250,6 +250,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
private availableVariants: number;
private unlockedVariants: boolean[];
private canUseCandies: boolean;
constructor() {
super(Mode.POKEDEX_PAGE);
}
@ -556,6 +558,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
show(args: any[]): boolean {
// Allow the use of candies if we are in one of the whitelisted phases
this.canUseCandies = [ "TitlePhase", "SelectStarterPhase", "CommandPhase" ].includes(globalScene.getCurrentPhase()?.constructor.name ?? "");
if (args.length >= 1 && args[0] === "refresh") {
return false;
} else {
@ -1626,7 +1631,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
}
break;
case Button.STATS:
if (!isCaught || !isFormCaught) {
if (!isCaught || !isFormCaught || !this.canUseCandies) {
error = true;
} else {
const ui = this.getUi();
@ -1888,7 +1893,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
if (this.isCaught()) {
if (isFormCaught) {
if (this.canUseCandies) {
this.updateButtonIcon(SettingKeyboard.Button_Stats, gamepadType, this.candyUpgradeIconElement, this.candyUpgradeLabel);
}
if (this.canCycleShiny) {
this.updateButtonIcon(SettingKeyboard.Button_Cycle_Shiny, gamepadType, this.shinyIconElement, this.shinyLabel);
}