From 54460405b1fb2eaca881a915a93c28b950f95e9f Mon Sep 17 00:00:00 2001 From: Leo Kim <47556641+KimJeongSun@users.noreply.github.com> Date: Sun, 18 Aug 2024 03:36:25 +0900 Subject: [PATCH] =?UTF-8?q?[Hotfix]=20Fixed=20the=20bug=20where=20Pok?= =?UTF-8?q?=C3=A9mon=20with=20only=20rare/epic=20shiny=20but=20no=20common?= =?UTF-8?q?=20shiny=20were=20unable=20to=20use=20cycle=20shiny=20(#3593)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed the bug where Pokémon with only rare/epic shiny but no common shiny were unable to use cycle shiny * remove unecessary log * fix condition --- src/ui/starter-select-ui-handler.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 03a13e7661a..de56e69f65c 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -2975,7 +2975,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler { starterSprite.setTexture(species.getIconAtlasKey(formIndex, shiny, variant), species.getIconId(female!, formIndex, shiny, variant)); currentFilteredContainer.checkIconId(female, formIndex, shiny, variant); } - this.canCycleShiny = !!(dexEntry.caughtAttr & DexAttr.NON_SHINY && dexEntry.caughtAttr & DexAttr.SHINY); + // First, ensure you have the caught attributes for the species else default to bigint 0 + const caughtVariants = this.scene.gameData.dexData[species.speciesId]?.caughtAttr || BigInt(0); + // Define the variables based on whether their respective variants have been caught + const isVariant3Caught = !!(caughtVariants & DexAttr.VARIANT_3); + const isVariant2Caught = !!(caughtVariants & DexAttr.VARIANT_2); + const isVariantCaught = !!(caughtVariants & DexAttr.SHINY); + + this.canCycleShiny = isVariantCaught || isVariant2Caught || isVariant3Caught; this.canCycleGender = !!(dexEntry.caughtAttr & DexAttr.MALE && dexEntry.caughtAttr & DexAttr.FEMALE); this.canCycleAbility = [ abilityAttr & AbilityAttr.ABILITY_1, (abilityAttr & AbilityAttr.ABILITY_2) && species.ability2, abilityAttr & AbilityAttr.ABILITY_HIDDEN ].filter(a => a).length > 1; this.canCycleForm = species.forms.filter(f => f.isStarterSelectable || !pokemonFormChanges[species.speciesId]?.find(fc => fc.formKey))