From c842f198f12ca54741840936584efae6730becbb Mon Sep 17 00:00:00 2001 From: jnotsknab Date: Thu, 19 Jun 2025 19:51:14 -0500 Subject: [PATCH] Revised Changes on how tranformed pokemon are referenced to align with reviewer's suggestions --- src/data/abilities/ability.ts | 3 +-- src/data/battler-tags.ts | 21 --------------------- src/field/pokemon.ts | 4 ++++ src/phases/move-phase.ts | 2 +- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 2c14b6ec795..17c1e02d773 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -3909,10 +3909,9 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr { override canApplyPostSummon(pokemon: Pokemon, _passive: boolean, simulated: boolean, _args: any[]): boolean { const targets = pokemon.getOpponents(); const target = this.getTarget(targets); - const user = pokemon; //Prevents Imposter from triggering on a transformed target or if the user is already transformed - if (user?.getTag(BattlerTagType.TRANSFORM) || target?.getTag(BattlerTagType.TRANSFORM)) { + if (pokemon?.isTransformed() || target?.isTransformed()) { return false; } diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 2b1f47d9757..8405fd1dd4d 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -3221,25 +3221,6 @@ export class ImprisonTag extends MoveRestrictionBattlerTag { } } -/** - * Battler Tag indicating that a Pokémon has used {@linkcode MoveId.TRANSFORM} - * - * The tag allows us to prevent certain actions such as using Transform on a Pokemon which has already transformed, - * and is used to ensure correct battle behavior after transformation. - */ -export class TransformTag extends BattlerTag { - constructor(sourceId: number) { - super(BattlerTagType.TRANSFORM, BattlerTagLapseType.MOVE, Number.MAX_SAFE_INTEGER, MoveId.TRANSFORM, sourceId); - } - /** - * Adds the Transform battler tag to the Pokemon transforming. - * @param pokemon - The {@linkcode Pokemon} transforming - */ - override onAdd(pokemon: Pokemon): void { - super.onAdd(pokemon); - } -} - /** * Battler Tag that applies the effects of Syrup Bomb to the target Pokemon. * For three turns, starting from the turn of hit, at the end of each turn, the target Pokemon's speed will decrease by 1. @@ -3648,8 +3629,6 @@ export function getBattlerTag( return new TauntTag(); case BattlerTagType.IMPRISON: return new ImprisonTag(sourceId); - case BattlerTagType.TRANSFORM: - return new TransformTag(sourceId); case BattlerTagType.SYRUP_BOMB: return new SyrupBombTag(sourceId); case BattlerTagType.TELEKINESIS: diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index e9cc4f70d70..deeffd736e8 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1062,6 +1062,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return species; } + isTransformed(): boolean { + return this.summonData.speciesForm !== null; + } + /** * @param {boolean} useIllusion - Whether we want the fusionSpeciesForm of the illusion or not. */ diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index 0feb3032b27..df2697f17a8 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -342,7 +342,7 @@ export class MovePhase extends BattlePhase { if ( //Prevent using Transform if either the user or target is already transformed this.move.getMove().id === MoveId.TRANSFORM && - (targets[0].getTag(BattlerTagType.TRANSFORM) || this.pokemon.getTag(BattlerTagType.TRANSFORM)) + (targets[0].isTransformed() || this.pokemon.isTransformed()) ) { this.showMoveText(); this.showFailedText();