mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-16 14:55:22 +01:00
[Misc] Ability Charms no longer affect the number of RNG rolls (#6652)
This commit is contained in:
parent
904086c73a
commit
95cc9f6d49
@ -604,20 +604,18 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
|
||||
/** Generate `abilityIndex` based on species and hidden ability if not pre-defined. */
|
||||
private generateAbilityIndex(): number {
|
||||
// Roll for hidden ability chance, applying any ability charms for enemy mons
|
||||
const hiddenAbilityChance = new NumberHolder(BASE_HIDDEN_ABILITY_CHANCE);
|
||||
// Ability Charms should only affect wild Pokemon
|
||||
// TODO: move this `if` check into the ability charm code
|
||||
if (!this.hasTrainer()) {
|
||||
globalScene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
|
||||
}
|
||||
|
||||
// If the roll succeeded and we have one, use HA; otherwise pick a random ability
|
||||
const hasHiddenAbility = !randSeedInt(hiddenAbilityChance.value);
|
||||
if (this.species.abilityHidden && hasHiddenAbility) {
|
||||
return 2;
|
||||
}
|
||||
// Neither RNG roll depends on the outcome of the other, so that Ability Charms do not affect RNG.
|
||||
const regularAbility = this.species.ability2 !== this.species.ability1 ? randSeedInt(2) : 0;
|
||||
const useHiddenAbility = this.species.abilityHidden ? !randSeedInt(hiddenAbilityChance.value) : false;
|
||||
|
||||
// only use random ability if species has a second ability
|
||||
return this.species.ability2 !== this.species.ability1 ? randSeedInt(2) : 0;
|
||||
return useHiddenAbility ? 2 : regularAbility;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user