diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index b9d32e01fd3..d8094f96368 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -137,10 +137,9 @@ export abstract class MoveRestrictionBattlerTag extends BattlerTag { * Gets whether this tag is restricting a move. * * @param {Moves} move {@linkcode Moves} ID to check restriction for. - * @param {Pokemon} user {@linkcode Pokemon} optional parameter for move user * @returns {boolean} `true` if the move is restricted by this tag, otherwise `false`. */ - abstract isMoveRestricted(move: Moves, user?: Pokemon): boolean; + abstract isMoveRestricted(move: Moves): boolean; /** * Checks if this tag is restricting a move based on a user's decisions during the target selection phase @@ -298,15 +297,7 @@ export class GorillaTacticsTag extends MoveRestrictionBattlerTag { } /** @override */ - override isMoveRestricted(move: Moves, user: Pokemon): boolean { - if (this.moveId === Moves.NONE) { - const validMove = this.getLastValidMove(user); - if (validMove) { - this.moveId = validMove; - } else { - return true; - } - } + override isMoveRestricted(move: Moves): boolean { return move !== this.moveId; } @@ -2491,6 +2482,7 @@ export class MysteryEncounterPostSummonTag extends BattlerTag { * Torment does not interrupt the move if the move is performed consecutively in the same turn and right after Torment is applied */ export class TormentTag extends MoveRestrictionBattlerTag { + private target: Pokemon; constructor(sourceId: number) { super(BattlerTagType.TORMENT, BattlerTagLapseType.AFTER_MOVE, 1, Moves.TORMENT, sourceId); @@ -2503,6 +2495,7 @@ export class TormentTag extends MoveRestrictionBattlerTag { */ override onAdd(pokemon: Pokemon) { super.onAdd(pokemon); + this.target = pokemon; pokemon.scene.queueMessage(i18next.t("battlerTags:tormentOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }), 1500); } @@ -2521,15 +2514,15 @@ export class TormentTag extends MoveRestrictionBattlerTag { * @param {Moves} move the move under investigation * @returns `true` if there is valid consecutive usage | `false` if the moves are different from each other */ - override isMoveRestricted(move: Moves, user: Pokemon): boolean { - const lastMove = user.getLastXMoves(1)[0]; + override isMoveRestricted(move: Moves): boolean { + const lastMove = this.target.getLastXMoves(1)[0]; if ( !lastMove ) { return false; } // This checks for locking / momentum moves like Rollout and Hydro Cannon + if the user is under the influence of BattlerTagType.FRENZY // Because Uproar's unique behavior is not implemented, it does not check for Uproar. Torment has been marked as partial in moves.ts const moveObj = allMoves[lastMove.move]; - const isUnaffected = moveObj.hasAttr(ConsecutiveUseDoublePowerAttr) || user.getTag(BattlerTagType.FRENZY) || moveObj.hasAttr(ChargeAttr); + const isUnaffected = moveObj.hasAttr(ConsecutiveUseDoublePowerAttr) || this.target.getTag(BattlerTagType.FRENZY) || moveObj.hasAttr(ChargeAttr); const validLastMoveResult = (lastMove.result === MoveResult.SUCCESS) || (lastMove.result === MoveResult.MISS); if (lastMove.move === move && validLastMoveResult && lastMove.move !== Moves.STRUGGLE && !isUnaffected) { return true; @@ -2608,10 +2601,7 @@ export class ImprisonTag extends MoveRestrictionBattlerTag { * @param {Moves} move the move under investigation * @returns `false` if either condition is not met */ - override isMoveRestricted(move: Moves, user: Pokemon): boolean { - if (!this.source && this.sourceId) { - this.source = user.scene.getPokemonById(this.sourceId); - } + override isMoveRestricted(move: Moves): boolean { if (this.source) { const sourceMoveset = this.source.getMoveset().map(m => m!.moveId); return sourceMoveset?.includes(move) && this.source.isActive(true); diff --git a/src/data/move.ts b/src/data/move.ts index d9efd2cc3bd..748f81cdd8b 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -7606,8 +7606,7 @@ export function initMoves() { .attr(SwitchAbilitiesAttr), new StatusMove(Moves.IMPRISON, Type.PSYCHIC, 100, 10, -1, 0, 3) .ignoresSubstitute() - .attr(AddArenaTagAttr, ArenaTagType.IMPRISON, 1, true, false) - .target(MoveTarget.ENEMY_SIDE), + .attr(AddArenaTagAttr, ArenaTagType.IMPRISON, 1, true, false), new SelfStatusMove(Moves.REFRESH, Type.NORMAL, -1, 20, -1, 0, 3) .attr(HealStatusEffectAttr, true, StatusEffect.PARALYSIS, StatusEffect.POISON, StatusEffect.TOXIC, StatusEffect.BURN) .condition((user, target, move) => !!user.status && (user.status.effect === StatusEffect.PARALYSIS || user.status.effect === StatusEffect.POISON || user.status.effect === StatusEffect.TOXIC || user.status.effect === StatusEffect.BURN)), diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 2252b353dcd..c66da0572ad 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3059,7 +3059,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { */ getRestrictingTag(moveId: Moves, user?: Pokemon, target?: Pokemon): MoveRestrictionBattlerTag | null { for (const tag of this.findTags(t => t instanceof MoveRestrictionBattlerTag)) { - if ((tag as MoveRestrictionBattlerTag).isMoveRestricted(moveId, user)) { + if ((tag as MoveRestrictionBattlerTag).isMoveRestricted(moveId)) { return tag as MoveRestrictionBattlerTag; } else if (user && target && (tag as MoveRestrictionBattlerTag).isMoveTargetRestricted(moveId, user, target)) { return tag as MoveRestrictionBattlerTag;