mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 08:16:04 +00:00
[Bug] Moved RNG call if the Pokemon's ability hasn't been determined (#3966)
Co-authored-by: frutescens <info@laptop>
This commit is contained in:
parent
8edb9ca65b
commit
c4c9cf939e
@ -133,9 +133,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.scene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
|
this.scene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasHiddenAbility = !Utils.randSeedInt(hiddenAbilityChance.value);
|
|
||||||
const randAbilityIndex = Utils.randSeedInt(2);
|
|
||||||
|
|
||||||
this.species = species;
|
this.species = species;
|
||||||
this.pokeball = dataSource?.pokeball || PokeballType.POKEBALL;
|
this.pokeball = dataSource?.pokeball || PokeballType.POKEBALL;
|
||||||
this.level = level;
|
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
|
this.abilityIndex = abilityIndex; // Use the provided ability index if it is defined
|
||||||
} else {
|
} else {
|
||||||
// If abilityIndex is not provided, determine it based on species and hidden ability
|
// 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 (species.abilityHidden && hasHiddenAbility) {
|
||||||
// If the species has a hidden ability and the hidden ability is present
|
// If the species has a hidden ability and the hidden ability is present
|
||||||
this.abilityIndex = 2;
|
this.abilityIndex = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user