diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index cef4cbdb01a..313d52dc9ac 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -98,8 +98,6 @@ export interface TerrainBattlerTag { * to select disabled moves. */ export abstract class DisablingBattlerTag extends BattlerTag { - abstract moveIsDisabled(move: Moves): boolean; - constructor(tagType: BattlerTagType, turnCount: integer, sourceMove?: Moves, sourceId?: integer) { super(tagType, [ BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.TURN_END ], turnCount, sourceMove, sourceId); } @@ -121,6 +119,12 @@ export abstract class DisablingBattlerTag extends BattlerTag { return super.lapse(pokemon, lapseType); } + /** Determines whether to disable a move. */ + abstract moveIsDisabled(move: Moves): boolean; + + /** The text to display when the player attempts to select a move disabled by this tag. */ + abstract selectionDeniedText(pokemon: Pokemon, move: Moves): string; + /** * The text to display when a move's execution is prevented as a result of the disable. * Because disabling effects also prevent selection of the move, this situation can only arise if a @@ -169,6 +173,10 @@ export class DisabledTag extends DisablingBattlerTag { pokemon.scene.queueMessage(i18next.t("battle:battlerTagsDisabledLapse", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), moveName: allMoves[this.moveId].name })); } + override selectionDeniedText(pokemon: Pokemon, move: Moves): string { + return i18next.t("battle:moveDisabled", { moveName: allMoves[move].name }); + } + override interruptedText(pokemon: Pokemon, move: Moves): string { return i18next.t("battle:disableInterruptedMove", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), moveName: allMoves[move].name }); } diff --git a/src/phases.ts b/src/phases.ts index 8a1508ce575..5857b461fd5 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2020,8 +2020,9 @@ export class CommandPhase extends FieldPhase { // Decides between a Disabled, Not Implemented, or No PP translation message const errorMessage = - playerPokemon.isMoveDisabled(move.moveId) ? "battle:moveDisabled" : - move.getName().endsWith(" (N)") ? "battle:moveNotImplemented" : "battle:moveNoPP"; + playerPokemon.isMoveDisabled(move.moveId) + ? playerPokemon.getDisablingTag(move.moveId)?.selectionDeniedText(playerPokemon, move.moveId) + : move.getName().endsWith(" (N)") ? "battle:moveNotImplemented" : "battle:moveNoPP"; const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator this.scene.ui.showText(i18next.t(errorMessage, { moveName: moveName }), null, () => {