From 6de5e7ebc6903f901c840aad74c9037ef5be01a1 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 20 Oct 2023 19:07:47 -0400 Subject: [PATCH] Fix crash when generating trainer party member --- src/trainer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trainer.ts b/src/trainer.ts index a945b2958..3d520ae55 100644 --- a/src/trainer.ts +++ b/src/trainer.ts @@ -146,7 +146,7 @@ export default class Trainer extends Phaser.GameObjects.Container { const tierValue = Utils.randSeedInt(512); let tier = tierValue >= 156 ? TrainerPoolTier.COMMON : tierValue >= 32 ? TrainerPoolTier.UNCOMMON : tierValue >= 6 ? TrainerPoolTier.RARE : tierValue >= 1 ? TrainerPoolTier.SUPER_RARE : TrainerPoolTier.ULTRA_RARE console.log(TrainerPoolTier[tier]); - while (!this.config.speciesPools[tier].length) { + while (!this.config.speciesPools.hasOwnProperty(tier) || !this.config.speciesPools[tier].length) { console.log(`Downgraded trainer Pokemon rarity tier from ${TrainerPoolTier[tier]} to ${TrainerPoolTier[tier - 1]}`); tier--; }