Skip to content

Commit

Permalink
[Hotfix] Fixed the bug where Pokémon with only rare/epic shiny but no…
Browse files Browse the repository at this point in the history
… common shiny were unable to use cycle shiny (pagefaultgames#3593)

* 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
  • Loading branch information
KimJeongSun authored Aug 17, 2024
1 parent 451a1a2 commit 5446040
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ui/starter-select-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 5446040

Please sign in to comment.