[Beta][P3] Fix failed charge moves not displaying failed text (#4853)

This commit is contained in:
PigeonBar 2024-11-12 06:29:37 -05:00 committed by GitHub
parent 8e26db944d
commit 6f3fd0f138
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View File

@ -668,12 +668,12 @@ export default class Move implements Localizable {
} }
/** /**
* Sees if, given the target pokemon, a move fails on it (by looking at each {@linkcode MoveAttr} of this move * Sees if a move has a custom failure text (by looking at each {@linkcode MoveAttr} of this move)
* @param user {@linkcode Pokemon} using the move * @param user {@linkcode Pokemon} using the move
* @param target {@linkcode Pokemon} receiving the move * @param target {@linkcode Pokemon} receiving the move
* @param move {@linkcode Move} using the move * @param move {@linkcode Move} using the move
* @param cancelled {@linkcode Utils.BooleanHolder} to hold boolean value * @param cancelled {@linkcode Utils.BooleanHolder} to hold boolean value
* @returns string of the failed text, or null * @returns string of the custom failure text, or `null` if it uses the default text ("But it failed!")
*/ */
getFailedText(user: Pokemon, target: Pokemon, move: Move, cancelled: Utils.BooleanHolder): string | null { getFailedText(user: Pokemon, target: Pokemon, move: Move, cancelled: Utils.BooleanHolder): string | null {
for (const attr of this.attrs) { for (const attr of this.attrs) {

View File

@ -378,10 +378,8 @@ export class MovePhase extends BattlePhase {
this.pokemon.pushMoveHistory({ move: this.move.moveId, targets: this.targets, result: MoveResult.FAIL, virtual: this.move.virtual }); this.pokemon.pushMoveHistory({ move: this.move.moveId, targets: this.targets, result: MoveResult.FAIL, virtual: this.move.virtual });
const failureMessage = move.getFailedText(this.pokemon, targets[0], move, new BooleanHolder(false)); const failureMessage = move.getFailedText(this.pokemon, targets[0], move, new BooleanHolder(false));
if (failureMessage) { this.showMoveText();
this.showMoveText(); this.showFailedText(failureMessage ?? undefined);
this.showFailedText(failureMessage);
}
// Remove the user from its semi-invulnerable state (if applicable) // Remove the user from its semi-invulnerable state (if applicable)
this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT); this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT);