tag must not removed & changed test

This commit is contained in:
cadi 2024-09-13 16:28:41 +09:00
parent efbcbb1dd3
commit bba6418bd5
2 changed files with 15 additions and 19 deletions

View File

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

View File

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