From 194221e50e97e2736f974603d1a02311ab3262fa Mon Sep 17 00:00:00 2001 From: frutescens Date: Fri, 20 Sep 2024 13:01:19 -0700 Subject: [PATCH] Still need to update tests and write docs --- src/data/battler-tags.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 833b5106ad5..3d718f128ed 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -3,7 +3,7 @@ import { getPokemonNameWithAffix } from "../messages"; import Pokemon, { MoveResult, HitResult } from "../field/pokemon"; import { StatusEffect } from "./status-effect"; import * as Utils from "../utils"; -import { ChargeAttr, MoveFlags, allMoves } from "./move"; +import { ChargeAttr, MoveFlags, allMoves, MoveCategory } from "./move"; import { Type } from "./type"; import { BlockNonDirectDamageAbAttr, FlinchEffectAbAttr, ReverseDrainAbAttr, applyAbAttrs, ProtectStatAbAttr } from "./ability"; import { TerrainType } from "./terrain"; @@ -2183,7 +2183,7 @@ export class ExposedTag extends BattlerTag { */ export class HealBlockTag extends MoveRestrictionBattlerTag { constructor() { - super(BattlerTagType.HEAL_BLOCK, 5, Moves.HEAL_BLOCK); + super(BattlerTagType.HEAL_BLOCK, [ BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.TURN_END ], 5, Moves.HEAL_BLOCK); } override onAdd(pokemon: Pokemon): void { @@ -2199,7 +2199,7 @@ export class HealBlockTag extends MoveRestrictionBattlerTag { } override isMoveRestricted(move: Moves): boolean { - if (move.hasFlag(MoveFlags.TRIAGE_MOVE) && move.category() === MoveCategory.STATUS) { + if (allMoves[move].hasFlag(MoveFlags.TRIAGE_MOVE) && allMoves[move].category === MoveCategory.STATUS) { return true; } return false; @@ -2209,15 +2209,14 @@ export class HealBlockTag extends MoveRestrictionBattlerTag { return i18next.t("battle:moveDisabled", { moveName: allMoves[move].name }); } - override isMoveRestricted(move: Moves): boolean { - if (move.hasFlag(MoveFlags.TRIAGE_MOVE) && move.category() === MoveCategory.STATUS) { - return true; - } - return false; - } - - override selectionDeniedText(pokemon: Pokemon, move: Moves): string { - return i18next.t("battle:moveDisabled", { moveName: allMoves[move].name }); + /** + * @override + * @param {Pokemon} pokemon {@linkcode Pokemon} attempting to use the restricted move + * @param {Moves} move {@linkcode Moves} ID of the move being interrupted + * @returns {string} text to display when the move is interrupted + */ + override interruptedText(pokemon: Pokemon, move: Moves): string { + return i18next.t("battle:disableInterruptedMove", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), moveName: allMoves[move].name }); } override onRemove(pokemon: Pokemon): void {