mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-09 09:52:17 +02:00
Add abstract function for message when player tries to select the disabled move
This commit is contained in:
parent
ba50b4b093
commit
63d244790f
@ -98,8 +98,6 @@ export interface TerrainBattlerTag {
|
|||||||
* to select disabled moves.
|
* to select disabled moves.
|
||||||
*/
|
*/
|
||||||
export abstract class DisablingBattlerTag extends BattlerTag {
|
export abstract class DisablingBattlerTag extends BattlerTag {
|
||||||
abstract moveIsDisabled(move: Moves): boolean;
|
|
||||||
|
|
||||||
constructor(tagType: BattlerTagType, turnCount: integer, sourceMove?: Moves, sourceId?: integer) {
|
constructor(tagType: BattlerTagType, turnCount: integer, sourceMove?: Moves, sourceId?: integer) {
|
||||||
super(tagType, [ BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.TURN_END ], turnCount, sourceMove, sourceId);
|
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);
|
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.
|
* 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
|
* 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 }));
|
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 {
|
override interruptedText(pokemon: Pokemon, move: Moves): string {
|
||||||
return i18next.t("battle:disableInterruptedMove", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), moveName: allMoves[move].name });
|
return i18next.t("battle:disableInterruptedMove", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), moveName: allMoves[move].name });
|
||||||
}
|
}
|
||||||
|
@ -2020,8 +2020,9 @@ export class CommandPhase extends FieldPhase {
|
|||||||
|
|
||||||
// Decides between a Disabled, Not Implemented, or No PP translation message
|
// Decides between a Disabled, Not Implemented, or No PP translation message
|
||||||
const errorMessage =
|
const errorMessage =
|
||||||
playerPokemon.isMoveDisabled(move.moveId) ? "battle:moveDisabled" :
|
playerPokemon.isMoveDisabled(move.moveId)
|
||||||
move.getName().endsWith(" (N)") ? "battle:moveNotImplemented" : "battle:moveNoPP";
|
? 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
|
const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator
|
||||||
|
|
||||||
this.scene.ui.showText(i18next.t(errorMessage, { moveName: moveName }), null, () => {
|
this.scene.ui.showText(i18next.t(errorMessage, { moveName: moveName }), null, () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user