diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index d8acddecedf..16ad96f61cc 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -133,9 +133,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.scene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance); } - const hasHiddenAbility = !Utils.randSeedInt(hiddenAbilityChance.value); - const randAbilityIndex = Utils.randSeedInt(2); - this.species = species; this.pokeball = dataSource?.pokeball || PokeballType.POKEBALL; this.level = level; @@ -146,6 +143,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.abilityIndex = abilityIndex; // Use the provided ability index if it is defined } else { // If abilityIndex is not provided, determine it based on species and hidden ability + const hasHiddenAbility = !Utils.randSeedInt(hiddenAbilityChance.value); + const randAbilityIndex = Utils.randSeedInt(2); if (species.abilityHidden && hasHiddenAbility) { // If the species has a hidden ability and the hidden ability is present this.abilityIndex = 2;