From 89b9ef35cc2a141df21d22ea57ce89b33aad5510 Mon Sep 17 00:00:00 2001 From: Dean Date: Tue, 1 Apr 2025 22:41:00 -0700 Subject: [PATCH] Add hide phases for rogue ability showing --- src/data/arena-tag.ts | 5 +++-- src/data/battler-tags.ts | 5 +++-- src/data/moves/move.ts | 5 +++-- src/field/arena.ts | 3 --- src/overrides.ts | 4 +++- src/phases/move-effect-phase.ts | 8 ++++++++ src/phases/move-phase.ts | 16 ++++++++++------ 7 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index 8f1d6b09a73..871f622f70a 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -28,7 +28,6 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { Moves } from "#enums/moves"; import { MoveEffectPhase } from "#app/phases/move-effect-phase"; import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase"; -import { ShowAbilityPhase } from "#app/phases/show-ability-phase"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; import { CommonAnimPhase } from "#app/phases/common-anim-phase"; @@ -1160,9 +1159,11 @@ class TailwindTag extends ArenaTag { ); } // Raise attack by one stage if party member has WIND_RIDER ability + // TODO: Ability displays should be handled by the ability if (pokemon.hasAbility(Abilities.WIND_RIDER)) { - globalScene.unshiftPhase(new ShowAbilityPhase(pokemon.getBattlerIndex())); + globalScene.queueAbilityDisplay(pokemon, false, true); globalScene.unshiftPhase(new StatStageChangePhase(pokemon.getBattlerIndex(), true, [Stat.ATK], 1, true)); + globalScene.queueAbilityDisplay(pokemon, false, false); } } } diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index c391c4010b8..546dbb4a3db 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -30,7 +30,6 @@ import { CommonAnimPhase } from "#app/phases/common-anim-phase"; import { MoveEffectPhase } from "#app/phases/move-effect-phase"; import { MovePhase } from "#app/phases/move-phase"; import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase"; -import { ShowAbilityPhase } from "#app/phases/show-ability-phase"; import type { StatStageChangeCallback } from "#app/phases/stat-stage-change-phase"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; import i18next from "#app/plugins/i18n"; @@ -1901,12 +1900,14 @@ export class TruantTag extends AbilityBattlerTag { if (lastMove && lastMove.move !== Moves.NONE) { (globalScene.getCurrentPhase() as MovePhase).cancel(); - globalScene.unshiftPhase(new ShowAbilityPhase(pokemon.id, passive)); + // TODO: Ability displays should be handled by the ability + globalScene.queueAbilityDisplay(pokemon, passive, true); globalScene.queueMessage( i18next.t("battlerTags:truantLapse", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), }), ); + globalScene.queueAbilityDisplay(pokemon, passive, false); } return true; diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 8204f13fcca..80e8f2dae55 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -106,7 +106,6 @@ import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; import { SwitchPhase } from "#app/phases/switch-phase"; import { SwitchSummonPhase } from "#app/phases/switch-summon-phase"; -import { ShowAbilityPhase } from "#app/phases/show-ability-phase"; import { SpeciesFormChangeRevertWeatherFormTrigger } from "../pokemon-forms"; import type { GameMode } from "#app/game-mode"; import { applyChallenges, ChallengeType } from "../challenge"; @@ -1924,7 +1923,9 @@ export class PartyStatusCureAttr extends MoveEffectAttr { pokemon.resetStatus(); pokemon.updateInfo(); } else { - globalScene.unshiftPhase(new ShowAbilityPhase(pokemon.id, pokemon.getPassiveAbility()?.id === this.abilityCondition)); + // TODO: Ability displays should be handled by the ability + globalScene.queueAbilityDisplay(pokemon, pokemon.getPassiveAbility()?.id === this.abilityCondition, true); + globalScene.queueAbilityDisplay(pokemon, pokemon.getPassiveAbility()?.id === this.abilityCondition, false); } } } diff --git a/src/field/arena.ts b/src/field/arena.ts index 4f243789567..cf48647e45e 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -40,7 +40,6 @@ import { TrainerType } from "#enums/trainer-type"; import { Abilities } from "#enums/abilities"; import { SpeciesFormChangeRevertWeatherFormTrigger, SpeciesFormChangeWeatherTrigger } from "#app/data/pokemon-forms"; import { CommonAnimPhase } from "#app/phases/common-anim-phase"; -import { ShowAbilityPhase } from "#app/phases/show-ability-phase"; import { WeatherType } from "#enums/weather-type"; import { FieldEffectModifier } from "#app/modifier/modifier"; @@ -378,7 +377,6 @@ export class Arena { const isCherrimWithFlowerGift = p.hasAbility(Abilities.FLOWER_GIFT) && p.species.speciesId === Species.CHERRIM; if (isCastformWithForecast || isCherrimWithFlowerGift) { - new ShowAbilityPhase(p.getBattlerIndex()); globalScene.triggerPokemonFormChange(p, SpeciesFormChangeWeatherTrigger); } }); @@ -395,7 +393,6 @@ export class Arena { p.hasAbility(Abilities.FLOWER_GIFT, false, true) && p.species.speciesId === Species.CHERRIM; if (isCastformWithForecast || isCherrimWithFlowerGift) { - new ShowAbilityPhase(p.getBattlerIndex()); return globalScene.triggerPokemonFormChange(p, SpeciesFormChangeRevertWeatherFormTrigger); } }); diff --git a/src/overrides.ts b/src/overrides.ts index 3a9a54e740b..f1ac54f1d26 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -41,7 +41,9 @@ import { WeatherType } from "#enums/weather-type"; * } * ``` */ -const overrides = {} satisfies Partial>; +const overrides = { + ABILITY_OVERRIDE: Abilities.TRUANT +} satisfies Partial>; /** * If you need to add Overrides values for local testing do that inside {@linkcode overrides} diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index 995684f8c03..566d5c94d0f 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -69,6 +69,7 @@ import type { Phase } from "#app/phase"; import { ShowAbilityPhase } from "./show-ability-phase"; import { MovePhase } from "./move-phase"; import { MoveEndPhase } from "./move-end-phase"; +import { HideAbilityPhase } from "#app/phases/hide-ability-phase"; export class MoveEffectPhase extends PokemonPhase { public move: PokemonMove; @@ -326,12 +327,19 @@ export class MoveEffectPhase extends PokemonPhase { ? getMoveTargets(target, move.id).targets : [user.getBattlerIndex()]; if (!isReflecting) { + // TODO: Ability displays should be handled by the ability queuedPhases.push( new ShowAbilityPhase( target.getBattlerIndex(), target.getPassiveAbility().hasAttr(ReflectStatusMoveAbAttr), ), ); + queuedPhases.push( + new HideAbilityPhase( + target.getBattlerIndex(), + target.getPassiveAbility().hasAttr(ReflectStatusMoveAbAttr), + ), + ); } queuedPhases.push( diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index f8edaa56981..e04f48c2880 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -42,7 +42,6 @@ import { CommonAnimPhase } from "#app/phases/common-anim-phase"; import { MoveChargePhase } from "#app/phases/move-charge-phase"; import { MoveEffectPhase } from "#app/phases/move-effect-phase"; import { MoveEndPhase } from "#app/phases/move-end-phase"; -import { ShowAbilityPhase } from "#app/phases/show-ability-phase"; import { NumberHolder } from "#app/utils"; import { Abilities } from "#enums/abilities"; import { ArenaTagType } from "#enums/arena-tag-type"; @@ -535,11 +534,16 @@ export class MovePhase extends BattlePhase { if (this.pokemon.hasAbilityWithAttr(BlockRedirectAbAttr)) { redirectTarget.value = currentTarget; - globalScene.unshiftPhase( - new ShowAbilityPhase( - this.pokemon.getBattlerIndex(), - this.pokemon.getPassiveAbility().hasAttr(BlockRedirectAbAttr), - ), + // TODO: Ability displays should be handled by the ability + globalScene.queueAbilityDisplay( + this.pokemon, + this.pokemon.getPassiveAbility().hasAttr(BlockRedirectAbAttr), + true, + ); + globalScene.queueAbilityDisplay( + this.pokemon, + this.pokemon.getPassiveAbility().hasAttr(BlockRedirectAbAttr), + false, ); }