Moved the check for whether Transform can be used within the TransformAttr class as suggested and removed uneccesary moveId check

This commit is contained in:
jnotsknab 2025-06-20 02:10:41 -05:00
parent fb11f7377b
commit eab4f6e01f
2 changed files with 2 additions and 13 deletions

View File

@ -7610,13 +7610,13 @@ export class SuppressAbilitiesIfActedAttr extends MoveEffectAttr {
*/
export class TransformAttr extends MoveEffectAttr {
override apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (!super.apply(user, target, move, args)) {
if (!super.apply(user, target, move, args) || (target.isTransformed() || user.isTransformed())) {
globalScene.phaseManager.queueMessage(i18next.t("battle:attackFailed"));
return false;
}
globalScene.phaseManager.unshiftNew("PokemonTransformPhase", user.getBattlerIndex(), target.getBattlerIndex());
return true;
}
}

View File

@ -339,17 +339,6 @@ export class MovePhase extends BattlePhase {
this.showMoveText();
}
if (
//Prevent using Transform if either the user or target is already transformed
this.move.getMove().id === MoveId.TRANSFORM &&
(targets[0].isTransformed() || this.pokemon.isTransformed())
) {
this.showMoveText();
this.showFailedText();
this.end();
return;
}
// Clear out any two turn moves once they've been used.
// TODO: Refactor move queues and remove this assignment;
// Move queues should be handled by the calling `CommandPhase` or a manager for it