[Localization] Localize terrain message and translate in Korean (#2806)

* add terrain localization and test code, change folder name

* Update src/locales/fr/weather.ts

Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr>

* Update src/locales/pt_BR/weather.ts

Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br>

* Update src/locales/zh_CN/weather.ts

Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com>

* Update src/locales/de/weather.ts

Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com>

* Update src/locales/zh_TW/weather.ts

Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com>

* Use testUtil

* add missed en messages

---------

Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr>
Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br>
Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com>
Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com>
This commit is contained in:
Enoch 2024-07-08 23:16:55 +09:00 committed by GitHub
parent 1234554d74
commit 965bc687b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 430 additions and 23 deletions

View File

@ -5,6 +5,7 @@ import * as Utils from "../utils";
import { IncrementMovePriorityAbAttr, applyAbAttrs } from "./ability";
import { ProtectAttr } from "./move";
import { BattlerIndex } from "#app/battle.js";
import i18next from "i18next";
export enum TerrainType {
NONE,
@ -67,6 +68,22 @@ export class Terrain {
}
}
export function getTerrainName(terrainType: TerrainType): string {
switch (terrainType) {
case TerrainType.MISTY:
return i18next.t("terrain:misty");
case TerrainType.ELECTRIC:
return i18next.t("terrain:electric");
case TerrainType.GRASSY:
return i18next.t("terrain:grassy");
case TerrainType.PSYCHIC:
return i18next.t("terrain:psychic");
}
return "";
}
export function getTerrainColor(terrainType: TerrainType): [ integer, integer, integer ] {
switch (terrainType) {
case TerrainType.MISTY:

View File

@ -1,12 +1,12 @@
import { Biome } from "#enums/biome";
import { getPokemonMessage, getPokemonNameWithAffix } from "../messages";
import { getPokemonNameWithAffix } from "../messages";
import Pokemon from "../field/pokemon";
import { Type } from "./type";
import Move, { AttackMove } from "./move";
import * as Utils from "../utils";
import BattleScene from "../battle-scene";
import { SuppressWeatherEffectAbAttr } from "./ability";
import { TerrainType } from "./terrain";
import { TerrainType, getTerrainName } from "./terrain";
import i18next from "i18next";
export enum WeatherType {
@ -216,34 +216,34 @@ export function getWeatherClearMessage(weatherType: WeatherType): string {
export function getTerrainStartMessage(terrainType: TerrainType): string {
switch (terrainType) {
case TerrainType.MISTY:
return "Mist swirled around the battlefield!";
return i18next.t("terrain:mistyStartMessage");
case TerrainType.ELECTRIC:
return "An electric current ran across the battlefield!";
return i18next.t("terrain:electricStartMessage");
case TerrainType.GRASSY:
return "Grass grew to cover the battlefield!";
return i18next.t("terrain:grassyStartMessage");
case TerrainType.PSYCHIC:
return "The battlefield got weird!";
return i18next.t("terrain:psychicStartMessage");
}
}
export function getTerrainClearMessage(terrainType: TerrainType): string {
switch (terrainType) {
case TerrainType.MISTY:
return "The mist disappeared from the battlefield.";
return i18next.t("terrain:mistyClearMessage");
case TerrainType.ELECTRIC:
return "The electricity disappeared from the battlefield.";
return i18next.t("terrain:electricClearMessage");
case TerrainType.GRASSY:
return "The grass disappeared from the battlefield.";
return i18next.t("terrain:grassyClearMessage");
case TerrainType.PSYCHIC:
return "The weirdness disappeared from the battlefield!";
return i18next.t("terrain:psychicClearMessage");
}
}
export function getTerrainBlockMessage(pokemon: Pokemon, terrainType: TerrainType): string {
if (terrainType === TerrainType.MISTY) {
return getPokemonMessage(pokemon, " surrounds itself with a protective mist!");
return i18next.t("terrain:mistyBlockMessage", {pokemonNameWithAffix: getPokemonNameWithAffix(pokemon)});
}
return getPokemonMessage(pokemon, ` is protected by the ${Utils.toReadableString(TerrainType[terrainType])} Terrain!`);
return i18next.t("terrain:defaultBlockMessage", {pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), terrainName: getTerrainName(terrainType)});
}
interface WeatherPoolEntry {

View File

@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect";
import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial";
import { voucher } from "./voucher";
import { weather } from "./weather";
import { terrain, weather } from "./weather";
import { partyUiHandler } from "./party-ui-handler";
import { settings } from "./settings.js";
import { common } from "./common.js";
@ -85,6 +85,7 @@ export const deConfig = {
splashMessages: splashMessages,
starterSelectUiHandler: starterSelectUiHandler,
statusEffect: statusEffect,
terrain: terrain,
titles: titles,
trainerClasses: trainerClasses,
trainerNames: trainerNames,

View File

@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = {
"strongWindsEffectMessage": "Rätselhafte Luftströmungen haben den Angriff abgeschwächt!",
"strongWindsClearMessage": "Die rätselhafte Luftströmung hat sich wieder geleget.",
};
export const terrain: SimpleTranslationEntries = {
"misty": "Nebelfeld",
"mistyStartMessage": "Am Boden breitet sich dichter Nebel aus!",
"mistyClearMessage": "Das Nebelfeld ist wieder verschwunden!",
"mistyBlockMessage": "{{pokemonNameWithAffix}} wird vom Nebelfeld geschützt!",
"electric": "Elektrofeld",
"electricStartMessage": "Elektrische Energie fließt durch den Boden!",
"electricClearMessage": "Das Elektrofeld ist wieder verschwunden!",
"grassy": "Grasfeld",
"grassyStartMessage": "Dichtes Gras schießt aus dem Boden!",
"grassyClearMessage": "Das Grasfeld ist wieder verschwunden!",
"psychic": "Psychofeld",
"psychicStartMessage": "Der Boden fühlt sich seltsam an!",
"psychicClearMessage": "Das Psychofeld ist wieder verschwunden!",
"defaultBlockMessage": "{{pokemonNameWithAffix}} wird vom {{terrainName}} geschützt!"
};

View File

@ -42,7 +42,7 @@ import { statusEffect } from "./status-effect";
import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial";
import { voucher } from "./voucher";
import { weather } from "./weather";
import { terrain, weather } from "./weather";
import { modifierSelectUiHandler } from "./modifier-select-ui-handler";
export const enConfig = {
@ -76,7 +76,6 @@ export const enConfig = {
modifierType: modifierType,
move: move,
nature: nature,
partyUiHandler: partyUiHandler,
pokeball: pokeball,
pokemon: pokemon,
pokemonInfo: pokemonInfo,
@ -86,11 +85,13 @@ export const enConfig = {
splashMessages: splashMessages,
starterSelectUiHandler: starterSelectUiHandler,
statusEffect: statusEffect,
terrain: terrain,
titles: titles,
trainerClasses: trainerClasses,
trainerNames: trainerNames,
tutorial: tutorial,
voucher: voucher,
weather: weather,
partyUiHandler: partyUiHandler,
modifierSelectUiHandler: modifierSelectUiHandler
};

View File

@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = {
"strongWindsEffectMessage": "The mysterious air current weakened the attack!",
"strongWindsClearMessage": "The heavy wind stopped."
};
export const terrain: SimpleTranslationEntries = {
"misty": "Misty",
"mistyStartMessage": "Mist swirled around the battlefield!",
"mistyClearMessage": "The mist disappeared from the battlefield.",
"mistyBlockMessage": "{{pokemonNameWithAffix}} surrounds itself with a protective mist!",
"electric": "Electric",
"electricStartMessage": "An electric current ran across the battlefield!",
"electricClearMessage": "The electricity disappeared from the battlefield.",
"grassy": "Grassy",
"grassyStartMessage": "Grass grew to cover the battlefield!",
"grassyClearMessage": "The grass disappeared from the battlefield.",
"psychic": "Psychic",
"psychicStartMessage": "The battlefield got weird!",
"psychicClearMessage": "The weirdness disappeared from the battlefield!",
"defaultBlockMessage": "{{pokemonNameWithAffix}} is protected by the {{terrainName}} Terrain!"
};

View File

@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect";
import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial";
import { voucher } from "./voucher";
import { weather } from "./weather";
import { terrain, weather } from "./weather";
import { partyUiHandler } from "./party-ui-handler";
import { settings } from "./settings.js";
import { common } from "./common.js";
@ -85,6 +85,7 @@ export const esConfig = {
splashMessages: splashMessages,
starterSelectUiHandler: starterSelectUiHandler,
statusEffect: statusEffect,
terrain: terrain,
titles: titles,
trainerClasses: trainerClasses,
trainerNames: trainerNames,

View File

@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = {
"strongWindsEffectMessage": "¡Las misteriosas turbulencias atenúan el ataque!",
"strongWindsClearMessage": "El fuerte viento cesó."
};
export const terrain: SimpleTranslationEntries = {
"misty": "Misty",
"mistyStartMessage": "Mist swirled around the battlefield!",
"mistyClearMessage": "The mist disappeared from the battlefield.",
"mistyBlockMessage": "{{pokemonNameWithAffix}} surrounds itself with a protective mist!",
"electric": "Electric",
"electricStartMessage": "An electric current ran across the battlefield!",
"electricClearMessage": "The electricity disappeared from the battlefield.",
"grassy": "Grassy",
"grassyStartMessage": "Grass grew to cover the battlefield!",
"grassyClearMessage": "The grass disappeared from the battlefield.",
"psychic": "Psychic",
"psychicStartMessage": "The battlefield got weird!",
"psychicClearMessage": "The weirdness disappeared from the battlefield!",
"defaultBlockMessage": "{{pokemonNameWithAffix}} is protected by the {{terrainName}} Terrain!"
};

View File

@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect";
import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial";
import { voucher } from "./voucher";
import { weather } from "./weather";
import { terrain, weather } from "./weather";
import { partyUiHandler } from "./party-ui-handler";
import { settings } from "./settings.js";
import { common } from "./common.js";
@ -85,6 +85,7 @@ export const frConfig = {
splashMessages: splashMessages,
starterSelectUiHandler: starterSelectUiHandler,
statusEffect: statusEffect,
terrain: terrain,
titles: titles,
trainerClasses: trainerClasses,
trainerNames: trainerNames,

View File

@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = {
"strongWindsEffectMessage": "Le courant aérien mystérieux affaiblit lattaque!",
"strongWindsClearMessage": "Le vent mystérieux sest dissipé…"
};
export const terrain: SimpleTranslationEntries = {
"misty": "Brumeux",
"mistyStartMessage": "La brume recouvre le terrain !",
"mistyClearMessage": "La brume qui recouvrait le terrain se dissipe…",
"mistyBlockMessage": "La brume enveloppe {{pokemonNameWithAffix}} !",
"electric": "Électrifié",
"electricStartMessage": "De lélectricité parcourt le terrain !",
"electricClearMessage": "Lélectricité parcourant le terrain sest dissipée…",
"grassy": "Herbu",
"grassyStartMessage": "Un beau gazon pousse sur le terrain !",
"grassyClearMessage": "Le gazon disparait…",
"psychic": "Psychique",
"psychicStartMessage": "Le sol se met à réagir de façon bizarre…",
"psychicClearMessage": "Le sol redevient normal !",
"defaultBlockMessage": "{{pokemonNameWithAffix}} est protégé\npar le Champ {{terrainName}} !"
};

View File

@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect";
import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial";
import { voucher } from "./voucher";
import { weather } from "./weather";
import { terrain, weather } from "./weather";
import { partyUiHandler } from "./party-ui-handler";
import { settings } from "./settings.js";
import { common } from "./common.js";
@ -85,6 +85,7 @@ export const itConfig = {
splashMessages: splashMessages,
starterSelectUiHandler: starterSelectUiHandler,
statusEffect: statusEffect,
terrain: terrain,
titles: titles,
trainerClasses: trainerClasses,
trainerNames: trainerNames,

View File

@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = {
"strongWindsEffectMessage": "La corrente misteriosa indebolisce lattacco!",
"strongWindsClearMessage": "La corrente d'aria è cessata."
};
export const terrain: SimpleTranslationEntries = {
"misty": "Misty",
"mistyStartMessage": "Mist swirled around the battlefield!",
"mistyClearMessage": "The mist disappeared from the battlefield.",
"mistyBlockMessage": "{{pokemonNameWithAffix}} surrounds itself with a protective mist!",
"electric": "Electric",
"electricStartMessage": "An electric current ran across the battlefield!",
"electricClearMessage": "The electricity disappeared from the battlefield.",
"grassy": "Grassy",
"grassyStartMessage": "Grass grew to cover the battlefield!",
"grassyClearMessage": "The grass disappeared from the battlefield.",
"psychic": "Psychic",
"psychicStartMessage": "The battlefield got weird!",
"psychicClearMessage": "The weirdness disappeared from the battlefield!",
"defaultBlockMessage": "{{pokemonNameWithAffix}} is protected by the {{terrainName}} Terrain!"
};

View File

@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect";
import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial";
import { voucher } from "./voucher";
import { weather } from "./weather";
import { terrain, weather } from "./weather";
import { partyUiHandler } from "./party-ui-handler";
import { settings } from "./settings.js";
import { common } from "./common.js";
@ -85,6 +85,7 @@ export const koConfig = {
splashMessages: splashMessages,
starterSelectUiHandler: starterSelectUiHandler,
statusEffect: statusEffect,
terrain: terrain,
titles: titles,
trainerClasses: trainerClasses,
trainerNames: trainerNames,

View File

@ -44,3 +44,24 @@ export const weather: SimpleTranslationEntries = {
"strongWindsEffectMessage": "수수께끼의 난기류가 공격을 약하게 만들었다!",
"strongWindsClearMessage": "수수께끼의 난기류가 멈췄다!" // 임의번역
};
export const terrain: SimpleTranslationEntries = {
"misty": "미스트필드",
"mistyStartMessage": "발밑이 안개로 자욱해졌다!",
"mistyClearMessage": "발밑의 안개가 사라졌다!",
"mistyBlockMessage": "{{pokemonNameWithAffix}}[[를]]\n미스트필드가 지켜주고 있다!",
"electric": "일렉트릭필드",
"electricStartMessage": "발밑에 전기가 흐르기 시작했다!",
"electricClearMessage": "발밑의 전기가 사라졌다!",
"grassy": "그래스필드",
"grassyStartMessage": "발밑에 풀이 무성해졌다!",
"grassyClearMessage": "발밑의 풀이 사라졌다!",
"psychic": "사이코필드",
"psychicStartMessage": "발밑에서 이상한 느낌이 든다!",
"psychicClearMessage": "발밑의 이상한 느낌이 사라졌다!",
"defaultBlockMessage": "{{pokemonNameWithAffix}}[[를]]\n{{terrainName}}[[가]] 지켜주고 있다!"
};

View File

@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect";
import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial";
import { voucher } from "./voucher";
import { weather } from "./weather";
import { terrain, weather } from "./weather";
import { partyUiHandler } from "./party-ui-handler";
import { settings } from "./settings.js";
import { common } from "./common.js";
@ -76,13 +76,13 @@ export const ptBrConfig = {
modifierType: modifierType,
move: move,
nature: nature,
partyUiHandler: partyUiHandler,
pokeball: pokeball,
pokemon: pokemon,
pokemonInfo: pokemonInfo,
pokemonInfoContainer: pokemonInfoContainer,
saveSlotSelectUiHandler: saveSlotSelectUiHandler,
statusEffect: statusEffect,
terrain: terrain,
settings: settings,
splashMessages: splashMessages,
starterSelectUiHandler: starterSelectUiHandler,
@ -92,5 +92,6 @@ export const ptBrConfig = {
tutorial: tutorial,
voucher: voucher,
weather: weather,
partyUiHandler: partyUiHandler,
modifierSelectUiHandler: modifierSelectUiHandler
};

View File

@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = {
"strongWindsEffectMessage": "The mysterious air current weakened the attack!",
"strongWindsClearMessage": "Os ventos fortes diminuíram.",
};
export const terrain: SimpleTranslationEntries = {
"misty": "Enevoado",
"mistyStartMessage": "Uma névoa se espalhou pelo campo de batalha!",
"mistyClearMessage": "A névou sumiu do campo de batalha.",
"mistyBlockMessage": "{{pokemonNameWithAffix}} se envolveu com uma névoa protetora!",
"electric": "Elétrico",
"electricStartMessage": "Uma corrente elétrica se espalhou pelo campo de batalha!",
"electricClearMessage": "A eletricidade sumiu do campo de batalha.",
"grassy": "de Plantas",
"grassyStartMessage": "Grama cresceu para cobrir o campo de batalha!",
"grassyClearMessage": "A grama sumiu do campo de batalha.",
"psychic": "Psíquico",
"psychicStartMessage": "O campo de batalha ficou esquisito!",
"psychicClearMessage": "A esquisitice sumiu do campo de batalha",
"defaultBlockMessage": "{{pokemonNameWithAffix}} está protegido pelo Terreno {{terrainName}}!"
};

View File

@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect";
import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial";
import { voucher } from "./voucher";
import { weather } from "./weather";
import { terrain, weather } from "./weather";
import { partyUiHandler } from "./party-ui-handler";
import { settings } from "./settings.js";
import { common } from "./common.js";
@ -85,6 +85,7 @@ export const zhCnConfig = {
splashMessages: splashMessages,
starterSelectUiHandler: starterSelectUiHandler,
statusEffect: statusEffect,
terrain: terrain,
titles: titles,
trainerClasses: trainerClasses,
trainerNames: trainerNames,

View File

@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = {
"strongWindsEffectMessage": "The mysterious air current weakened the attack!",
"strongWindsClearMessage": "神秘的乱流停止了。"
};
export const terrain: SimpleTranslationEntries = {
"misty": "薄雾",
"mistyStartMessage": "脚下雾气缭绕!",
"mistyClearMessage": "脚下的雾气消失不见了!",
"mistyBlockMessage": "{{pokemonNameWithAffix}}正受到薄雾场地的保护!",
"electric": "电气",
"electricStartMessage": "脚下电光飞闪!",
"electricClearMessage": "脚下的电光消失不见了!",
"grassy": "青草",
"grassyStartMessage": "脚下青草如茵!",
"grassyClearMessage": "脚下的青草消失不见了!",
"psychic": "精神",
"psychicStartMessage": "脚下传来了奇妙的感觉!",
"psychicClearMessage": "脚下的奇妙感觉消失了!",
"defaultBlockMessage": "{{pokemonNameWithAffix}}正受到{{terrainName}}的的保护!"
};

View File

@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect";
import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial";
import { voucher } from "./voucher";
import { weather } from "./weather";
import { terrain, weather } from "./weather";
import { partyUiHandler } from "./party-ui-handler";
import { settings } from "./settings.js";
import { common } from "./common.js";
@ -85,6 +85,7 @@ export const zhTwConfig = {
splashMessages: splashMessages,
starterSelectUiHandler: starterSelectUiHandler,
statusEffect: statusEffect,
terrain: terrain,
titles: titles,
trainerClasses: trainerClasses,
trainerNames: trainerNames,

View File

@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = {
"strongWindsEffectMessage": "The mysterious air current weakened the attack!",
"strongWindsClearMessage": "神秘的亂流停止了。"
};
export const terrain: SimpleTranslationEntries = {
"misty": "薄霧",
"mistyStartMessage": "腳下霧氣繚繞!",
"mistyClearMessage": "腳下的霧氣消失不見了!",
"mistyBlockMessage": "{{pokemonNameWithAffix}}正受到薄霧場地的保護!",
"electric": "電氣",
"electricStartMessage": "腳下電流飛閃!",
"electricClearMessage": "腳下的電流消失了!",
"grassy": "青草",
"grassyStartMessage": "腳下青草如茵!",
"grassyClearMessage": "腳下的青草消失不見了!",
"psychic": "精神",
"psychicStartMessage": "腳下傳來了奇妙的感覺!",
"psychicClearMessage": "腳下的奇妙感覺消失了!",
"defaultBlockMessage": "{{pokemonNameWithAffix}}正受到{{terrainName}}的保護!"
};

View File

@ -0,0 +1,192 @@
import { beforeAll, describe, beforeEach, afterEach, expect, it, vi } from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import * as overrides from "#app/overrides";
import { Species } from "#enums/species";
import { TerrainType, getTerrainName } from "#app/data/terrain";
import { getTerrainStartMessage, getTerrainClearMessage, getTerrainBlockMessage } from "#app/data/weather";
import i18next from "i18next";
import { mockI18next } from "../utils/testUtils";
describe("terrain", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
i18next.init();
});
beforeEach(() => {
game = new GameManager(phaserGame);
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
});
describe("NONE", () => {
const terrainType = TerrainType.NONE;
it("should return the obtain text", () => {
mockI18next();
const text = getTerrainName(terrainType);
expect(text).toBe("");
});
it("should return the start text", () => {
mockI18next();
const text = getTerrainStartMessage(terrainType);
expect(text).toBe(undefined);
});
it("should return the clear text", () => {
mockI18next();
const text = getTerrainClearMessage(terrainType);
expect(text).toBe(undefined);
});
it("should return the block text", async () => {
await game.startBattle([Species.MAGIKARP]);
const pokemon = game.scene.getPlayerPokemon();
mockI18next();
const text = getTerrainBlockMessage(pokemon, terrainType);
expect(text).toBe("terrain:defaultBlockMessage");
});
});
describe("MISTY", () => {
const terrainType = TerrainType.MISTY;
it("should return the obtain text", () => {
mockI18next();
const text = getTerrainName(terrainType);
expect(text).toBe("terrain:misty");
});
it("should return the start text", () => {
mockI18next();
const text = getTerrainStartMessage(terrainType);
expect(text).toBe("terrain:mistyStartMessage");
});
it("should return the clear text", () => {
mockI18next();
const text = getTerrainClearMessage(terrainType);
expect(text).toBe("terrain:mistyClearMessage");
});
it("should return the block text", async () => {
await game.startBattle([Species.MAGIKARP]);
const pokemon = game.scene.getPlayerPokemon();
mockI18next();
const text = getTerrainBlockMessage(pokemon, terrainType);
expect(text).toBe("terrain:mistyBlockMessage");
});
});
describe("ELECTRIC", () => {
const terrainType = TerrainType.ELECTRIC;
it("should return the obtain text", () => {
mockI18next();
const text = getTerrainName(terrainType);
expect(text).toBe("terrain:electric");
});
it("should return the start text", () => {
mockI18next();
const text = getTerrainStartMessage(terrainType);
expect(text).toBe("terrain:electricStartMessage");
});
it("should return the clear text", () => {
mockI18next();
const text = getTerrainClearMessage(terrainType);
expect(text).toBe("terrain:electricClearMessage");
});
it("should return the block text", async () => {
await game.startBattle([Species.MAGIKARP]);
const pokemon = game.scene.getPlayerPokemon();
mockI18next();
const text = getTerrainBlockMessage(pokemon, terrainType);
expect(text).toBe("terrain:defaultBlockMessage");
});
});
describe("GRASSY", () => {
const terrainType = TerrainType.GRASSY;
it("should return the obtain text", () => {
mockI18next();
const text = getTerrainName(terrainType);
expect(text).toBe("terrain:grassy");
});
it("should return the start text", () => {
mockI18next();
const text = getTerrainStartMessage(terrainType);
expect(text).toBe("terrain:grassyStartMessage");
});
it("should return the clear text", () => {
mockI18next();
const text = getTerrainClearMessage(terrainType);
expect(text).toBe("terrain:grassyClearMessage");
});
it("should return the block text", async () => {
await game.startBattle([Species.MAGIKARP]);
const pokemon = game.scene.getPlayerPokemon();
mockI18next();
const text = getTerrainBlockMessage(pokemon, terrainType);
expect(text).toBe("terrain:defaultBlockMessage");
});
});
describe("PSYCHIC", () => {
const terrainType = TerrainType.PSYCHIC;
it("should return the obtain text", () => {
mockI18next();
const text = getTerrainName(terrainType);
expect(text).toBe("terrain:psychic");
});
it("should return the start text", () => {
mockI18next();
const text = getTerrainStartMessage(terrainType);
expect(text).toBe("terrain:psychicStartMessage");
});
it("should return the clear text", () => {
mockI18next();
const text = getTerrainClearMessage(terrainType);
expect(text).toBe("terrain:psychicClearMessage");
});
it("should return the block text", async () => {
await game.startBattle([Species.MAGIKARP]);
const pokemon = game.scene.getPlayerPokemon();
mockI18next();
const text = getTerrainBlockMessage(pokemon, terrainType);
expect(text).toBe("terrain:defaultBlockMessage");
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
vi.resetAllMocks();
});
});