Revised Changes on how tranformed pokemon are referenced to align with reviewer's suggestions

This commit is contained in:
jnotsknab 2025-06-19 19:51:14 -05:00
parent f80211406f
commit c842f198f1
4 changed files with 6 additions and 24 deletions

View File

@ -3909,10 +3909,9 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
override canApplyPostSummon(pokemon: Pokemon, _passive: boolean, simulated: boolean, _args: any[]): boolean { override canApplyPostSummon(pokemon: Pokemon, _passive: boolean, simulated: boolean, _args: any[]): boolean {
const targets = pokemon.getOpponents(); const targets = pokemon.getOpponents();
const target = this.getTarget(targets); const target = this.getTarget(targets);
const user = pokemon;
//Prevents Imposter from triggering on a transformed target or if the user is already transformed //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; return false;
} }

View File

@ -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. * 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. * 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(); return new TauntTag();
case BattlerTagType.IMPRISON: case BattlerTagType.IMPRISON:
return new ImprisonTag(sourceId); return new ImprisonTag(sourceId);
case BattlerTagType.TRANSFORM:
return new TransformTag(sourceId);
case BattlerTagType.SYRUP_BOMB: case BattlerTagType.SYRUP_BOMB:
return new SyrupBombTag(sourceId); return new SyrupBombTag(sourceId);
case BattlerTagType.TELEKINESIS: case BattlerTagType.TELEKINESIS:

View File

@ -1062,6 +1062,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return species; return species;
} }
isTransformed(): boolean {
return this.summonData.speciesForm !== null;
}
/** /**
* @param {boolean} useIllusion - Whether we want the fusionSpeciesForm of the illusion or not. * @param {boolean} useIllusion - Whether we want the fusionSpeciesForm of the illusion or not.
*/ */

View File

@ -342,7 +342,7 @@ export class MovePhase extends BattlePhase {
if ( if (
//Prevent using Transform if either the user or target is already transformed //Prevent using Transform if either the user or target is already transformed
this.move.getMove().id === MoveId.TRANSFORM && 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.showMoveText();
this.showFailedText(); this.showFailedText();