diff --git a/src/data/ability.ts b/src/data/ability.ts index daaa82baf68..4c27e6c6859 100755 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -1899,6 +1899,7 @@ export class TraceAbAttr extends PostSummonAbAttr { pokemon.summonData.ability = target.getAbility().id; pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` traced ${target.name}'s\n${allAbilities[target.getAbility().id].name}!`)); + setAbilityRevealed(target); return true; } @@ -2457,9 +2458,7 @@ export class FriskAbAttr extends PostSummonAbAttr { applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean { for (const opponent of pokemon.getOpponents()) { pokemon.scene.queueMessage(getPokemonMessage(pokemon, " frisked " + opponent.name + "'s " + opponent.getAbility().name + "!")); - if (opponent.battleData) { - opponent.battleData.abilityRevealed = true; - } + setAbilityRevealed(opponent); } return true; } @@ -3820,6 +3819,17 @@ function queueShowAbility(pokemon: Pokemon, passive: boolean): void { pokemon.scene.clearPhaseQueueSplice(); } +/** + * Sets the ability of a Pokémon as revealed. + * + * @param pokemon - The Pokémon whose ability is being revealed. + */ +function setAbilityRevealed(pokemon: Pokemon): void { + if (pokemon.battleData) { + pokemon.battleData.abilityRevealed = true; + } +} + export const allAbilities = [ new Ability(Abilities.NONE, 3) ]; export function initAbilities() {