[Bug] Fixes bug with freezy frost not eliminating all Pokemon's stat changes (#3362)

* Cherrypick due to beta roll back

* Adds corrected stat eliminated message to move trigger, removes from battle.ts

* Adds check for Clear Smog vs Haze/Freezy Frost for targetting purposes

* Adds translations for fr, de, and pt_br

* Update src/locales/ko/move-trigger.ts with translation

Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com>

* Update korean move-trigger.ts with proper translation

* Update src/locales/zh_CN/move-trigger.ts with translation

Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com>

* Update src/locales/zh_TW/move-trigger.ts with translation

Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com>

* Adds locales to ja and ca-ES

* Creates unit test for Haze

* Removes repeats option on Haze test left from testing

* Updates title of haze tests, creates freezy frost tests

* Update src/locales/es/move-trigger.ts with translation

Co-authored-by: Asdar <asdargmng@gmail.com>

* Fixes freezy_frost.test.ts copy errors from Haze test

---------

Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com>
Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com>
Co-authored-by: Asdar <asdargmng@gmail.com>
This commit is contained in:
schmidtc1 2024-08-09 10:16:38 -04:00 committed by GitHub
parent fe429d0c8c
commit 57a4e1cc47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 196 additions and 11 deletions

View File

@ -2742,21 +2742,34 @@ export class InvertStatsAttr extends MoveEffectAttr {
}
export class ResetStatsAttr extends MoveEffectAttr {
private targetAllPokemon: boolean;
constructor(targetAllPokemon: boolean) {
super();
this.targetAllPokemon = targetAllPokemon;
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (!super.apply(user, target, move, args)) {
return false;
}
for (let s = 0; s < target.summonData.battleStats.length; s++) {
target.summonData.battleStats[s] = 0;
if (this.targetAllPokemon) { // Target all pokemon on the field when Freezy Frost or Haze are used
const activePokemon = user.scene.getField(true);
activePokemon.forEach(p => this.resetStats(p));
target.scene.queueMessage(i18next.t("moveTriggers:statEliminated"));
} else { // Affects only the single target when Clear Smog is used
this.resetStats(target);
target.scene.queueMessage(i18next.t("moveTriggers:resetStats", {pokemonName: getPokemonNameWithAffix(target)}));
}
target.updateInfo();
user.updateInfo();
target.scene.queueMessage(i18next.t("moveTriggers:resetStats", {pokemonName: getPokemonNameWithAffix(target)}));
return true;
}
resetStats(pokemon: Pokemon) {
for (let s = 0; s < pokemon.summonData.battleStats.length; s++) {
pokemon.summonData.battleStats[s] = 0;
}
pokemon.updateInfo();
}
}
/**
@ -6437,9 +6450,8 @@ export function initMoves() {
new StatusMove(Moves.LIGHT_SCREEN, Type.PSYCHIC, -1, 30, -1, 0, 1)
.attr(AddArenaTagAttr, ArenaTagType.LIGHT_SCREEN, 5, true)
.target(MoveTarget.USER_SIDE),
new StatusMove(Moves.HAZE, Type.ICE, -1, 30, -1, 0, 1)
.target(MoveTarget.BOTH_SIDES)
.attr(ResetStatsAttr),
new SelfStatusMove(Moves.HAZE, Type.ICE, -1, 30, -1, 0, 1)
.attr(ResetStatsAttr, true),
new StatusMove(Moves.REFLECT, Type.PSYCHIC, -1, 20, -1, 0, 1)
.attr(AddArenaTagAttr, ArenaTagType.REFLECT, 5, true)
.target(MoveTarget.USER_SIDE),
@ -7526,7 +7538,7 @@ export function initMoves() {
new AttackMove(Moves.CHIP_AWAY, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 20, -1, 0, 5)
.attr(IgnoreOpponentStatChangesAttr),
new AttackMove(Moves.CLEAR_SMOG, Type.POISON, MoveCategory.SPECIAL, 50, -1, 15, -1, 0, 5)
.attr(ResetStatsAttr),
.attr(ResetStatsAttr, false),
new AttackMove(Moves.STORED_POWER, Type.PSYCHIC, MoveCategory.SPECIAL, 20, 100, 10, -1, 0, 5)
.attr(StatChangeCountPowerAttr),
new StatusMove(Moves.QUICK_GUARD, Type.FIGHTING, -1, 15, -1, 3, 5)
@ -8232,7 +8244,7 @@ export function initMoves() {
.makesContact(false)
.attr(AddBattlerTagAttr, BattlerTagType.SEEDED),
new AttackMove(Moves.FREEZY_FROST, Type.ICE, MoveCategory.SPECIAL, 100, 90, 10, -1, 0, 7)
.attr(ResetStatsAttr),
.attr(ResetStatsAttr, true),
new AttackMove(Moves.SPARKLY_SWIRL, Type.FAIRY, MoveCategory.SPECIAL, 120, 85, 5, -1, 0, 7)
.attr(PartyStatusCureAttr, null, Abilities.NONE),
new AttackMove(Moves.VEEVEE_VOLLEY, Type.NORMAL, MoveCategory.PHYSICAL, -1, -1, 20, -1, 0, 7)

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"statEliminated": "All stat changes were eliminated!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type became the same as\n{{targetPokemonName}}'s type!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "Das Heilopfer von {{pokemonName}} erreicht sein Ziel!",
"invertStats": "Alle Statusveränderungen von {{pokemonName}} wurden invertiert!",
"resetStats": "Die Statusveränderungen von {{pokemonName}} wurden aufgehoben!",
"statEliminated": "Alle Statusveränderungen wurden aufgehoben!",
"faintCountdown": "{{pokemonName}} geht nach {{turnCount}} Runden K.O.!",
"copyType": "{{pokemonName}} hat den Typ von {{targetPokemonName}} angenommen!",
"suppressAbilities": "Die Fähigkeit von {{pokemonName}} wirkt nicht mehr!",

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"statEliminated": "All stat changes were eliminated!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type became the same as\n{{targetPokemonName}}'s type!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"statEliminated": "¡Los cambios en estadísticas fueron eliminados!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type\nchanged to match {{targetPokemonName}}'s!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "Le Vœu Soin est exaucé et profite\nà {{pokemonName}} !",
"invertStats": "Les changements de stats\nde {{pokemonName}} sont inversés !",
"resetStats": "Les changements de stats\nde {{pokemonName}} ont tous été annulés !",
"statEliminated": "Les changements de stats ont tous été annulés !",
"faintCountdown": "{{pokemonName}}\nsera K.O. dans {{turnCount}} tours !",
"copyType": "{{pokemonName}} prend le type\nde {{targetPokemonName}} !",
"suppressAbilities": "Le talent de {{pokemonName}}\na été rendu inactif !",

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "{{pokemonName}} riceve i benefici\neffetti di Curardore!",
"invertStats": "Le modifiche alle statistiche di {{pokemonName}}\nvengono invertite!",
"resetStats": "Tutte le modifiche alle statistiche sono state annullate!",
"statEliminated": "All stat changes were eliminated!",
"faintCountdown": "{{pokemonName}}\nandrà KO dopo {{turnCount}} turni.",
"copyType": "{{pokemonName}} assume il tipo\ndi {{targetPokemonName}}!",
"suppressAbilities": "Labilità di {{pokemonName}}\nperde ogni efficacia!",

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "{{pokemonName}}の\nねがいごとが かなった",
"invertStats": "{{pokemonName}}の\nのうりょくへんかが ぎゃくてんした",
"resetStats": "{{pokemonName}}の\nのうりょくへんかが もとにもどった",
"statEliminated": "All stat changes were eliminated!",
"faintCountdown": "{{pokemonName}}は\n{{turnCount}}ターンごに ほろびてしまう!",
"copyType": "{{pokemonName}}は {{targetPokemonName}}と\n同じタイプに なった",
"suppressAbilities": "{{pokemonName}}の とくせいが きかなくなった!",

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "{{pokemonName}}의\n치유소원이 이루어졌다!",
"invertStats": "{{pokemonName}}[[는]]\n능력 변화가 뒤집혔다!",
"resetStats": "{{pokemonName}}의 모든 상태가\n원래대로 되돌아왔다!",
"statEliminated": "모든 상태가 원래대로 되돌아왔다!",
"faintCountdown": "{{pokemonName}}[[는]]\n{{turnCount}}턴 후에 쓰러져 버린다!",
"copyType": "{{pokemonName}}[[는]]\n{{targetPokemonName}}[[와]] 같은 타입이 되었다!",
"suppressAbilities": "{{pokemonName}}의\n특성이 효과를 발휘하지 못하게 되었다!",

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "O Healing Wish de {{pokemonName}}\nfoi concedido!",
"invertStats": "As mudanças de atributo de {{pokemonName}}\nforam revertidas!",
"resetStats": "As mudanças de atributo de {{pokemonName}}\nforam eliminadas!",
"statEliminated": "Todas as mudanças de atributo foram eliminadas!",
"faintCountdown": "{{pokemonName}}\nirá desmaiar em {{turnCount}} turnos.",
"copyType": "O tipo de {{pokemonName}}\nmudou para combinar com {{targetPokemonName}}!",
"suppressAbilities": "A habilidade de {{pokemonName}}\nfoi suprimida!",

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "{{pokemonName}}的\n治愈之愿实现了",
"invertStats": "{{pokemonName}}的\n能力变化颠倒过来了",
"resetStats": "{{pokemonName}}的\n能力变化复原了",
"statEliminated": "所有能力都复原了!",
"faintCountdown": "{{pokemonName}}\n将在{{turnCount}}回合后灭亡!",
"copyType": "{{pokemonName}}\n变成了{{targetPokemonName}}的属性!",
"suppressAbilities": "{{pokemonName}}的特性\n变得无效了",

View File

@ -56,6 +56,7 @@ export const moveTriggers: SimpleTranslationEntries = {
"sacrificialFullRestore": "{{pokemonName}}的\n治癒之願實現了",
"invertStats": "{{pokemonName}}的\n能力變化顛倒過來了",
"resetStats": "{{pokemonName}}的\n能力變化復原了",
"statEliminated": "所有能力都復原了!",
"faintCountdown": "{{pokemonName}}\n將在{{turnCount}}回合後滅亡!",
"copyType": "{{pokemonName}}變成了{{targetPokemonName}}的屬性!",
"suppressAbilities": "{{pokemonName}}的特性\n變得無效了",

View File

@ -0,0 +1,82 @@
import { BattleStat } from "#app/data/battle-stat";
import { MoveEndPhase, TurnInitPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { allMoves } from "#app/data/move.js";
describe("Moves - Freezy Frost", () => {
describe("integration tests", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({ type: Phaser.HEADLESS });
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
game.override.enemySpecies(Species.RATTATA);
game.override.enemyLevel(100);
game.override.enemyMoveset(SPLASH_ONLY);
game.override.enemyAbility(Abilities.NONE);
game.override.startingLevel(100);
game.override.moveset([Moves.FREEZY_FROST, Moves.SWORDS_DANCE, Moves.CHARM, Moves.SPLASH]);
vi.spyOn(allMoves[Moves.FREEZY_FROST], "accuracy", "get").mockReturnValue(100);
game.override.ability(Abilities.NONE);
});
it("Uses Swords Dance to raise own ATK by 2, Charm to lower enemy ATK by 2, player uses Freezy Frost to clear all stat changes", { timeout: 10000 }, async () => {
await game.startBattle([Species.RATTATA]);
const user = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
expect(enemy.summonData.battleStats[BattleStat.ATK]).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.SWORDS_DANCE));
await game.phaseInterceptor.to(TurnInitPhase);
game.doAttack(getMovePosition(game.scene, 0, Moves.CHARM));
await game.phaseInterceptor.to(TurnInitPhase);
const userAtkBefore = user.summonData.battleStats[BattleStat.ATK];
const enemyAtkBefore = enemy.summonData.battleStats[BattleStat.ATK];
expect(userAtkBefore).toBe(2);
expect(enemyAtkBefore).toBe(-2);
game.doAttack(getMovePosition(game.scene, 0, Moves.FREEZY_FROST));
await game.phaseInterceptor.to(TurnInitPhase);
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
expect(enemy.summonData.battleStats[BattleStat.ATK]).toBe(0);
});
it("Uses Swords Dance to raise own ATK by 2, Charm to lower enemy ATK by 2, enemy uses Freezy Frost to clear all stat changes", { timeout: 10000 }, async () => {
game.override.enemyMoveset([Moves.FREEZY_FROST, Moves.FREEZY_FROST, Moves.FREEZY_FROST, Moves.FREEZY_FROST]);
await game.startBattle([Species.SHUCKLE]); // Shuckle for slower Swords Dance on first turn so Freezy Frost doesn't affect it.
const user = game.scene.getPlayerPokemon()!;
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.SWORDS_DANCE));
await game.phaseInterceptor.to(TurnInitPhase);
const userAtkBefore = user.summonData.battleStats[BattleStat.ATK];
expect(userAtkBefore).toBe(2);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
await game.phaseInterceptor.to(MoveEndPhase);
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
});
});
});

View File

@ -0,0 +1,80 @@
import { BattleStat } from "#app/data/battle-stat";
import { MoveEndPhase, TurnInitPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
describe("Moves - Haze", () => {
describe("integration tests", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({ type: Phaser.HEADLESS });
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
game.override.enemySpecies(Species.RATTATA);
game.override.enemyLevel(100);
game.override.enemyMoveset(SPLASH_ONLY);
game.override.enemyAbility(Abilities.NONE);
game.override.startingLevel(100);
game.override.moveset([Moves.HAZE, Moves.SWORDS_DANCE, Moves.CHARM, Moves.SPLASH]);
game.override.ability(Abilities.NONE);
});
it("Uses Swords Dance to raise own ATK by 2, Charm to lower enemy ATK by 2, player uses Haze to clear all stat changes", { timeout: 10000 }, async () => {
await game.startBattle([Species.RATTATA]);
const user = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
expect(enemy.summonData.battleStats[BattleStat.ATK]).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.SWORDS_DANCE));
await game.phaseInterceptor.to(TurnInitPhase);
game.doAttack(getMovePosition(game.scene, 0, Moves.CHARM));
await game.phaseInterceptor.to(TurnInitPhase);
const userAtkBefore = user.summonData.battleStats[BattleStat.ATK];
const enemyAtkBefore = enemy.summonData.battleStats[BattleStat.ATK];
expect(userAtkBefore).toBe(2);
expect(enemyAtkBefore).toBe(-2);
game.doAttack(getMovePosition(game.scene, 0, Moves.HAZE));
await game.phaseInterceptor.to(TurnInitPhase);
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
expect(enemy.summonData.battleStats[BattleStat.ATK]).toBe(0);
});
it("Uses Swords Dance to raise own ATK by 2, Charm to lower enemy ATK by 2, enemy uses Haze to clear all stat changes", { timeout: 10000 }, async () => {
game.override.enemyMoveset([Moves.HAZE, Moves.HAZE, Moves.HAZE, Moves.HAZE]);
await game.startBattle([Species.SHUCKLE]); // Shuckle for slower Swords Dance on first turn so Haze doesn't affect it.
const user = game.scene.getPlayerPokemon()!;
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.SWORDS_DANCE));
await game.phaseInterceptor.to(TurnInitPhase);
const userAtkBefore = user.summonData.battleStats[BattleStat.ATK];
expect(userAtkBefore).toBe(2);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
await game.phaseInterceptor.to(MoveEndPhase);
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
});
});
});