mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-17 07:15: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. */
|
/** Generate `abilityIndex` based on species and hidden ability if not pre-defined. */
|
||||||
private generateAbilityIndex(): number {
|
private generateAbilityIndex(): number {
|
||||||
// Roll for hidden ability chance, applying any ability charms for enemy mons
|
|
||||||
const hiddenAbilityChance = new NumberHolder(BASE_HIDDEN_ABILITY_CHANCE);
|
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()) {
|
if (!this.hasTrainer()) {
|
||||||
globalScene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
|
globalScene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the roll succeeded and we have one, use HA; otherwise pick a random ability
|
// Neither RNG roll depends on the outcome of the other, so that Ability Charms do not affect RNG.
|
||||||
const hasHiddenAbility = !randSeedInt(hiddenAbilityChance.value);
|
const regularAbility = this.species.ability2 !== this.species.ability1 ? randSeedInt(2) : 0;
|
||||||
if (this.species.abilityHidden && hasHiddenAbility) {
|
const useHiddenAbility = this.species.abilityHidden ? !randSeedInt(hiddenAbilityChance.value) : false;
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// only use random ability if species has a second ability
|
return useHiddenAbility ? 2 : regularAbility;
|
||||||
return this.species.ability2 !== this.species.ability1 ? randSeedInt(2) : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user