mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-21 07:42:25 +02:00
Fix ability bar showing the wrong ability with imposter
This commit is contained in:
parent
2b6a4ec89b
commit
8c0d4da740
@ -1,14 +1,20 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type { BattlerIndex } from "#app/battle";
|
||||
import { PokemonPhase } from "./pokemon-phase";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
|
||||
export class ShowAbilityPhase extends PokemonPhase {
|
||||
private passive: boolean;
|
||||
private pokemonName: string;
|
||||
private abilityName: string;
|
||||
|
||||
constructor(battlerIndex: BattlerIndex, passive: boolean = false) {
|
||||
super(battlerIndex);
|
||||
|
||||
this.passive = passive;
|
||||
// Set these now as the pokemon object may change before the queued phase is run
|
||||
this.pokemonName = getPokemonNameWithAffix(this.getPokemon());
|
||||
this.abilityName = passive ? this.getPokemon().getPassiveAbility().name : this.getPokemon().getAbility().name;
|
||||
}
|
||||
|
||||
start() {
|
||||
@ -17,7 +23,7 @@ export class ShowAbilityPhase extends PokemonPhase {
|
||||
const pokemon = this.getPokemon();
|
||||
|
||||
if (pokemon) {
|
||||
globalScene.abilityBar.showAbility(pokemon, this.passive).then(() => {
|
||||
globalScene.abilityBar.showAbility(this.pokemonName, this.abilityName, this.passive).then(() => {
|
||||
if (pokemon?.battleData) {
|
||||
pokemon.battleData.abilityRevealed = true;
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type Pokemon from "../field/pokemon";
|
||||
import { TextStyle, addTextObject } from "./text";
|
||||
import i18next from "i18next";
|
||||
|
||||
@ -57,8 +55,8 @@ export default class AbilityBar extends Phaser.GameObjects.Container {
|
||||
});
|
||||
}
|
||||
|
||||
showAbility(pokemon: Pokemon, passive: boolean = false): Promise<void> {
|
||||
const text = (`${i18next.t("fightUiHandler:abilityFlyInText", { pokemonName: getPokemonNameWithAffix(pokemon), passive: passive ? i18next.t("fightUiHandler:passive") : "", abilityName: !passive ? pokemon.getAbility().name : pokemon.getPassiveAbility().name })}`);
|
||||
showAbility(pokemonName: string, abilityName: string, passive: boolean = false): Promise<void> {
|
||||
const text = (`${i18next.t("fightUiHandler:abilityFlyInText", { pokemonName: pokemonName, passive: passive ? i18next.t("fightUiHandler:passive") : "", abilityName: abilityName })}`);
|
||||
|
||||
globalScene.fieldUI.bringToTop(this);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user