mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 16:26:25 +00:00
[Bug] fix starter select crash when a variant preference is incorrect (#4209)
This commit is contained in:
parent
8409f39b8d
commit
48c2bdf1d8
@ -995,15 +995,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
delete starterAttributes.shiny;
|
delete starterAttributes.shiny;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (starterAttributes.variant !== undefined && !isNaN(starterAttributes.variant)) {
|
if (starterAttributes.variant !== undefined) {
|
||||||
const unlockedVariants = [
|
const unlockedVariants = [
|
||||||
hasNonShiny,
|
|
||||||
hasShiny && caughtAttr & DexAttr.DEFAULT_VARIANT,
|
hasShiny && caughtAttr & DexAttr.DEFAULT_VARIANT,
|
||||||
hasShiny && caughtAttr & DexAttr.VARIANT_2,
|
hasShiny && caughtAttr & DexAttr.VARIANT_2,
|
||||||
hasShiny && caughtAttr & DexAttr.VARIANT_3
|
hasShiny && caughtAttr & DexAttr.VARIANT_3
|
||||||
];
|
];
|
||||||
if (!unlockedVariants[starterAttributes.variant + 1]) { // add 1 as -1 = non-shiny
|
if (isNaN(starterAttributes.variant) || starterAttributes.variant < 0 || !unlockedVariants[starterAttributes.variant]) {
|
||||||
// requested variant wasn't unlocked, purging setting
|
// variant value is invalid or requested variant wasn't unlocked, purging setting
|
||||||
delete starterAttributes.variant;
|
delete starterAttributes.variant;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user