Compare commits

...

4 Commits

Author SHA1 Message Date
Jonathan Bankston
f4e60752bc
Merge f80211406f into 6873a89296 2025-06-18 22:57:25 -05:00
jnotsknab
f80211406f Revised Comments 2025-06-18 18:15:53 -05:00
jnotsknab
0a2e6e1cec Updated Comments 2025-06-18 18:03:02 -05:00
jnotsknab
9e892597ea Fixed Transform and Imposter Bug 2025-06-18 16:55:31 -05:00
6 changed files with 42 additions and 2 deletions

View File

@ -3909,8 +3909,14 @@ 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;
if (target.summonData.illusion) {
//Prevents Imposter from triggering on a transformed target or if the user is already transformed
if (user?.getTag(BattlerTagType.TRANSFORM) || target?.getTag(BattlerTagType.TRANSFORM)) {
return false;
}
if (target?.summonData?.illusion) {
return false;
}

View File

@ -3221,6 +3221,25 @@ 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.
@ -3629,6 +3648,8 @@ 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:

View File

@ -7599,7 +7599,6 @@ export class TransformAttr extends MoveEffectAttr {
globalScene.phaseManager.unshiftNew("PokemonTransformPhase", user.getBattlerIndex(), target.getBattlerIndex());
globalScene.phaseManager.queueMessage(i18next.t("moveTriggers:transformedIntoTarget", { pokemonName: getPokemonNameWithAffix(user), targetName: getPokemonNameWithAffix(target) }));
return true;
}

View File

@ -85,6 +85,7 @@ export enum BattlerTagType {
HEAL_BLOCK = "HEAL_BLOCK",
TORMENT = "TORMENT",
TAUNT = "TAUNT",
TRANSFORM = "TRANSFORM",
IMPRISON = "IMPRISON",
SYRUP_BOMB = "SYRUP_BOMB",
ELECTRIFIED = "ELECTRIFIED",

View File

@ -339,6 +339,17 @@ 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].getTag(BattlerTagType.TRANSFORM) || this.pokemon.getTag(BattlerTagType.TRANSFORM))
) {
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

View File

@ -39,6 +39,8 @@ export class PokemonTransformPhase extends PokemonPhase {
// Power Trick's effect is removed after using Transform
user.removeTag(BattlerTagType.POWER_TRICK);
//Begin tracking Pokemon as transformed
user.addTag(BattlerTagType.TRANSFORM);
// Copy all stats (except HP)
for (const s of EFFECTIVE_STATS) {