From 24117d1136077d9e3a799236022e5c0c9371a26b Mon Sep 17 00:00:00 2001 From: Mason Date: Fri, 6 Sep 2024 13:56:57 -0400 Subject: [PATCH] Updated tests and localization to new framework/syntax --- src/data/battler-tags.ts | 4 +- src/enums/battler-tag-type.ts | 2 +- src/locales/es/battler-tags.json | 2 +- src/locales/es/battler-tags.ts | 75 -------------------------------- src/test/moves/rage.test.ts | 58 ++++++++++++------------ 5 files changed, 33 insertions(+), 108 deletions(-) delete mode 100644 src/locales/es/battler-tags.ts diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 74aef364a72..957370f357b 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -335,7 +335,7 @@ export class ShellTrapTag extends BattlerTag { */ export class RageTag extends BattlerTag { constructor() { - super(BattlerTagType.RAGE,[BattlerTagLapseType.MOVE_EFFECT],1,Moves.RAGE); + super(BattlerTagType.RAGE, [BattlerTagLapseType.MOVE_EFFECT], 1, Moves.RAGE); } /** @@ -361,7 +361,7 @@ export class RageTag extends BattlerTag { if (lapseType === BattlerTagLapseType.MOVE_EFFECT) { return (pokemon.scene.getCurrentPhase() as MovePhase).move.getMove().id === Moves.RAGE; } else if (lapseType === BattlerTagLapseType.CUSTOM) { - pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [BattleStat.ATK], 1, false)); + pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [Stat.ATK], 1, false)); pokemon.scene.queueMessage(i18next.t("battlerTags:rageOnHit", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon)})); return true; diff --git a/src/enums/battler-tag-type.ts b/src/enums/battler-tag-type.ts index af10f7a8458..6bda0971bfb 100644 --- a/src/enums/battler-tag-type.ts +++ b/src/enums/battler-tag-type.ts @@ -73,5 +73,5 @@ export enum BattlerTagType { SHELL_TRAP = "SHELL_TRAP", RAGE = "RAGE", DRAGON_CHEER = "DRAGON_CHEER", - NO_RETREAT = "NO_RETREAT", + NO_RETREAT = "NO_RETREAT" } diff --git a/src/locales/es/battler-tags.json b/src/locales/es/battler-tags.json index 0805134239c..4171c961600 100644 --- a/src/locales/es/battler-tags.json +++ b/src/locales/es/battler-tags.json @@ -69,6 +69,6 @@ "cursedLapse": "¡{{pokemonNameWithAffix}} es víctima de una maldición!", "stockpilingOnAdd": "¡{{pokemonNameWithAffix}} ha reservado energía por {{stockpiledCount}}ª vez!", "rageOnAdd": "¡La furia de {{pokemonNameWithAffix}} comienza a crecer!", - "rageOnHit": "¡La furia de {{pokemonNameWithAffix}} está aumentando!", + "rageOnHit": "¡La furia de {{pokemonNameWithAffix}} está aumentando!" } diff --git a/src/locales/es/battler-tags.ts b/src/locales/es/battler-tags.ts deleted file mode 100644 index 012fa3a6397..00000000000 --- a/src/locales/es/battler-tags.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { SimpleTranslationEntries } from "#app/interfaces/locales"; - -export const battlerTags: SimpleTranslationEntries = { - "trappedDesc": "trapping", - "flinchedDesc": "flinching", - "confusedDesc": "confusion", - "infatuatedDesc": "infatuation", - "seedDesc": "seeding", - "nightmareDesc": "nightmares", - "ingrainDesc": "roots", - "drowsyDesc": "drowsiness", - "rechargingLapse": "{{pokemonNameWithAffix}} must\nrecharge!", - "trappedOnAdd": "{{pokemonNameWithAffix}} can no\nlonger escape!", - "trappedOnRemove": "{{pokemonNameWithAffix}} was freed\nfrom {{moveName}}!", - "flinchedLapse": "{{pokemonNameWithAffix}} flinched!", - "confusedOnAdd": "{{pokemonNameWithAffix}} became\nconfused!", - "confusedOnRemove": "{{pokemonNameWithAffix}} snapped\nout of confusion!", - "confusedOnOverlap": "{{pokemonNameWithAffix}} is\nalready confused!", - "confusedLapse": "{{pokemonNameWithAffix}} is\nconfused!", - "confusedLapseHurtItself": "It hurt itself in its\nconfusion!", - "destinyBondLapseIsBoss": "{{pokemonNameWithAffix}} is unaffected\nby the effects of Destiny Bond.", - "destinyBondLapse": "{{pokemonNameWithAffix}} took\n{{pokemonNameWithAffix2}} down with it!", - "infatuatedOnAdd": "{{pokemonNameWithAffix}} fell in love\nwith {{sourcePokemonName}}!", - "infatuatedOnOverlap": "{{pokemonNameWithAffix}} is\nalready in love!", - "infatuatedLapse": "{{pokemonNameWithAffix}} is in love\nwith {{sourcePokemonName}}!", - "infatuatedLapseImmobilize": "{{pokemonNameWithAffix}} is\nimmobilized by love!", - "infatuatedOnRemove": "{{pokemonNameWithAffix}} got over\nits infatuation.", - "seededOnAdd": "{{pokemonNameWithAffix}} was seeded!", - "seededLapse": "{{pokemonNameWithAffix}}'s health is\nsapped by Leech Seed!", - "seededLapseShed": "{{pokemonNameWithAffix}}'s Leech Seed\nsucked up the liquid ooze!", - "nightmareOnAdd": "{{pokemonNameWithAffix}} began\nhaving a Nightmare!", - "nightmareOnOverlap": "{{pokemonNameWithAffix}} is\nalready locked in a Nightmare!", - "nightmareLapse": "{{pokemonNameWithAffix}} is locked\nin a Nightmare!", - "encoreOnAdd": "{{pokemonNameWithAffix}} got\nan Encore!", - "encoreOnRemove": "{{pokemonNameWithAffix}}'s Encore\nended!", - "helpingHandOnAdd": "{{pokemonNameWithAffix}} is ready to\nhelp {{pokemonName}}!", - "ingrainLapse": "{{pokemonNameWithAffix}} absorbed\nnutrients with its roots!", - "ingrainOnTrap": "{{pokemonNameWithAffix}} planted its roots!", - "aquaRingOnAdd": "{{pokemonNameWithAffix}} surrounded\nitself with a veil of water!", - "aquaRingLapse": "{{moveName}} restored\n{{pokemonName}}'s HP!", - "drowsyOnAdd": "{{pokemonNameWithAffix}} grew drowsy!", - "damagingTrapLapse": "{{pokemonNameWithAffix}} is hurt\nby {{moveName}}!", - "bindOnTrap": "{{pokemonNameWithAffix}} was squeezed by\n{{sourcePokemonName}}'s {{moveName}}!", - "wrapOnTrap": "{{pokemonNameWithAffix}} was Wrapped\nby {{sourcePokemonName}}!", - "vortexOnTrap": "{{pokemonNameWithAffix}} was trapped\nin the vortex!", - "clampOnTrap": "{{sourcePokemonNameWithAffix}} Clamped\n{{pokemonName}}!", - "sandTombOnTrap": "{{pokemonNameWithAffix}} became trapped\nby {{moveName}}!", - "magmaStormOnTrap": "{{pokemonNameWithAffix}} became trapped\nby swirling magma!", - "snapTrapOnTrap": "{{pokemonNameWithAffix}} got trapped\nby a snap trap!", - "thunderCageOnTrap": "{{sourcePokemonNameWithAffix}} trapped\n{{pokemonNameWithAffix}}!", - "infestationOnTrap": "{{pokemonNameWithAffix}} has been afflicted \nwith an infestation by {{sourcePokemonNameWithAffix}}!", - "protectedOnAdd": "{{pokemonNameWithAffix}}\nprotected itself!", - "protectedLapse": "{{pokemonNameWithAffix}}\nprotected itself!", - "enduringOnAdd": "{{pokemonNameWithAffix}} braced\nitself!", - "enduringLapse": "{{pokemonNameWithAffix}} endured\nthe hit!", - "sturdyLapse": "{{pokemonNameWithAffix}} endured\nthe hit!", - "perishSongLapse": "{{pokemonNameWithAffix}}'s perish count fell to {{turnCount}}.", - "centerOfAttentionOnAdd": "{{pokemonNameWithAffix}} became the center\nof attention!", - "truantLapse": "{{pokemonNameWithAffix}} is\nloafing around!", - "slowStartOnAdd": "{{pokemonNameWithAffix}} can't\nget it going!", - "slowStartOnRemove": "{{pokemonNameWithAffix}} finally\ngot its act together!", - "highestStatBoostOnAdd": "{{pokemonNameWithAffix}}'s {{statName}}\nwas heightened!", - "highestStatBoostOnRemove": "The effects of {{pokemonNameWithAffix}}'s\n{{abilityName}} wore off!", - "magnetRisenOnAdd": "{{pokemonNameWithAffix}} levitated with electromagnetism!", - "magnetRisenOnRemove": "{{pokemonNameWithAffix}}'s electromagnetism wore off!", - "critBoostOnAdd": "{{pokemonNameWithAffix}} is getting\npumped!", - "critBoostOnRemove": "{{pokemonNameWithAffix}} relaxed.", - "saltCuredOnAdd": "{{pokemonNameWithAffix}} is being salt cured!", - "saltCuredLapse": "{{pokemonNameWithAffix}} is hurt by {{moveName}}!", - "cursedOnAdd": "{{pokemonNameWithAffix}} cut its own HP and put a curse on the {{pokemonName}}!", - "cursedLapse": "{{pokemonNameWithAffix}} is afflicted by the Curse!", - "stockpilingOnAdd": "{{pokemonNameWithAffix}} stockpiled {{stockpiledCount}}!", - "rageOnAdd": "¡La furia de {{pokemonNameWithAffix}} comienza a crecer!", - "rageOnHit": "¡La furia de {{pokemonNameWithAffix}} está aumentando!", -} as const; diff --git a/src/test/moves/rage.test.ts b/src/test/moves/rage.test.ts index 236e940ff2c..d01618405b5 100644 --- a/src/test/moves/rage.test.ts +++ b/src/test/moves/rage.test.ts @@ -4,7 +4,6 @@ import GameManager from "#test/utils/gameManager"; import { Species } from "#enums/species"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; -import {BattleStat} from "#app/data/battle-stat"; import {StatusEffect} from "#enums/status-effect"; import {RageTag} from "#app/data/battler-tags"; import {PlayerPokemon} from "#app/field/pokemon"; @@ -12,12 +11,13 @@ import {Nature} from "#enums/nature"; import {CommandPhase} from "#app/phases/command-phase"; import {BattlerIndex} from "#app/battle"; import {TurnEndPhase} from "#app/phases/turn-end-phase"; +import {Stat} from "#enums/stat"; const TIMEOUT = 20 * 1000; function fullOf(move: Moves) : Moves[] { - return [move,move,move,move]; + return [move, move, move, move]; } describe("Moves - Rage", () => { let phaserGame: Phaser.Game; @@ -61,7 +61,7 @@ describe("Moves - Rage", () => { game.override .enemySpecies(Species.SHUCKLE) .enemyMoveset(fullOf(Moves.TACKLE)); - await game.startBattle(); + await game.classicMode.startBattle(); const leadPokemon = game.scene.getPlayerPokemon()!; @@ -69,19 +69,19 @@ describe("Moves - Rage", () => { // Boltund's attack is raised. game.move.select(Moves.RAGE); await game.toNextTurn(); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(1); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(1); // Opponent Shuckle uses Tackle. Player Boltund uses Vital Throw (Negative Priority). // Boltund's attack is raised. game.move.select(Moves.VITAL_THROW); await game.toNextTurn(); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(2); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(2); // Opponent Shuckle uses Tackle. Player Boltund uses Vital Throw (Negative Priority). // Boltund's attack not raised. game.move.select(Moves.VITAL_THROW); await game.toNextTurn(); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(2); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(2); }, TIMEOUT ); @@ -97,7 +97,7 @@ describe("Moves - Rage", () => { game.override .enemySpecies(Species.SHUCKLE) .enemyMoveset(fullOf(Moves.RAGE)); - await game.startBattle(); + await game.classicMode.startBattle(); const leadPokemon = game.scene.getPlayerPokemon()!; const oppPokemon = game.scene.getEnemyPokemon()!; @@ -106,15 +106,15 @@ describe("Moves - Rage", () => { // Shuckle gets an Attack boost game.move.select(Moves.VITAL_THROW); await game.toNextTurn(); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); - expect(oppPokemon.summonData.battleStats[BattleStat.ATK]).toBe(1); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(0); + expect(oppPokemon.getStatStage(Stat.ATK)).toBe(1); // Ally Boltund uses Spore. Shuckle is asleep. // Shuckle does not get an attack boost. Shuckle still has the RageTag tag. game.move.select(Moves.SPORE); await game.toNextTurn(); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); - expect(oppPokemon.summonData.battleStats[BattleStat.ATK]).toBe(1); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(0); + expect(oppPokemon.getStatStage(Stat.ATK)).toBe(1); expect(oppPokemon.getTag(RageTag)).toBeTruthy; }, TIMEOUT ); @@ -128,7 +128,7 @@ describe("Moves - Rage", () => { game.override .enemySpecies(Species.GASTLY) .enemyMoveset(fullOf(Moves.TACKLE)); // Has semi-invulnerable turn - await game.startBattle(); + await game.classicMode.startBattle(); const leadPokemon = game.scene.getPlayerPokemon()!; @@ -136,7 +136,7 @@ describe("Moves - Rage", () => { // Boltund does not have RageTag or Attack boost. game.move.select(Moves.RAGE); await game.toNextTurn(); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(0); expect(leadPokemon.getTag(RageTag)).toBeNull; }, TIMEOUT ); @@ -151,7 +151,7 @@ describe("Moves - Rage", () => { game.override .enemySpecies(Species.REGIELEKI) .enemyMoveset(fullOf(Moves.PHANTOM_FORCE)); // Has semi-invulnerable turn - await game.startBattle(); + await game.classicMode.startBattle(); const leadPokemon = game.scene.getPlayerPokemon()!; @@ -159,14 +159,14 @@ describe("Moves - Rage", () => { // Boltund does not gain RageTag or Attack boost game.move.select(Moves.RAGE); await game.toNextTurn(); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(0); expect(leadPokemon.getTag(RageTag)).toBeNull; // Regieleki finishes Fly, Boltund uses Rage // Boltund gains RageTag, but no boost game.move.select(Moves.RAGE); await game.toNextTurn(); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(0); expect(leadPokemon.getTag(RageTag)).toBeTruthy; }, TIMEOUT ); @@ -177,7 +177,7 @@ describe("Moves - Rage", () => { game.override .enemySpecies(Species.SHUCKLE) .enemyMoveset(fullOf(Moves.PHANTOM_FORCE)); // Has semi-invulnerable turn - await game.startBattle(); + await game.classicMode.startBattle(); const leadPokemon = game.scene.getPlayerPokemon()!; @@ -185,16 +185,16 @@ describe("Moves - Rage", () => { // Boltund gains RageTag game.move.select(Moves.RAGE); await game.toNextTurn(); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(0); expect(leadPokemon.getTag(RageTag)).toBeTruthy; // Boltund uses Rage, Shuckle is underwater, Shuckle finishes Dive // Boltund gains gains boost, does not lose RageTag game.move.select(Moves.RAGE); await game.toNextTurn(); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(1); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(1); expect(leadPokemon.getTag(RageTag)).toBeTruthy; - },TIMEOUT + }, TIMEOUT ); /** @@ -210,18 +210,18 @@ describe("Moves - Rage", () => { .battleType("double") .enemySpecies(Species.SHUCKLE) .enemyMoveset(fullOf(Moves.TACKLE)); - await game.startBattle([Species.BOLTUND, Species.BOLTUND]); + await game.classicMode.startBattle([Species.BOLTUND, Species.BOLTUND]); const leadPokemon = game.scene.getParty()[0]; - game.move.select(Moves.RAGE,1,BattlerIndex.ENEMY); + game.move.select(Moves.RAGE, 1, BattlerIndex.ENEMY); await game.phaseInterceptor.to(CommandPhase); - game.move.select(Moves.MEMENTO,1,BattlerIndex.ENEMY_2); + game.move.select(Moves.MEMENTO, 1, BattlerIndex.ENEMY_2); await game.phaseInterceptor.to(TurnEndPhase, false); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(2); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(2); expect(leadPokemon.getTag(RageTag)).toBeTruthy; }, TIMEOUT ); @@ -234,24 +234,24 @@ describe("Moves - Rage", () => { "should stay raging if unable to act", async () => { game.override - .moveset([Moves.RAGE,Moves.SPLASH,Moves.SPORE,Moves.VITAL_THROW]) + .moveset([Moves.RAGE, Moves.SPLASH, Moves.SPORE, Moves.VITAL_THROW]) .battleType("double") .enemySpecies(Species.SHUCKLE) .enemyMoveset(fullOf(Moves.SPLASH)); // Has semi-invulnerable turn - await game.startBattle(); + await game.classicMode.startBattle(); const leadPokemon: PlayerPokemon = game.scene.getParty()[0]; // Ensure that second pokemon is faster. leadPokemon.natureOverride = Nature.SASSY; game.scene.getParty()[1].natureOverride = Nature.JOLLY; - game.move.select(Moves.RAGE,1,BattlerIndex.ENEMY); + game.move.select(Moves.RAGE, 1, BattlerIndex.ENEMY); await game.phaseInterceptor.to(CommandPhase); - game.move.select(Moves.SPORE,1,BattlerIndex.PLAYER); + game.move.select(Moves.SPORE, 1, BattlerIndex.PLAYER); await game.phaseInterceptor.to(TurnEndPhase, false); - expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); + expect(leadPokemon.getStatStage(Stat.ATK)).toBe(0); expect(leadPokemon.getTag(RageTag)).toBeTruthy; expect(leadPokemon.status?.effect).toBe(StatusEffect.SLEEP); }, TIMEOUT