diff --git a/src/battle-scene.ts b/src/battle-scene.ts index ea2983c75a8..f2f952ea301 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -900,7 +900,7 @@ export default class BattleScene extends SceneBase { do { targetingMovePhase = this.findPhase( mp => - mp.isXPhase("MovePhase") && + mp.is("MovePhase") && mp.targets.length === 1 && mp.targets[0] === removedPokemon.getBattlerIndex() && mp.pokemon.isPlayer() !== allyPokemon.isPlayer(), @@ -1449,7 +1449,7 @@ export default class BattleScene extends SceneBase { } if (lastBattle?.double && !newDouble) { - this.tryRemovePhase((p: Phase) => p.isXPhase("SwitchPhase")); + this.tryRemovePhase((p: Phase) => p.is("SwitchPhase")); for (const p of this.getPlayerField()) { p.lapseTag(BattlerTagType.COMMANDED); } diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 454979ca1dd..1bd71df32e0 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -2828,7 +2828,7 @@ export class CommanderAbAttr extends AbAttr { // Apply boosts from this effect to the ally Dondozo pokemon.getAlly()?.addTag(BattlerTagType.COMMANDED, 0, MoveId.NONE, pokemon.id); // Cancel the source Pokemon's next move (if a move is queued) - globalScene.tryRemovePhase((phase) => phase.isXPhase("MovePhase") && phase.pokemon === pokemon); + globalScene.tryRemovePhase((phase) => phase.is("MovePhase") && phase.pokemon === pokemon); } } } @@ -6897,7 +6897,7 @@ export function initAbilities() { .ignorable(), new Ability(AbilityId.ANALYTIC, 5) .attr(MovePowerBoostAbAttr, (user, target, move) => { - const movePhase = globalScene.findPhase((phase) => phase.isXPhase("MovePhase") && phase.pokemon.id !== user?.id); + const movePhase = globalScene.findPhase((phase) => phase.is("MovePhase") && phase.pokemon.id !== user?.id); return isNullOrUndefined(movePhase); }, 1.3), new Ability(AbilityId.ILLUSION, 5) diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index 25d081d3aa7..0254aab37e1 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -383,7 +383,7 @@ const QuickGuardConditionFunc: ProtectConditionFunc = (_arena, moveId) => { const move = allMoves[moveId]; const effectPhase = globalScene.getCurrentPhase(); - if (effectPhase?.isXPhase("MoveEffectPhase")) { + if (effectPhase?.is("MoveEffectPhase")) { const attacker = effectPhase.getUserPokemon(); if (attacker) { return move.getPriority(attacker) > 0; diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 48bc229d86c..c047f424591 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -553,9 +553,9 @@ export class ShellTrapTag extends BattlerTag { // Trap should only be triggered by opponent's Physical moves if (phaseData?.move.category === MoveCategory.PHYSICAL && pokemon.isOpponent(phaseData.attacker)) { const shellTrapPhaseIndex = globalScene.phaseQueue.findIndex( - phase => phase.isXPhase("MovePhase") && phase.pokemon === pokemon, + phase => phase.is("MovePhase") && phase.pokemon === pokemon, ); - const firstMovePhaseIndex = globalScene.phaseQueue.findIndex(phase => phase.isXPhase("MovePhase")); + const firstMovePhaseIndex = globalScene.phaseQueue.findIndex(phase => phase.is("MovePhase")); // Only shift MovePhase timing if it's not already next up if (shellTrapPhaseIndex !== -1 && shellTrapPhaseIndex !== firstMovePhaseIndex) { @@ -1027,7 +1027,7 @@ export class PowderTag extends BattlerTag { lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { if (lapseType === BattlerTagLapseType.PRE_MOVE) { const movePhase = globalScene.getCurrentPhase(); - if (movePhase?.isXPhase("MovePhase")) { + if (movePhase?.is("MovePhase")) { const move = movePhase.move.getMove(); const weather = globalScene.arena.weather; if ( @@ -1183,13 +1183,13 @@ export class EncoreTag extends MoveRestrictionBattlerTag { }), ); - const movePhase = globalScene.findPhase(m => m.isXPhase("MovePhase") && m.pokemon === pokemon); + const movePhase = globalScene.findPhase(m => m.is("MovePhase") && m.pokemon === pokemon); if (movePhase) { const movesetMove = pokemon.getMoveset().find(m => m.moveId === this.moveId); if (movesetMove) { const lastMove = pokemon.getLastXMoves(1)[0]; globalScene.tryReplacePhase( - m => m.isXPhase("MovePhase") && m.pokemon === pokemon, + m => m.is("MovePhase") && m.pokemon === pokemon, new MovePhase(pokemon, lastMove.targets ?? [], movesetMove), ); } @@ -1624,7 +1624,7 @@ export class ProtectedTag extends BattlerTag { // Stop multi-hit moves early const effectPhase = globalScene.getCurrentPhase(); - if (effectPhase?.isXPhase("MoveEffectPhase")) { + if (effectPhase?.is("MoveEffectPhase")) { effectPhase.stopMultiHit(pokemon); } return true; @@ -2646,7 +2646,7 @@ export class GulpMissileTag extends BattlerTag { } const moveEffectPhase = globalScene.getCurrentPhase(); - if (moveEffectPhase?.isXPhase("MoveEffectPhase")) { + if (moveEffectPhase?.is("MoveEffectPhase")) { const attacker = moveEffectPhase.getUserPokemon(); if (!attacker) { @@ -3004,7 +3004,7 @@ export class SubstituteTag extends BattlerTag { /** If the Substitute redirects damage, queue a message to indicate it. */ onHit(pokemon: Pokemon): void { const moveEffectPhase = globalScene.getCurrentPhase(); - if (moveEffectPhase?.isXPhase("MoveEffectPhase")) { + if (moveEffectPhase?.is("MoveEffectPhase")) { const attacker = moveEffectPhase.getUserPokemon(); if (!attacker) { return; @@ -3693,7 +3693,7 @@ export function loadBattlerTag(source: BattlerTag | any): BattlerTag { */ function getMoveEffectPhaseData(_pokemon: Pokemon): { phase: MoveEffectPhase; attacker: Pokemon; move: Move } | null { const phase = globalScene.getCurrentPhase(); - if (phase?.isXPhase("MoveEffectPhase")) { + if (phase?.is("MoveEffectPhase")) { return { phase: phase, attacker: phase.getPokemon(), diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 6f7b1bf2a61..91cc6350daa 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -3109,7 +3109,7 @@ export class AwaitCombinedPledgeAttr extends OverrideMoveEffectAttr { const overridden = args[0] as BooleanHolder; - const allyMovePhase = globalScene.findPhase((phase) => phase.isXPhase("MovePhase") && phase.pokemon.isPlayer() === user.isPlayer()); + const allyMovePhase = globalScene.findPhase((phase) => phase.is("MovePhase") && phase.pokemon.isPlayer() === user.isPlayer()); if (allyMovePhase) { const allyMove = allyMovePhase.move.getMove(); if (allyMove !== move && allyMove.hasAttr(AwaitCombinedPledgeAttr)) { @@ -3123,7 +3123,7 @@ export class AwaitCombinedPledgeAttr extends OverrideMoveEffectAttr { // Move the ally's MovePhase (if needed) so that the ally moves next const allyMovePhaseIndex = globalScene.phaseQueue.indexOf(allyMovePhase); - const firstMovePhaseIndex = globalScene.phaseQueue.findIndex((phase) => phase.isXPhase("MovePhase")); + const firstMovePhaseIndex = globalScene.phaseQueue.findIndex((phase) => phase.is("MovePhase")); if (allyMovePhaseIndex !== firstMovePhaseIndex) { globalScene.prependToPhase(globalScene.phaseQueue.splice(allyMovePhaseIndex, 1)[0], MovePhase); } @@ -4477,7 +4477,7 @@ export class CueNextRoundAttr extends MoveEffectAttr { override apply(user: Pokemon, target: Pokemon, move: Move, args?: any[]): boolean { const nextRoundPhase = globalScene.findPhase(phase => - phase.isXPhase("MovePhase") && phase.move.moveId === MoveId.ROUND + phase.is("MovePhase") && phase.move.moveId === MoveId.ROUND ); if (!nextRoundPhase) { @@ -4486,7 +4486,7 @@ export class CueNextRoundAttr extends MoveEffectAttr { // Update the phase queue so that the next Pokemon using Round moves next const nextRoundIndex = globalScene.phaseQueue.indexOf(nextRoundPhase); - const nextMoveIndex = globalScene.phaseQueue.findIndex(phase => phase.isXPhase("MovePhase")); + const nextMoveIndex = globalScene.phaseQueue.findIndex(phase => phase.is("MovePhase")); if (nextRoundIndex !== nextMoveIndex) { globalScene.prependToPhase(globalScene.phaseQueue.splice(nextRoundIndex, 1)[0], MovePhase); } @@ -6177,7 +6177,7 @@ export class RevivalBlessingAttr extends MoveEffectAttr { // Handle cases where revived pokemon needs to get switched in on same turn if (allyPokemon.isFainted() || allyPokemon === pokemon) { // Enemy switch phase should be removed and replaced with the revived pkmn switching in - globalScene.tryRemovePhase((phase: SwitchSummonPhase) => phase.isXPhase("SwitchSummonPhase") && phase.getPokemon() === pokemon); + globalScene.tryRemovePhase((phase: SwitchSummonPhase) => phase.is("SwitchSummonPhase") && phase.getPokemon() === pokemon); // If the pokemon being revived was alive earlier in the turn, cancel its move // (revived pokemon can't move in the turn they're brought back) globalScene.findPhase((phase: MovePhase) => phase.pokemon === pokemon)?.cancel(); @@ -7896,7 +7896,7 @@ export class ForceLastAttr extends MoveEffectAttr { // Either the end of the turn or in front of another, slower move which has also been forced last const prependPhase = globalScene.findPhase((phase) => [ MovePhase, MoveEndPhase ].every(cls => !(phase instanceof cls)) - || (phase.isXPhase("MovePhase")) && phaseForcedSlower(phase, target, !!globalScene.arena.getTag(ArenaTagType.TRICK_ROOM)) + || (phase.is("MovePhase")) && phaseForcedSlower(phase, target, !!globalScene.arena.getTag(ArenaTagType.TRICK_ROOM)) ); if (prependPhase) { globalScene.phaseQueue.splice( @@ -7942,7 +7942,7 @@ const userSleptOrComatoseCondition: MoveConditionFunc = (user: Pokemon, target: const targetSleptOrComatoseCondition: MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => target.status?.effect === StatusEffect.SLEEP || target.hasAbility(AbilityId.COMATOSE); -const failIfLastCondition: MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => globalScene.phaseQueue.find(phase => phase.isXPhase("MovePhase")) !== undefined; +const failIfLastCondition: MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => globalScene.phaseQueue.find(phase => phase.is("MovePhase")) !== undefined; const failIfLastInPartyCondition: MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => { const party: Pokemon[] = user.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty(); diff --git a/src/data/mystery-encounters/utils/encounter-phase-utils.ts b/src/data/mystery-encounters/utils/encounter-phase-utils.ts index f8a1d4b855b..c9eaa2e6968 100644 --- a/src/data/mystery-encounters/utils/encounter-phase-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-phase-utils.ts @@ -769,7 +769,7 @@ export function setEncounterRewards( if (customShopRewards) { globalScene.unshiftPhase(new SelectModifierPhase(0, undefined, customShopRewards)); } else { - globalScene.tryRemovePhase(p => p.isXPhase("MysteryEncounterRewardsPhase")); + globalScene.tryRemovePhase(p => p.is("MysteryEncounterRewardsPhase")); } if (eggRewards) { diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 105b565cb67..d06553f2227 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -232,7 +232,6 @@ import { getPokemonNameWithAffix } from "#app/messages"; import { DamageAnimPhase } from "#app/phases/damage-anim-phase"; import { FaintPhase } from "#app/phases/faint-phase"; import { LearnMovePhase } from "#app/phases/learn-move-phase"; -import { MoveEffectPhase } from "#app/phases/move-effect-phase"; import { MoveEndPhase } from "#app/phases/move-end-phase"; import { ObtainStatusEffectPhase } from "#app/phases/obtain-status-effect-phase"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; @@ -1300,7 +1299,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { // During the Pokemon's MoveEffect phase, the offset is removed to put the Pokemon "in focus" const currentPhase = globalScene.getCurrentPhase(); - if (currentPhase?.isXPhase("MoveEffectPhase") && currentPhase.getPokemon() === this) { + if (currentPhase?.is("MoveEffectPhase") && currentPhase.getPokemon() === this) { return false; } return true; @@ -4775,7 +4774,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { */ if (effect === StatusEffect.SLEEP || effect === StatusEffect.FREEZE) { const currentPhase = globalScene.getCurrentPhase(); - if (currentPhase?.isXPhase("MoveEffectPhase") && currentPhase.getUserPokemon() === this) { + if (currentPhase?.is("MoveEffectPhase") && currentPhase.getUserPokemon() === this) { this.turnData.hitCount = 1; this.turnData.hitsLeft = 1; } diff --git a/src/phase.ts b/src/phase.ts index 6b0b5222828..9e2468ebdff 100644 --- a/src/phase.ts +++ b/src/phase.ts @@ -9,7 +9,7 @@ export abstract class Phase { } /** - * The string name of the phase, used to identify the phase type for {@linkcode isXPhase} + * The string name of the phase, used to identify the phase type for {@linkcode is} * * @privateremarks * @@ -27,7 +27,7 @@ export abstract class Phase { * This does not check for subclasses! It only checks if the phase is *exactly* the given type. * This method exists to avoid circular import issues, as using `instanceof` would require importing each phase. */ - isXPhase(phase: K): this is PhaseMap[K] { + is(phase: K): this is PhaseMap[K] { return this.phaseName === phase; } } diff --git a/src/phases/battle-end-phase.ts b/src/phases/battle-end-phase.ts index 626bd1021ae..96f6d02b1fc 100644 --- a/src/phases/battle-end-phase.ts +++ b/src/phases/battle-end-phase.ts @@ -20,7 +20,7 @@ export class BattleEndPhase extends BattlePhase { // cull any extra `BattleEnd` phases from the queue. globalScene.phaseQueue = globalScene.phaseQueue.filter(phase => { - if (phase.isXPhase("BattleEndPhase")) { + if (phase.is("BattleEndPhase")) { this.isVictory ||= phase.isVictory; return false; } @@ -29,7 +29,7 @@ export class BattleEndPhase extends BattlePhase { // `phaseQueuePrepend` is private, so we have to use this inefficient loop. while ( globalScene.tryRemoveUnshiftedPhase(phase => { - if (phase.isXPhase("BattleEndPhase")) { + if (phase.is("BattleEndPhase")) { this.isVictory ||= phase.isVictory; return true; } diff --git a/src/phases/egg-hatch-phase.ts b/src/phases/egg-hatch-phase.ts index d8823a07ef2..dfcdc05f9a2 100644 --- a/src/phases/egg-hatch-phase.ts +++ b/src/phases/egg-hatch-phase.ts @@ -225,7 +225,7 @@ export class EggHatchPhase extends Phase { } end() { - if (globalScene.findPhase(p => p.isXPhase("EggHatchPhase"))) { + if (globalScene.findPhase(p => p.is("EggHatchPhase"))) { this.eggHatchHandler.clear(); } else { globalScene.time.delayedCall(250, () => globalScene.setModifiersVisible(true)); diff --git a/src/phases/learn-move-phase.ts b/src/phases/learn-move-phase.ts index b6f273925cf..d455ed35591 100644 --- a/src/phases/learn-move-phase.ts +++ b/src/phases/learn-move-phase.ts @@ -195,7 +195,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { pokemon.usedTMs = []; } pokemon.usedTMs.push(this.moveId); - globalScene.tryRemovePhase(phase => phase.isXPhase("SelectModifierPhase")); + globalScene.tryRemovePhase(phase => phase.is("SelectModifierPhase")); } else if (this.learnMoveType === LearnMoveType.MEMORY) { if (this.cost !== -1) { if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) { @@ -205,7 +205,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { } globalScene.playSound("se/buy"); } else { - globalScene.tryRemovePhase(phase => phase.isXPhase("SelectModifierPhase")); + globalScene.tryRemovePhase(phase => phase.is("SelectModifierPhase")); } } pokemon.setMove(index, this.moveId); diff --git a/src/phases/move-charge-phase.ts b/src/phases/move-charge-phase.ts index 928aa57043e..789651623fa 100644 --- a/src/phases/move-charge-phase.ts +++ b/src/phases/move-charge-phase.ts @@ -62,7 +62,7 @@ export class MoveChargePhase extends PokemonPhase { if (instantCharge.value) { // this MoveEndPhase will be duplicated by the queued MovePhase if not removed - globalScene.tryRemovePhase(phase => phase.isXPhase("MoveEndPhase") && phase.getPokemon() === user); + globalScene.tryRemovePhase(phase => phase.is("MoveEndPhase") && phase.getPokemon() === user); // queue a new MovePhase for this move's attack phase globalScene.unshiftPhase(new MovePhase(user, [this.targetIndex], this.move, false)); } else { diff --git a/src/phases/mystery-encounter-phases.ts b/src/phases/mystery-encounter-phases.ts index 0378df0a51b..5365ab3da32 100644 --- a/src/phases/mystery-encounter-phases.ts +++ b/src/phases/mystery-encounter-phases.ts @@ -247,8 +247,8 @@ export class MysteryEncounterBattleStartCleanupPhase extends Phase { }); // Remove any status tick phases - while (globalScene.findPhase(p => p.isXPhase("PostTurnStatusEffectPhase"))) { - globalScene.tryRemovePhase(p => p.isXPhase("PostTurnStatusEffectPhase")); + while (globalScene.findPhase(p => p.is("PostTurnStatusEffectPhase"))) { + globalScene.tryRemovePhase(p => p.is("PostTurnStatusEffectPhase")); } // The total number of Pokemon in the player's party that can legally fight @@ -562,7 +562,7 @@ export class MysteryEncounterRewardsPhase extends Phase { if (encounter.doEncounterRewards) { encounter.doEncounterRewards(); } else if (this.addHealPhase) { - globalScene.tryRemovePhase(p => p.isXPhase("SelectModifierPhase")); + globalScene.tryRemovePhase(p => p.is("SelectModifierPhase")); globalScene.unshiftPhase( new SelectModifierPhase(0, undefined, { fillRemaining: false, diff --git a/src/phases/new-battle-phase.ts b/src/phases/new-battle-phase.ts index c37f412e283..c4cfc72fb53 100644 --- a/src/phases/new-battle-phase.ts +++ b/src/phases/new-battle-phase.ts @@ -7,9 +7,9 @@ export class NewBattlePhase extends BattlePhase { super.start(); // cull any extra `NewBattle` phases from the queue. - globalScene.phaseQueue = globalScene.phaseQueue.filter(phase => !phase.isXPhase("NewBattlePhase")); + globalScene.phaseQueue = globalScene.phaseQueue.filter(phase => !phase.is("NewBattlePhase")); // `phaseQueuePrepend` is private, so we have to use this inefficient loop. - while (globalScene.tryRemoveUnshiftedPhase(phase => phase.isXPhase("NewBattlePhase"))) {} + while (globalScene.tryRemoveUnshiftedPhase(phase => phase.is("NewBattlePhase"))) {} globalScene.newBattle(); diff --git a/src/phases/quiet-form-change-phase.ts b/src/phases/quiet-form-change-phase.ts index 38dcb2bf439..9f6b5cb3361 100644 --- a/src/phases/quiet-form-change-phase.ts +++ b/src/phases/quiet-form-change-phase.ts @@ -169,7 +169,7 @@ export class QuietFormChangePhase extends BattlePhase { this.pokemon.initBattleInfo(); this.pokemon.cry(); - const movePhase = globalScene.findPhase(p => p.isXPhase("MovePhase") && p.pokemon === this.pokemon) as MovePhase; + const movePhase = globalScene.findPhase(p => p.is("MovePhase") && p.pokemon === this.pokemon) as MovePhase; if (movePhase) { movePhase.cancel(); } diff --git a/src/phases/stat-stage-change-phase.ts b/src/phases/stat-stage-change-phase.ts index 75bab369dcb..baa93c63099 100644 --- a/src/phases/stat-stage-change-phase.ts +++ b/src/phases/stat-stage-change-phase.ts @@ -236,9 +236,9 @@ export class StatStageChangePhase extends PokemonPhase { // Look for any other stat change phases; if this is the last one, do White Herb check const existingPhase = globalScene.findPhase( - p => p.isXPhase("StatStageChangePhase") && p.battlerIndex === this.battlerIndex, + p => p.is("StatStageChangePhase") && p.battlerIndex === this.battlerIndex, ); - if (!existingPhase?.isXPhase("StatStageChangePhase")) { + if (!existingPhase?.is("StatStageChangePhase")) { // Apply White Herb if needed const whiteHerb = globalScene.applyModifier( ResetNegativeStatStageModifier, @@ -317,7 +317,7 @@ export class StatStageChangePhase extends PokemonPhase { while ( (existingPhase = globalScene.findPhase( p => - p.isXPhase("StatStageChangePhase") && + p.is("StatStageChangePhase") && p.battlerIndex === this.battlerIndex && p.stats.length === 1 && p.stats[0] === this.stats[0] && @@ -336,7 +336,7 @@ export class StatStageChangePhase extends PokemonPhase { while ( (existingPhase = globalScene.findPhase( p => - p.isXPhase("StatStageChangePhase") && + p.is("StatStageChangePhase") && p.battlerIndex === this.battlerIndex && p.selfTarget === this.selfTarget && accEva.some(s => p.stats.includes(s)) === isAccEva && diff --git a/src/phases/switch-phase.ts b/src/phases/switch-phase.ts index b38d21fe6c3..6017aa0fa70 100644 --- a/src/phases/switch-phase.ts +++ b/src/phases/switch-phase.ts @@ -76,9 +76,7 @@ export class SwitchPhase extends BattlePhase { if (slotIndex >= globalScene.currentBattle.getBattlerCount() && slotIndex < 6) { // Remove any pre-existing PostSummonPhase under the same field index. // Pre-existing PostSummonPhases may occur when this phase is invoked during a prompt to switch at the start of a wave. - globalScene.tryRemovePhase( - p => p.isXPhase("PostSummonPhase") && p.player && p.fieldIndex === this.fieldIndex, - ); + globalScene.tryRemovePhase(p => p.is("PostSummonPhase") && p.player && p.fieldIndex === this.fieldIndex); const switchType = option === PartyOption.PASS_BATON ? SwitchType.BATON_PASS : this.switchType; globalScene.unshiftPhase(new SwitchSummonPhase(switchType, fieldIndex, slotIndex, this.doReturn)); } diff --git a/src/ui/command-ui-handler.ts b/src/ui/command-ui-handler.ts index 1bf2f740fda..0d67fdea624 100644 --- a/src/ui/command-ui-handler.ts +++ b/src/ui/command-ui-handler.ts @@ -75,7 +75,7 @@ export default class CommandUiHandler extends UiHandler { let commandPhase: CommandPhase; const currentPhase = globalScene.getCurrentPhase(); - if (currentPhase?.isXPhase("CommandPhase")) { + if (currentPhase?.is("CommandPhase")) { commandPhase = currentPhase; } else { commandPhase = globalScene.getStandbyPhase() as CommandPhase; diff --git a/src/ui/egg-hatch-scene-handler.ts b/src/ui/egg-hatch-scene-handler.ts index 07bf5399370..b2863a213f8 100644 --- a/src/ui/egg-hatch-scene-handler.ts +++ b/src/ui/egg-hatch-scene-handler.ts @@ -45,7 +45,7 @@ export default class EggHatchSceneHandler extends UiHandler { processInput(button: Button): boolean { if (button === Button.ACTION || button === Button.CANCEL) { const phase = globalScene.getCurrentPhase(); - if (phase?.isXPhase("EggHatchPhase") && phase.trySkip()) { + if (phase?.is("EggHatchPhase") && phase.trySkip()) { return true; } } diff --git a/src/ui/egg-summary-ui-handler.ts b/src/ui/egg-summary-ui-handler.ts index e2298f02c07..ed2506ba0c1 100644 --- a/src/ui/egg-summary-ui-handler.ts +++ b/src/ui/egg-summary-ui-handler.ts @@ -222,7 +222,7 @@ export default class EggSummaryUiHandler extends MessageUiHandler { if (button === Button.CANCEL) { if (!this.blockExit) { const phase = globalScene.getCurrentPhase(); - if (phase?.isXPhase("EggSummaryPhase")) { + if (phase?.is("EggSummaryPhase")) { phase.end(); } success = true; diff --git a/src/ui/menu-ui-handler.ts b/src/ui/menu-ui-handler.ts index 85ab3916d48..b6c3a9d7b8e 100644 --- a/src/ui/menu-ui-handler.ts +++ b/src/ui/menu-ui-handler.ts @@ -125,7 +125,7 @@ export default class MenuUiHandler extends MessageUiHandler { const ui = this.getUi(); this.excludedMenus = () => [ { - condition: !!globalScene.getCurrentPhase()?.isXPhase("SelectModifierPhase"), + condition: !!globalScene.getCurrentPhase()?.is("SelectModifierPhase"), options: [MenuOptions.EGG_GACHA], }, { condition: bypassLogin, options: [MenuOptions.LOG_OUT] }, diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 17a2589f263..e26ecb531e9 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -750,7 +750,7 @@ export default class PartyUiHandler extends MessageUiHandler { // TODO: This risks hitting the other options (.MOVE_i and ALL) so does it? Do we need an extra check? if ( option >= PartyOption.FORM_CHANGE_ITEM && - globalScene.getCurrentPhase()?.isXPhase("SelectModifierPhase") && + globalScene.getCurrentPhase()?.is("SelectModifierPhase") && this.partyUiMode === PartyUiMode.CHECK ) { const formChangeItemModifiers = this.getFormChangeItemsModifiers(pokemon); @@ -1337,7 +1337,7 @@ export default class PartyUiHandler extends MessageUiHandler { this.addCommonOptions(pokemon); break; case PartyUiMode.CHECK: - if (globalScene.getCurrentPhase()?.isXPhase("SelectModifierPhase")) { + if (globalScene.getCurrentPhase()?.is("SelectModifierPhase")) { const formChangeItemModifiers = this.getFormChangeItemsModifiers(pokemon); for (let i = 0; i < formChangeItemModifiers.length; i++) { this.options.push(PartyOption.FORM_CHANGE_ITEM + i);