Revert "tag must not removed & changed test"

This reverts commit bba6418bd5.
This commit is contained in:
cadi 2024-09-13 21:56:11 +09:00
parent 56aebf4154
commit 16a71c2fd4
2 changed files with 19 additions and 15 deletions

View File

@ -2210,7 +2210,6 @@ export class TarShotTag extends BattlerTag {
pokemon.scene.queueMessage(i18next.t("battlerTags:tarShotOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
}
}
/**
* Tag that swaps the user's base ATK stat with its base DEF stat.
* @extends BattlerTag
@ -2225,13 +2224,17 @@ export class PowerTrickTag extends BattlerTag {
pokemon.scene.queueMessage(i18next.t("battlerTags:powerTrickActive", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
}
onRemove(pokemon: Pokemon): void {
this.swapStat(pokemon);
pokemon.scene.queueMessage(i18next.t("battlerTags:powerTrickActive", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
}
/**
* Active stat swap again if the tag overlaps. tag will be remain.
* Removes the Power Trick tag and reverts any stat changes if the tag is already applied.
* @param {Pokemon} pokemon The {@linkcode Pokemon} that already has the Power Trick tag.
*/
onOverlap(pokemon: Pokemon): void {
this.swapStat(pokemon);
pokemon.scene.queueMessage(i18next.t("battlerTags:powerTrickActive", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
pokemon.removeTag(this.tagType);
}
/**

View File

@ -68,27 +68,28 @@ describe("Moves - Power Trick", () => {
expect(player.getStat(Stat.ATK, false)).toBe(baseATK);
expect(player.getStat(Stat.DEF, false)).toBe(baseDEF);
expect(player.getTag(BattlerTagType.POWER_TRICK)).toBeDefined();
expect(player.getTag(BattlerTagType.POWER_TRICK)).toBeUndefined();
}, 20000);
it("effect should be passed with the tag when using BATON_PASS", async () => {
it("should pass effect when using BATON_PASS", async () => {
await game.classicMode.startBattle([Species.SHUCKLE, Species.SHUCKLE]);
await game.override.moveset([Moves.BATON_PASS]);
await game.override.moveset([Moves.POWER_TRICK, Moves.BATON_PASS]);
const player = game.scene.getPlayerPokemon()!;
player.addTag(BattlerTagType.POWER_TRICK);
game.move.select(Moves.POWER_TRICK);
await game.phaseInterceptor.to(TurnEndPhase);
game.move.select(Moves.BATON_PASS);
game.doSelectPartyPokemon(1);
await game.phaseInterceptor.to(TurnEndPhase);
const switchedPlayer = game.scene.getPlayerPokemon()!;
const baseATK = switchedPlayer.getStat(Stat.ATK);
const baseDEF = switchedPlayer.getStat(Stat.DEF);
const player = game.scene.getPlayerPokemon()!;
const baseATK = player.getStat(Stat.ATK);
const baseDEF = player.getStat(Stat.DEF);
expect(switchedPlayer.getStat(Stat.ATK, false)).toBe(baseDEF);
expect(switchedPlayer.getStat(Stat.DEF, false)).toBe(baseATK);
expect(switchedPlayer.getTag(BattlerTagType.POWER_TRICK)).toBeDefined();
expect(player.getStat(Stat.ATK, false)).toBe(baseDEF);
expect(player.getStat(Stat.DEF, false)).toBe(baseATK);
expect(player.getTag(BattlerTagType.POWER_TRICK)).toBeDefined();
}, 20000);
});