mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-21 15:52:18 +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 { globalScene } from "#app/global-scene";
|
||||||
import type { BattlerIndex } from "#app/battle";
|
import type { BattlerIndex } from "#app/battle";
|
||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
|
|
||||||
export class ShowAbilityPhase extends PokemonPhase {
|
export class ShowAbilityPhase extends PokemonPhase {
|
||||||
private passive: boolean;
|
private passive: boolean;
|
||||||
|
private pokemonName: string;
|
||||||
|
private abilityName: string;
|
||||||
|
|
||||||
constructor(battlerIndex: BattlerIndex, passive: boolean = false) {
|
constructor(battlerIndex: BattlerIndex, passive: boolean = false) {
|
||||||
super(battlerIndex);
|
super(battlerIndex);
|
||||||
|
|
||||||
this.passive = passive;
|
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() {
|
start() {
|
||||||
@ -17,7 +23,7 @@ export class ShowAbilityPhase extends PokemonPhase {
|
|||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
if (pokemon) {
|
if (pokemon) {
|
||||||
globalScene.abilityBar.showAbility(pokemon, this.passive).then(() => {
|
globalScene.abilityBar.showAbility(this.pokemonName, this.abilityName, this.passive).then(() => {
|
||||||
if (pokemon?.battleData) {
|
if (pokemon?.battleData) {
|
||||||
pokemon.battleData.abilityRevealed = true;
|
pokemon.battleData.abilityRevealed = true;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import type Pokemon from "../field/pokemon";
|
|
||||||
import { TextStyle, addTextObject } from "./text";
|
import { TextStyle, addTextObject } from "./text";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
@ -57,8 +55,8 @@ export default class AbilityBar extends Phaser.GameObjects.Container {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showAbility(pokemon: Pokemon, passive: boolean = false): Promise<void> {
|
showAbility(pokemonName: string, abilityName: string, 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 })}`);
|
const text = (`${i18next.t("fightUiHandler:abilityFlyInText", { pokemonName: pokemonName, passive: passive ? i18next.t("fightUiHandler:passive") : "", abilityName: abilityName })}`);
|
||||||
|
|
||||||
globalScene.fieldUI.bringToTop(this);
|
globalScene.fieldUI.bringToTop(this);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user