mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
Compare commits
15 Commits
6545b38bb4
...
780008df58
Author | SHA1 | Date | |
---|---|---|---|
|
780008df58 | ||
|
46c78a0540 | ||
|
98809c28bd | ||
|
e0559e03ff | ||
|
f6b99780fb | ||
|
19af9bdb8b | ||
|
8e61b642a3 | ||
|
59f9c3e68d | ||
|
8f9edf38e8 | ||
|
0d0f8e3be3 | ||
|
938a4cf451 | ||
|
989cfbc223 | ||
|
63da1126a7 | ||
|
b5b44ea0b1 | ||
|
56b5461c95 |
@ -1 +1 @@
|
|||||||
Subproject commit ab2716d5440c25f73986664aa3f3131821c3c392
|
Subproject commit 1ea8f865e30d1940caa0fceeabf37ae2e4689471
|
@ -45736,6 +45736,285 @@ export const tmSpecies: TmSpecies = {
|
|||||||
SpeciesId.HISUI_ARCANINE,
|
SpeciesId.HISUI_ARCANINE,
|
||||||
SpeciesId.HISUI_AVALUGG,
|
SpeciesId.HISUI_AVALUGG,
|
||||||
],
|
],
|
||||||
|
[MoveId.SHOCK_WAVE]: [
|
||||||
|
SpeciesId.RATTATA,
|
||||||
|
SpeciesId.RATICATE,
|
||||||
|
SpeciesId.PIKACHU,
|
||||||
|
SpeciesId.RAICHU,
|
||||||
|
SpeciesId.NIDORAN_F,
|
||||||
|
SpeciesId.NIDORINA,
|
||||||
|
SpeciesId.NIDOQUEEN,
|
||||||
|
SpeciesId.NIDORAN_M,
|
||||||
|
SpeciesId.NIDORINO,
|
||||||
|
SpeciesId.NIDOKING,
|
||||||
|
SpeciesId.CLEFAIRY,
|
||||||
|
SpeciesId.CLEFABLE,
|
||||||
|
SpeciesId.JIGGLYPUFF,
|
||||||
|
SpeciesId.WIGGLYTUFF,
|
||||||
|
SpeciesId.MEOWTH,
|
||||||
|
SpeciesId.PERSIAN,
|
||||||
|
SpeciesId.ABRA,
|
||||||
|
SpeciesId.KADABRA,
|
||||||
|
SpeciesId.ALAKAZAM,
|
||||||
|
SpeciesId.MAGNEMITE,
|
||||||
|
SpeciesId.MAGNETON,
|
||||||
|
SpeciesId.GRIMER,
|
||||||
|
SpeciesId.MUK,
|
||||||
|
SpeciesId.VOLTORB,
|
||||||
|
SpeciesId.ELECTRODE,
|
||||||
|
SpeciesId.LICKITUNG,
|
||||||
|
SpeciesId.KOFFING,
|
||||||
|
SpeciesId.WEEZING,
|
||||||
|
SpeciesId.RHYHORN,
|
||||||
|
SpeciesId.RHYDON,
|
||||||
|
SpeciesId.CHANSEY,
|
||||||
|
SpeciesId.TANGELA,
|
||||||
|
SpeciesId.KANGASKHAN,
|
||||||
|
SpeciesId.MR_MIME,
|
||||||
|
SpeciesId.ELECTABUZZ,
|
||||||
|
SpeciesId.TAUROS,
|
||||||
|
SpeciesId.LAPRAS,
|
||||||
|
SpeciesId.JOLTEON,
|
||||||
|
SpeciesId.PORYGON,
|
||||||
|
SpeciesId.SNORLAX,
|
||||||
|
SpeciesId.ZAPDOS,
|
||||||
|
SpeciesId.DRATINI,
|
||||||
|
SpeciesId.DRAGONAIR,
|
||||||
|
SpeciesId.DRAGONITE,
|
||||||
|
SpeciesId.MEWTWO,
|
||||||
|
SpeciesId.MEW,
|
||||||
|
SpeciesId.SENTRET,
|
||||||
|
SpeciesId.FURRET,
|
||||||
|
SpeciesId.CHINCHOU,
|
||||||
|
SpeciesId.LANTURN,
|
||||||
|
SpeciesId.PICHU,
|
||||||
|
SpeciesId.CLEFFA,
|
||||||
|
SpeciesId.IGGLYBUFF,
|
||||||
|
SpeciesId.TOGEPI,
|
||||||
|
SpeciesId.TOGETIC,
|
||||||
|
SpeciesId.MAREEP,
|
||||||
|
SpeciesId.FLAAFFY,
|
||||||
|
SpeciesId.AMPHAROS,
|
||||||
|
SpeciesId.AIPOM,
|
||||||
|
SpeciesId.MISDREAVUS,
|
||||||
|
SpeciesId.GIRAFARIG,
|
||||||
|
SpeciesId.DUNSPARCE,
|
||||||
|
SpeciesId.SNUBBULL,
|
||||||
|
SpeciesId.GRANBULL,
|
||||||
|
SpeciesId.QWILFISH,
|
||||||
|
SpeciesId.PORYGON2,
|
||||||
|
SpeciesId.STANTLER,
|
||||||
|
SpeciesId.ELEKID,
|
||||||
|
SpeciesId.MILTANK,
|
||||||
|
SpeciesId.BLISSEY,
|
||||||
|
SpeciesId.RAIKOU,
|
||||||
|
SpeciesId.TYRANITAR,
|
||||||
|
SpeciesId.LUGIA,
|
||||||
|
SpeciesId.HO_OH,
|
||||||
|
SpeciesId.CELEBI,
|
||||||
|
SpeciesId.ZIGZAGOON,
|
||||||
|
SpeciesId.LINOONE,
|
||||||
|
SpeciesId.WINGULL,
|
||||||
|
SpeciesId.PELIPPER,
|
||||||
|
SpeciesId.RALTS,
|
||||||
|
SpeciesId.KIRLIA,
|
||||||
|
SpeciesId.GARDEVOIR,
|
||||||
|
SpeciesId.SLAKOTH,
|
||||||
|
SpeciesId.VIGOROTH,
|
||||||
|
SpeciesId.SLAKING,
|
||||||
|
SpeciesId.WHISMUR,
|
||||||
|
SpeciesId.LOUDRED,
|
||||||
|
SpeciesId.EXPLOUD,
|
||||||
|
SpeciesId.NOSEPASS,
|
||||||
|
SpeciesId.SKITTY,
|
||||||
|
SpeciesId.DELCATTY,
|
||||||
|
SpeciesId.SABLEYE,
|
||||||
|
SpeciesId.ARON,
|
||||||
|
SpeciesId.LAIRON,
|
||||||
|
SpeciesId.AGGRON,
|
||||||
|
SpeciesId.ELECTRIKE,
|
||||||
|
SpeciesId.MANECTRIC,
|
||||||
|
SpeciesId.PLUSLE,
|
||||||
|
SpeciesId.MINUN,
|
||||||
|
SpeciesId.VOLBEAT,
|
||||||
|
SpeciesId.ILLUMISE,
|
||||||
|
SpeciesId.GULPIN,
|
||||||
|
SpeciesId.SWALOT,
|
||||||
|
SpeciesId.SPOINK,
|
||||||
|
SpeciesId.GRUMPIG,
|
||||||
|
SpeciesId.SPINDA,
|
||||||
|
SpeciesId.ZANGOOSE,
|
||||||
|
SpeciesId.CASTFORM,
|
||||||
|
SpeciesId.KECLEON,
|
||||||
|
SpeciesId.SHUPPET,
|
||||||
|
SpeciesId.BANETTE,
|
||||||
|
SpeciesId.CHIMECHO,
|
||||||
|
SpeciesId.ABSOL,
|
||||||
|
SpeciesId.REGIROCK,
|
||||||
|
SpeciesId.REGICE,
|
||||||
|
SpeciesId.REGISTEEL,
|
||||||
|
SpeciesId.LATIAS,
|
||||||
|
SpeciesId.LATIOS,
|
||||||
|
SpeciesId.KYOGRE,
|
||||||
|
SpeciesId.GROUDON,
|
||||||
|
SpeciesId.RAYQUAZA,
|
||||||
|
SpeciesId.JIRACHI,
|
||||||
|
SpeciesId.DEOXYS,
|
||||||
|
SpeciesId.BIDOOF,
|
||||||
|
SpeciesId.BIBAREL,
|
||||||
|
SpeciesId.SHINX,
|
||||||
|
SpeciesId.LUXIO,
|
||||||
|
SpeciesId.LUXRAY,
|
||||||
|
SpeciesId.CRANIDOS,
|
||||||
|
SpeciesId.RAMPARDOS,
|
||||||
|
SpeciesId.SHIELDON,
|
||||||
|
SpeciesId.BASTIODON,
|
||||||
|
SpeciesId.PACHIRISU,
|
||||||
|
SpeciesId.AMBIPOM,
|
||||||
|
SpeciesId.DRIFLOON,
|
||||||
|
SpeciesId.DRIFBLIM,
|
||||||
|
SpeciesId.BUNEARY,
|
||||||
|
SpeciesId.LOPUNNY,
|
||||||
|
SpeciesId.MISMAGIUS,
|
||||||
|
SpeciesId.GLAMEOW,
|
||||||
|
SpeciesId.PURUGLY,
|
||||||
|
SpeciesId.CHINGLING,
|
||||||
|
SpeciesId.MIME_JR,
|
||||||
|
SpeciesId.HAPPINY,
|
||||||
|
SpeciesId.SPIRITOMB,
|
||||||
|
SpeciesId.MUNCHLAX,
|
||||||
|
SpeciesId.MAGNEZONE,
|
||||||
|
SpeciesId.LICKILICKY,
|
||||||
|
SpeciesId.RHYPERIOR,
|
||||||
|
SpeciesId.TANGROWTH,
|
||||||
|
SpeciesId.ELECTIVIRE,
|
||||||
|
SpeciesId.TOGEKISS,
|
||||||
|
SpeciesId.PORYGON_Z,
|
||||||
|
SpeciesId.GALLADE,
|
||||||
|
SpeciesId.PROBOPASS,
|
||||||
|
SpeciesId.FROSLASS,
|
||||||
|
SpeciesId.ROTOM,
|
||||||
|
SpeciesId.UXIE,
|
||||||
|
SpeciesId.MESPRIT,
|
||||||
|
SpeciesId.AZELF,
|
||||||
|
SpeciesId.DIALGA,
|
||||||
|
SpeciesId.PALKIA,
|
||||||
|
SpeciesId.REGIGIGAS,
|
||||||
|
SpeciesId.GIRATINA,
|
||||||
|
SpeciesId.DARKRAI,
|
||||||
|
SpeciesId.ARCEUS,
|
||||||
|
SpeciesId.VICTINI,
|
||||||
|
SpeciesId.PATRAT,
|
||||||
|
SpeciesId.WATCHOG,
|
||||||
|
SpeciesId.LILLIPUP,
|
||||||
|
SpeciesId.HERDIER,
|
||||||
|
SpeciesId.STOUTLAND,
|
||||||
|
SpeciesId.MUNNA,
|
||||||
|
SpeciesId.MUSHARNA,
|
||||||
|
SpeciesId.BLITZLE,
|
||||||
|
SpeciesId.ZEBSTRIKA,
|
||||||
|
SpeciesId.WOOBAT,
|
||||||
|
SpeciesId.SWOOBAT,
|
||||||
|
SpeciesId.SIGILYPH,
|
||||||
|
SpeciesId.YAMASK,
|
||||||
|
SpeciesId.COFAGRIGUS,
|
||||||
|
SpeciesId.MINCCINO,
|
||||||
|
SpeciesId.CINCCINO,
|
||||||
|
SpeciesId.GOTHITA,
|
||||||
|
SpeciesId.GOTHORITA,
|
||||||
|
SpeciesId.GOTHITELLE,
|
||||||
|
SpeciesId.SOLOSIS,
|
||||||
|
SpeciesId.DUOSION,
|
||||||
|
SpeciesId.REUNICLUS,
|
||||||
|
SpeciesId.EMOLGA,
|
||||||
|
SpeciesId.FRILLISH,
|
||||||
|
SpeciesId.JELLICENT,
|
||||||
|
SpeciesId.JOLTIK,
|
||||||
|
SpeciesId.GALVANTULA,
|
||||||
|
SpeciesId.KLINK,
|
||||||
|
SpeciesId.KLANG,
|
||||||
|
SpeciesId.KLINKLANG,
|
||||||
|
SpeciesId.EELEKTRIK,
|
||||||
|
SpeciesId.EELEKTROSS,
|
||||||
|
SpeciesId.ELGYEM,
|
||||||
|
SpeciesId.BEHEEYEM,
|
||||||
|
SpeciesId.LITWICK,
|
||||||
|
SpeciesId.LAMPENT,
|
||||||
|
SpeciesId.CHANDELURE,
|
||||||
|
SpeciesId.AXEW,
|
||||||
|
SpeciesId.FRAXURE,
|
||||||
|
SpeciesId.HAXORUS,
|
||||||
|
SpeciesId.STUNFISK,
|
||||||
|
SpeciesId.DRUDDIGON,
|
||||||
|
SpeciesId.GOLETT,
|
||||||
|
SpeciesId.GOLURK,
|
||||||
|
SpeciesId.DEINO,
|
||||||
|
SpeciesId.ZWEILOUS,
|
||||||
|
SpeciesId.HYDREIGON,
|
||||||
|
SpeciesId.THUNDURUS,
|
||||||
|
SpeciesId.ZEKROM,
|
||||||
|
SpeciesId.MELOETTA,
|
||||||
|
SpeciesId.GENESECT,
|
||||||
|
SpeciesId.BRAIXEN,
|
||||||
|
SpeciesId.DELPHOX,
|
||||||
|
SpeciesId.ESPURR,
|
||||||
|
SpeciesId.MEOWSTIC,
|
||||||
|
SpeciesId.HONEDGE,
|
||||||
|
SpeciesId.DOUBLADE,
|
||||||
|
SpeciesId.AEGISLASH,
|
||||||
|
SpeciesId.SKRELP,
|
||||||
|
SpeciesId.DRAGALGE,
|
||||||
|
SpeciesId.HELIOPTILE,
|
||||||
|
SpeciesId.HELIOLISK,
|
||||||
|
SpeciesId.DEDENNE,
|
||||||
|
SpeciesId.GOOMY,
|
||||||
|
SpeciesId.SLIGGOO,
|
||||||
|
SpeciesId.GOODRA,
|
||||||
|
SpeciesId.ZYGARDE,
|
||||||
|
SpeciesId.HOOPA,
|
||||||
|
SpeciesId.YUNGOOS,
|
||||||
|
SpeciesId.GUMSHOOS,
|
||||||
|
SpeciesId.GRUBBIN,
|
||||||
|
SpeciesId.CHARJABUG,
|
||||||
|
SpeciesId.VIKAVOLT,
|
||||||
|
SpeciesId.PASSIMIAN,
|
||||||
|
SpeciesId.TURTONATOR,
|
||||||
|
SpeciesId.TOGEDEMARU,
|
||||||
|
SpeciesId.DRAMPA,
|
||||||
|
SpeciesId.KOMMO_O,
|
||||||
|
SpeciesId.TAPU_KOKO,
|
||||||
|
SpeciesId.SOLGALEO,
|
||||||
|
SpeciesId.LUNALA,
|
||||||
|
SpeciesId.PHEROMOSA,
|
||||||
|
SpeciesId.XURKITREE,
|
||||||
|
SpeciesId.CELESTEELA,
|
||||||
|
SpeciesId.GUZZLORD,
|
||||||
|
SpeciesId.NECROZMA,
|
||||||
|
SpeciesId.MAGEARNA,
|
||||||
|
SpeciesId.NAGANADEL,
|
||||||
|
SpeciesId.ZERAORA,
|
||||||
|
SpeciesId.TOXTRICITY,
|
||||||
|
SpeciesId.MR_RIME,
|
||||||
|
SpeciesId.REGIELEKI,
|
||||||
|
SpeciesId.WYRDEER,
|
||||||
|
SpeciesId.FARIGIRAF,
|
||||||
|
SpeciesId.DUDUNSPARCE,
|
||||||
|
SpeciesId.MIRAIDON,
|
||||||
|
SpeciesId.RAGING_BOLT,
|
||||||
|
SpeciesId.ALOLA_RATTATA,
|
||||||
|
SpeciesId.ALOLA_RATICATE,
|
||||||
|
SpeciesId.ALOLA_RAICHU,
|
||||||
|
SpeciesId.ALOLA_MEOWTH,
|
||||||
|
SpeciesId.ALOLA_PERSIAN,
|
||||||
|
SpeciesId.ALOLA_GRAVELER,
|
||||||
|
SpeciesId.ALOLA_GOLEM,
|
||||||
|
SpeciesId.ALOLA_GRIMER,
|
||||||
|
SpeciesId.ALOLA_MUK,
|
||||||
|
SpeciesId.GALAR_WEEZING,
|
||||||
|
SpeciesId.GALAR_MR_MIME,
|
||||||
|
SpeciesId.HISUI_SLIGGOO,
|
||||||
|
SpeciesId.HISUI_GOODRA,
|
||||||
|
],
|
||||||
[MoveId.WATER_PULSE]: [
|
[MoveId.WATER_PULSE]: [
|
||||||
SpeciesId.SQUIRTLE,
|
SpeciesId.SQUIRTLE,
|
||||||
SpeciesId.WARTORTLE,
|
SpeciesId.WARTORTLE,
|
||||||
@ -68747,6 +69026,7 @@ export const tmPoolTiers: TmPoolTiers = {
|
|||||||
[MoveId.LEAF_BLADE]: ModifierTier.ULTRA,
|
[MoveId.LEAF_BLADE]: ModifierTier.ULTRA,
|
||||||
[MoveId.DRAGON_DANCE]: ModifierTier.GREAT,
|
[MoveId.DRAGON_DANCE]: ModifierTier.GREAT,
|
||||||
[MoveId.ROCK_BLAST]: ModifierTier.GREAT,
|
[MoveId.ROCK_BLAST]: ModifierTier.GREAT,
|
||||||
|
[MoveId.SHOCK_WAVE]: ModifierTier.GREAT,
|
||||||
[MoveId.WATER_PULSE]: ModifierTier.GREAT,
|
[MoveId.WATER_PULSE]: ModifierTier.GREAT,
|
||||||
[MoveId.ROOST]: ModifierTier.GREAT,
|
[MoveId.ROOST]: ModifierTier.GREAT,
|
||||||
[MoveId.GRAVITY]: ModifierTier.COMMON,
|
[MoveId.GRAVITY]: ModifierTier.COMMON,
|
||||||
|
@ -99,6 +99,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder.withE
|
|||||||
MysteryEncounterType.DARK_DEAL,
|
MysteryEncounterType.DARK_DEAL,
|
||||||
)
|
)
|
||||||
.withEncounterTier(MysteryEncounterTier.ROGUE)
|
.withEncounterTier(MysteryEncounterTier.ROGUE)
|
||||||
|
.withDisallowedChallenges(Challenges.HARDCORE)
|
||||||
.withIntroSpriteConfigs([
|
.withIntroSpriteConfigs([
|
||||||
{
|
{
|
||||||
spriteKey: "dark_deal_scientist",
|
spriteKey: "dark_deal_scientist",
|
||||||
|
@ -673,6 +673,8 @@ export async function catchPokemon(
|
|||||||
globalScene.gameData.updateSpeciesDexIvs(pokemon.species.getRootSpeciesId(true), pokemon.ivs);
|
globalScene.gameData.updateSpeciesDexIvs(pokemon.species.getRootSpeciesId(true), pokemon.ivs);
|
||||||
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
const addStatus = new BooleanHolder(true);
|
||||||
|
applyChallenges(ChallengeType.POKEMON_ADD_TO_PARTY, pokemon, addStatus);
|
||||||
const doPokemonCatchMenu = () => {
|
const doPokemonCatchMenu = () => {
|
||||||
const end = () => {
|
const end = () => {
|
||||||
// Ensure the pokemon is in the enemy party in all situations
|
// Ensure the pokemon is in the enemy party in all situations
|
||||||
@ -708,9 +710,7 @@ export async function catchPokemon(
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
|
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
|
||||||
const addStatus = new BooleanHolder(true);
|
if (!(isObtain || addStatus.value)) {
|
||||||
applyChallenges(ChallengeType.POKEMON_ADD_TO_PARTY, pokemon, addStatus);
|
|
||||||
if (!addStatus.value) {
|
|
||||||
removePokemon();
|
removePokemon();
|
||||||
end();
|
end();
|
||||||
return;
|
return;
|
||||||
@ -807,10 +807,16 @@ export async function catchPokemon(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (showCatchObtainMessage) {
|
if (showCatchObtainMessage) {
|
||||||
|
let catchMessage: string;
|
||||||
|
if (isObtain) {
|
||||||
|
catchMessage = "battle:pokemonObtained";
|
||||||
|
} else if (addStatus.value) {
|
||||||
|
catchMessage = "battle:pokemonCaught";
|
||||||
|
} else {
|
||||||
|
catchMessage = "battle:pokemonCaughtButChallenge";
|
||||||
|
}
|
||||||
globalScene.ui.showText(
|
globalScene.ui.showText(
|
||||||
i18next.t(isObtain ? "battle:pokemonObtained" : "battle:pokemonCaught", {
|
i18next.t(catchMessage, { pokemonName: pokemon.getNameToRender() }),
|
||||||
pokemonName: pokemon.getNameToRender(),
|
|
||||||
}),
|
|
||||||
null,
|
null,
|
||||||
doPokemonCatchMenu,
|
doPokemonCatchMenu,
|
||||||
0,
|
0,
|
||||||
|
@ -4,6 +4,7 @@ import { initEggMoves } from "#balance/egg-moves";
|
|||||||
import { initPokemonPrevolutions, initPokemonStarters } from "#balance/pokemon-evolutions";
|
import { initPokemonPrevolutions, initPokemonStarters } from "#balance/pokemon-evolutions";
|
||||||
import { initSpecies } from "#balance/pokemon-species";
|
import { initSpecies } from "#balance/pokemon-species";
|
||||||
import { initChallenges } from "#data/challenge";
|
import { initChallenges } from "#data/challenge";
|
||||||
|
import { allMoves } from "#data/data-lists";
|
||||||
import { initTrainerTypeDialogue } from "#data/dialogue";
|
import { initTrainerTypeDialogue } from "#data/dialogue";
|
||||||
import { initPokemonForms } from "#data/pokemon-forms";
|
import { initPokemonForms } from "#data/pokemon-forms";
|
||||||
import { initModifierPools } from "#modifiers/init-modifier-pools";
|
import { initModifierPools } from "#modifiers/init-modifier-pools";
|
||||||
@ -16,6 +17,9 @@ import { initStatsKeys } from "#ui/game-stats-ui-handler";
|
|||||||
|
|
||||||
/** Initialize the game. */
|
/** Initialize the game. */
|
||||||
export function initializeGame() {
|
export function initializeGame() {
|
||||||
|
if (allMoves.length > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
initModifierTypes();
|
initModifierTypes();
|
||||||
initModifierPools();
|
initModifierPools();
|
||||||
initAchievements();
|
initAchievements();
|
||||||
|
@ -253,8 +253,11 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
|
|
||||||
globalScene.gameData.updateSpeciesDexIvs(pokemon.species.getRootSpeciesId(true), pokemon.ivs);
|
globalScene.gameData.updateSpeciesDexIvs(pokemon.species.getRootSpeciesId(true), pokemon.ivs);
|
||||||
|
|
||||||
|
const addStatus = new BooleanHolder(true);
|
||||||
|
applyChallenges(ChallengeType.POKEMON_ADD_TO_PARTY, pokemon, addStatus);
|
||||||
|
|
||||||
globalScene.ui.showText(
|
globalScene.ui.showText(
|
||||||
i18next.t("battle:pokemonCaught", {
|
i18next.t(addStatus.value ? "battle:pokemonCaught" : "battle:pokemonCaughtButChallenge", {
|
||||||
pokemonName: getPokemonNameWithAffix(pokemon),
|
pokemonName: getPokemonNameWithAffix(pokemon),
|
||||||
}),
|
}),
|
||||||
null,
|
null,
|
||||||
@ -290,8 +293,6 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
|
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
|
||||||
const addStatus = new BooleanHolder(true);
|
|
||||||
applyChallenges(ChallengeType.POKEMON_ADD_TO_PARTY, pokemon, addStatus);
|
|
||||||
if (!addStatus.value) {
|
if (!addStatus.value) {
|
||||||
removePokemon();
|
removePokemon();
|
||||||
end();
|
end();
|
||||||
|
@ -118,7 +118,10 @@ export class MovePhase extends BattlePhase {
|
|||||||
public start(): void {
|
public start(): void {
|
||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
console.log(MoveId[this.move.moveId], enumValueToKey(MoveUseMode, this.useMode));
|
console.log(
|
||||||
|
`%cMove: ${MoveId[this.move.moveId]}; Use Mode: ${enumValueToKey(MoveUseMode, this.useMode)}`,
|
||||||
|
"color:RebeccaPurple",
|
||||||
|
);
|
||||||
|
|
||||||
// Check if move is unusable (e.g. running out of PP due to a mid-turn Spite
|
// Check if move is unusable (e.g. running out of PP due to a mid-turn Spite
|
||||||
// or the user no longer being on field), ending the phase early if not.
|
// or the user no longer being on field), ending the phase early if not.
|
||||||
|
@ -16,8 +16,10 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
|
|
||||||
globalScene.resetSeed();
|
globalScene.resetSeed();
|
||||||
|
|
||||||
|
const gameMode = globalScene.gameMode;
|
||||||
const currentBiome = globalScene.arena.biomeType;
|
const currentBiome = globalScene.arena.biomeType;
|
||||||
const nextWaveIndex = globalScene.currentBattle.waveIndex + 1;
|
const currentWaveIndex = globalScene.currentBattle.waveIndex;
|
||||||
|
const nextWaveIndex = currentWaveIndex + 1;
|
||||||
|
|
||||||
const setNextBiome = (nextBiome: BiomeId) => {
|
const setNextBiome = (nextBiome: BiomeId) => {
|
||||||
if (nextWaveIndex % 10 === 1) {
|
if (nextWaveIndex % 10 === 1) {
|
||||||
@ -26,6 +28,15 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
applyChallenges(ChallengeType.PARTY_HEAL, healStatus);
|
applyChallenges(ChallengeType.PARTY_HEAL, healStatus);
|
||||||
if (healStatus.value) {
|
if (healStatus.value) {
|
||||||
globalScene.phaseManager.unshiftNew("PartyHealPhase", false);
|
globalScene.phaseManager.unshiftNew("PartyHealPhase", false);
|
||||||
|
} else {
|
||||||
|
globalScene.phaseManager.unshiftNew(
|
||||||
|
"SelectModifierPhase",
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
gameMode.isFixedBattle(currentWaveIndex)
|
||||||
|
? gameMode.getFixedBattle(currentWaveIndex).customModifierRewardSettings
|
||||||
|
: undefined,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globalScene.phaseManager.unshiftNew("SwitchBiomePhase", nextBiome);
|
globalScene.phaseManager.unshiftNew("SwitchBiomePhase", nextBiome);
|
||||||
@ -33,12 +44,12 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(globalScene.gameMode.isClassic && globalScene.gameMode.isWaveFinal(nextWaveIndex + 9)) ||
|
(gameMode.isClassic && gameMode.isWaveFinal(nextWaveIndex + 9)) ||
|
||||||
(globalScene.gameMode.isDaily && globalScene.gameMode.isWaveFinal(nextWaveIndex)) ||
|
(gameMode.isDaily && gameMode.isWaveFinal(nextWaveIndex)) ||
|
||||||
(globalScene.gameMode.hasShortBiomes && !(nextWaveIndex % 50))
|
(gameMode.hasShortBiomes && !(nextWaveIndex % 50))
|
||||||
) {
|
) {
|
||||||
setNextBiome(BiomeId.END);
|
setNextBiome(BiomeId.END);
|
||||||
} else if (globalScene.gameMode.hasRandomBiomes) {
|
} else if (gameMode.hasRandomBiomes) {
|
||||||
setNextBiome(this.generateNextBiome(nextWaveIndex));
|
setNextBiome(this.generateNextBiome(nextWaveIndex));
|
||||||
} else if (Array.isArray(biomeLinks[currentBiome])) {
|
} else if (Array.isArray(biomeLinks[currentBiome])) {
|
||||||
const biomes: BiomeId[] = (biomeLinks[currentBiome] as (BiomeId | [BiomeId, number])[])
|
const biomes: BiomeId[] = (biomeLinks[currentBiome] as (BiomeId | [BiomeId, number])[])
|
||||||
@ -73,9 +84,6 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
generateNextBiome(waveIndex: number): BiomeId {
|
generateNextBiome(waveIndex: number): BiomeId {
|
||||||
if (!(waveIndex % 50)) {
|
return waveIndex % 50 === 0 ? BiomeId.END : globalScene.generateRandomBiome(waveIndex);
|
||||||
return BiomeId.END;
|
|
||||||
}
|
|
||||||
return globalScene.generateRandomBiome(waveIndex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,9 @@ import { globalScene } from "#app/global-scene";
|
|||||||
import { modifierTypes } from "#data/data-lists";
|
import { modifierTypes } from "#data/data-lists";
|
||||||
import { BattleType } from "#enums/battle-type";
|
import { BattleType } from "#enums/battle-type";
|
||||||
import type { BattlerIndex } from "#enums/battler-index";
|
import type { BattlerIndex } from "#enums/battler-index";
|
||||||
import { ChallengeType } from "#enums/challenge-type";
|
|
||||||
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves";
|
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves";
|
||||||
import type { CustomModifierSettings } from "#modifiers/modifier-type";
|
|
||||||
import { handleMysteryEncounterVictory } from "#mystery-encounters/encounter-phase-utils";
|
import { handleMysteryEncounterVictory } from "#mystery-encounters/encounter-phase-utils";
|
||||||
import { PokemonPhase } from "#phases/pokemon-phase";
|
import { PokemonPhase } from "#phases/pokemon-phase";
|
||||||
import { applyChallenges } from "#utils/challenge-utils";
|
|
||||||
import { BooleanHolder } from "#utils/common";
|
|
||||||
|
|
||||||
export class VictoryPhase extends PokemonPhase {
|
export class VictoryPhase extends PokemonPhase {
|
||||||
public readonly phaseName = "VictoryPhase";
|
public readonly phaseName = "VictoryPhase";
|
||||||
@ -49,15 +45,19 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
if (globalScene.currentBattle.battleType === BattleType.TRAINER) {
|
if (globalScene.currentBattle.battleType === BattleType.TRAINER) {
|
||||||
globalScene.phaseManager.pushNew("TrainerVictoryPhase");
|
globalScene.phaseManager.pushNew("TrainerVictoryPhase");
|
||||||
}
|
}
|
||||||
if (globalScene.gameMode.isEndless || !globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex)) {
|
|
||||||
|
const gameMode = globalScene.gameMode;
|
||||||
|
const currentWaveIndex = globalScene.currentBattle.waveIndex;
|
||||||
|
|
||||||
|
if (gameMode.isEndless || !gameMode.isWaveFinal(currentWaveIndex)) {
|
||||||
globalScene.phaseManager.pushNew("EggLapsePhase");
|
globalScene.phaseManager.pushNew("EggLapsePhase");
|
||||||
if (globalScene.gameMode.isClassic) {
|
if (gameMode.isClassic) {
|
||||||
switch (globalScene.currentBattle.waveIndex) {
|
switch (currentWaveIndex) {
|
||||||
case ClassicFixedBossWaves.RIVAL_1:
|
case ClassicFixedBossWaves.RIVAL_1:
|
||||||
case ClassicFixedBossWaves.RIVAL_2:
|
case ClassicFixedBossWaves.RIVAL_2:
|
||||||
// Get event modifiers for this wave
|
// Get event modifiers for this wave
|
||||||
timedEventManager
|
timedEventManager
|
||||||
.getFixedBattleEventRewards(globalScene.currentBattle.waveIndex)
|
.getFixedBattleEventRewards(currentWaveIndex)
|
||||||
.map(r => globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes[r]));
|
.map(r => globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes[r]));
|
||||||
break;
|
break;
|
||||||
case ClassicFixedBossWaves.EVIL_BOSS_2:
|
case ClassicFixedBossWaves.EVIL_BOSS_2:
|
||||||
@ -66,59 +66,53 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const healStatus = new BooleanHolder(globalScene.currentBattle.waveIndex % 10 === 0);
|
if (currentWaveIndex % 10) {
|
||||||
applyChallenges(ChallengeType.PARTY_HEAL, healStatus);
|
|
||||||
if (!healStatus.value) {
|
|
||||||
globalScene.phaseManager.pushNew(
|
globalScene.phaseManager.pushNew(
|
||||||
"SelectModifierPhase",
|
"SelectModifierPhase",
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
this.getFixedBattleCustomModifiers(),
|
gameMode.isFixedBattle(currentWaveIndex)
|
||||||
|
? gameMode.getFixedBattle(currentWaveIndex).customModifierRewardSettings
|
||||||
|
: undefined,
|
||||||
);
|
);
|
||||||
} else if (globalScene.gameMode.isDaily) {
|
} else if (gameMode.isDaily) {
|
||||||
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.EXP_CHARM);
|
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.EXP_CHARM);
|
||||||
if (
|
if (currentWaveIndex > 10 && !gameMode.isWaveFinal(currentWaveIndex)) {
|
||||||
globalScene.currentBattle.waveIndex > 10 &&
|
|
||||||
!globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex)
|
|
||||||
) {
|
|
||||||
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.GOLDEN_POKEBALL);
|
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.GOLDEN_POKEBALL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const superExpWave = !globalScene.gameMode.isEndless ? (globalScene.offsetGym ? 0 : 20) : 10;
|
const superExpWave = !gameMode.isEndless ? (globalScene.offsetGym ? 0 : 20) : 10;
|
||||||
if (globalScene.gameMode.isEndless && globalScene.currentBattle.waveIndex === 10) {
|
if (gameMode.isEndless && currentWaveIndex === 10) {
|
||||||
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.EXP_SHARE);
|
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.EXP_SHARE);
|
||||||
}
|
}
|
||||||
if (
|
if (currentWaveIndex <= 750 && (currentWaveIndex <= 500 || currentWaveIndex % 30 === superExpWave)) {
|
||||||
globalScene.currentBattle.waveIndex <= 750 &&
|
|
||||||
(globalScene.currentBattle.waveIndex <= 500 || globalScene.currentBattle.waveIndex % 30 === superExpWave)
|
|
||||||
) {
|
|
||||||
globalScene.phaseManager.pushNew(
|
globalScene.phaseManager.pushNew(
|
||||||
"ModifierRewardPhase",
|
"ModifierRewardPhase",
|
||||||
globalScene.currentBattle.waveIndex % 30 !== superExpWave || globalScene.currentBattle.waveIndex > 250
|
currentWaveIndex % 30 !== superExpWave || currentWaveIndex > 250
|
||||||
? modifierTypes.EXP_CHARM
|
? modifierTypes.EXP_CHARM
|
||||||
: modifierTypes.SUPER_EXP_CHARM,
|
: modifierTypes.SUPER_EXP_CHARM,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (globalScene.currentBattle.waveIndex <= 150 && !(globalScene.currentBattle.waveIndex % 50)) {
|
if (currentWaveIndex <= 150 && !(currentWaveIndex % 50)) {
|
||||||
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.GOLDEN_POKEBALL);
|
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.GOLDEN_POKEBALL);
|
||||||
}
|
}
|
||||||
if (globalScene.gameMode.isEndless && !(globalScene.currentBattle.waveIndex % 50)) {
|
if (gameMode.isEndless && !(currentWaveIndex % 50)) {
|
||||||
globalScene.phaseManager.pushNew(
|
globalScene.phaseManager.pushNew(
|
||||||
"ModifierRewardPhase",
|
"ModifierRewardPhase",
|
||||||
!(globalScene.currentBattle.waveIndex % 250) ? modifierTypes.VOUCHER_PREMIUM : modifierTypes.VOUCHER_PLUS,
|
!(currentWaveIndex % 250) ? modifierTypes.VOUCHER_PREMIUM : modifierTypes.VOUCHER_PLUS,
|
||||||
);
|
);
|
||||||
globalScene.phaseManager.pushNew("AddEnemyBuffModifierPhase");
|
globalScene.phaseManager.pushNew("AddEnemyBuffModifierPhase");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (globalScene.gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
|
if (gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
|
||||||
globalScene.phaseManager.pushNew("SelectBiomePhase");
|
globalScene.phaseManager.pushNew("SelectBiomePhase");
|
||||||
}
|
}
|
||||||
|
|
||||||
globalScene.phaseManager.pushNew("NewBattlePhase");
|
globalScene.phaseManager.pushNew("NewBattlePhase");
|
||||||
} else {
|
} else {
|
||||||
globalScene.currentBattle.battleType = BattleType.CLEAR;
|
globalScene.currentBattle.battleType = BattleType.CLEAR;
|
||||||
globalScene.score += globalScene.gameMode.getClearScoreBonus();
|
globalScene.score += gameMode.getClearScoreBonus();
|
||||||
globalScene.updateScoreText();
|
globalScene.updateScoreText();
|
||||||
globalScene.phaseManager.pushNew("GameOverPhase", true);
|
globalScene.phaseManager.pushNew("GameOverPhase", true);
|
||||||
}
|
}
|
||||||
@ -126,18 +120,4 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
|
|
||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If this wave is a fixed battle with special custom modifier rewards,
|
|
||||||
* will pass those settings to the upcoming {@linkcode SelectModifierPhase}`.
|
|
||||||
*/
|
|
||||||
getFixedBattleCustomModifiers(): CustomModifierSettings | undefined {
|
|
||||||
const gameMode = globalScene.gameMode;
|
|
||||||
const waveIndex = globalScene.currentBattle.waveIndex;
|
|
||||||
if (gameMode.isFixedBattle(waveIndex)) {
|
|
||||||
return gameMode.getFixedBattle(waveIndex).customModifierRewardSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -448,6 +448,8 @@ export function getAchievementDescription(localizationKey: string): string {
|
|||||||
return i18next.t("achv:FLIP_STATS.description", { context: genderStr });
|
return i18next.t("achv:FLIP_STATS.description", { context: genderStr });
|
||||||
case "FLIP_INVERSE":
|
case "FLIP_INVERSE":
|
||||||
return i18next.t("achv:FLIP_INVERSE.description", { context: genderStr });
|
return i18next.t("achv:FLIP_INVERSE.description", { context: genderStr });
|
||||||
|
case "NUZLOCKE":
|
||||||
|
return i18next.t("achv:NUZLOCKE.description", { context: genderStr });
|
||||||
case "BREEDERS_IN_SPACE":
|
case "BREEDERS_IN_SPACE":
|
||||||
return i18next.t("achv:BREEDERS_IN_SPACE.description", {
|
return i18next.t("achv:BREEDERS_IN_SPACE.description", {
|
||||||
context: genderStr,
|
context: genderStr,
|
||||||
|
@ -208,6 +208,26 @@ export class PokedexMonContainer extends Phaser.GameObjects.Container {
|
|||||||
);
|
);
|
||||||
this.checkIconId(defaultProps.female, defaultProps.formIndex, defaultProps.shiny, defaultProps.variant);
|
this.checkIconId(defaultProps.female, defaultProps.formIndex, defaultProps.shiny, defaultProps.variant);
|
||||||
this.add(this.icon);
|
this.add(this.icon);
|
||||||
|
|
||||||
|
[
|
||||||
|
this.hiddenAbilityIcon,
|
||||||
|
this.favoriteIcon,
|
||||||
|
this.classicWinIcon,
|
||||||
|
this.candyUpgradeIcon,
|
||||||
|
this.candyUpgradeOverlayIcon,
|
||||||
|
this.eggMove1Icon,
|
||||||
|
this.tmMove1Icon,
|
||||||
|
this.eggMove2Icon,
|
||||||
|
this.tmMove2Icon,
|
||||||
|
this.passive1Icon,
|
||||||
|
this.passive2Icon,
|
||||||
|
this.passive1OverlayIcon,
|
||||||
|
this.passive2OverlayIcon,
|
||||||
|
].forEach(icon => {
|
||||||
|
if (icon) {
|
||||||
|
this.bringToTop(icon);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
checkIconId(female, formIndex, shiny, variant) {
|
checkIconId(female, formIndex, shiny, variant) {
|
||||||
|
@ -410,6 +410,11 @@ export class PokedexUiHandler extends MessageUiHandler {
|
|||||||
new DropDownLabel(i18next.t("filterBar:hasHiddenAbility"), undefined, DropDownState.ON),
|
new DropDownLabel(i18next.t("filterBar:hasHiddenAbility"), undefined, DropDownState.ON),
|
||||||
new DropDownLabel(i18next.t("filterBar:noHiddenAbility"), undefined, DropDownState.EXCLUDE),
|
new DropDownLabel(i18next.t("filterBar:noHiddenAbility"), undefined, DropDownState.EXCLUDE),
|
||||||
];
|
];
|
||||||
|
const seenSpeciesLabels = [
|
||||||
|
new DropDownLabel(i18next.t("filterBar:seenSpecies"), undefined, DropDownState.OFF),
|
||||||
|
new DropDownLabel(i18next.t("filterBar:isSeen"), undefined, DropDownState.ON),
|
||||||
|
new DropDownLabel(i18next.t("filterBar:isUnseen"), undefined, DropDownState.EXCLUDE),
|
||||||
|
];
|
||||||
const eggLabels = [
|
const eggLabels = [
|
||||||
new DropDownLabel(i18next.t("filterBar:egg"), undefined, DropDownState.OFF),
|
new DropDownLabel(i18next.t("filterBar:egg"), undefined, DropDownState.OFF),
|
||||||
new DropDownLabel(i18next.t("filterBar:eggPurchasable"), undefined, DropDownState.ON),
|
new DropDownLabel(i18next.t("filterBar:eggPurchasable"), undefined, DropDownState.ON),
|
||||||
@ -423,6 +428,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
|||||||
new DropDownOption("FAVORITE", favoriteLabels),
|
new DropDownOption("FAVORITE", favoriteLabels),
|
||||||
new DropDownOption("WIN", winLabels),
|
new DropDownOption("WIN", winLabels),
|
||||||
new DropDownOption("HIDDEN_ABILITY", hiddenAbilityLabels),
|
new DropDownOption("HIDDEN_ABILITY", hiddenAbilityLabels),
|
||||||
|
new DropDownOption("SEEN_SPECIES", seenSpeciesLabels),
|
||||||
new DropDownOption("EGG", eggLabels),
|
new DropDownOption("EGG", eggLabels),
|
||||||
new DropDownOption("POKERUS", pokerusLabels),
|
new DropDownOption("POKERUS", pokerusLabels),
|
||||||
];
|
];
|
||||||
@ -792,13 +798,15 @@ export class PokedexUiHandler extends MessageUiHandler {
|
|||||||
this.starterSelectMessageBoxContainer.setVisible(!!text?.length);
|
this.starterSelectMessageBoxContainer.setVisible(!!text?.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
isSeen(species: PokemonSpecies, dexEntry: DexEntry): boolean {
|
isSeen(species: PokemonSpecies, dexEntry: DexEntry, seenFilter?: boolean): boolean {
|
||||||
if (dexEntry?.seenAttr) {
|
if (dexEntry?.seenAttr) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (!seenFilter) {
|
||||||
const starterDexEntry = globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)];
|
const starterDexEntry = globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)];
|
||||||
return !!starterDexEntry?.caughtAttr;
|
return !!starterDexEntry?.caughtAttr;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1617,6 +1625,21 @@ export class PokedexUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Seen Filter
|
||||||
|
const dexEntry = globalScene.gameData.dexData[species.speciesId];
|
||||||
|
const isItSeen = this.isSeen(species, dexEntry, true);
|
||||||
|
const fitsSeen = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
||||||
|
if (misc.val === "SEEN_SPECIES" && misc.state === DropDownState.ON) {
|
||||||
|
return isItSeen;
|
||||||
|
}
|
||||||
|
if (misc.val === "SEEN_SPECIES" && misc.state === DropDownState.EXCLUDE) {
|
||||||
|
return !isItSeen;
|
||||||
|
}
|
||||||
|
if (misc.val === "SEEN_SPECIES" && misc.state === DropDownState.OFF) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Egg Purchasable Filter
|
// Egg Purchasable Filter
|
||||||
const isEggPurchasable = this.isSameSpeciesEggAvailable(species.speciesId);
|
const isEggPurchasable = this.isSameSpeciesEggAvailable(species.speciesId);
|
||||||
const fitsEgg = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
const fitsEgg = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
||||||
@ -1658,6 +1681,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
|||||||
fitsFavorite &&
|
fitsFavorite &&
|
||||||
fitsWin &&
|
fitsWin &&
|
||||||
fitsHA &&
|
fitsHA &&
|
||||||
|
fitsSeen &&
|
||||||
fitsEgg &&
|
fitsEgg &&
|
||||||
fitsPokerus
|
fitsPokerus
|
||||||
) {
|
) {
|
||||||
|
@ -210,7 +210,8 @@ export class RunInfoUiHandler extends UiHandler {
|
|||||||
this.runContainer.add(headerText);
|
this.runContainer.add(headerText);
|
||||||
const runName = addTextObject(0, 0, this.runInfo.name, TextStyle.WINDOW);
|
const runName = addTextObject(0, 0, this.runInfo.name, TextStyle.WINDOW);
|
||||||
runName.setOrigin(0, 0);
|
runName.setOrigin(0, 0);
|
||||||
runName.setPositionRelative(headerBg, 60, 4);
|
const runNameX = headerText.width / 6 + headerText.x + 4;
|
||||||
|
runName.setPositionRelative(headerBg, runNameX, 4);
|
||||||
this.runContainer.add(runName);
|
this.runContainer.add(runName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ describe("Abilities - Cud Chew", () => {
|
|||||||
expect(abDisplaySpy.mock.calls[1][2]).toBe(false);
|
expect(abDisplaySpy.mock.calls[1][2]).toBe(false);
|
||||||
|
|
||||||
// should display messgae
|
// should display messgae
|
||||||
expect(game.textInterceptor.getLatestMessage()).toBe(
|
expect(game.textInterceptor.logs).toContain(
|
||||||
i18next.t("battle:hpIsFull", {
|
i18next.t("battle:hpIsFull", {
|
||||||
pokemonName: getPokemonNameWithAffix(farigiraf),
|
pokemonName: getPokemonNameWithAffix(farigiraf),
|
||||||
}),
|
}),
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import { Challenges } from "#enums/challenges";
|
import { Challenges } from "#enums/challenges";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
import { PokeballType } from "#enums/pokeball";
|
import { PokeballType } from "#enums/pokeball";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
|
import { runMysteryEncounterToEnd } from "#test/mystery-encounter/encounter-test-utils";
|
||||||
import { GameManager } from "#test/test-utils/game-manager";
|
import { GameManager } from "#test/test-utils/game-manager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
@ -52,4 +54,18 @@ describe("Challenges - Limited Catch", () => {
|
|||||||
|
|
||||||
expect(game.scene.getPlayerParty()).toHaveLength(1);
|
expect(game.scene.getPlayerParty()).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should allow gift Pokémon from Mystery Encounters to be added to party", async () => {
|
||||||
|
game.override
|
||||||
|
.mysteryEncounterChance(100)
|
||||||
|
.mysteryEncounter(MysteryEncounterType.THE_POKEMON_SALESMAN)
|
||||||
|
.startingWave(12);
|
||||||
|
game.scene.money = 20000;
|
||||||
|
|
||||||
|
await game.challengeMode.runToSummon([SpeciesId.NUZLEAF]);
|
||||||
|
|
||||||
|
await runMysteryEncounterToEnd(game, 1);
|
||||||
|
|
||||||
|
expect(game.scene.getPlayerParty()).toHaveLength(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@ import { Challenges } from "#enums/challenges";
|
|||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
|
import { ExpBoosterModifier } from "#modifiers/modifier";
|
||||||
import { GameManager } from "#test/test-utils/game-manager";
|
import { GameManager } from "#test/test-utils/game-manager";
|
||||||
import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler";
|
import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
@ -75,6 +76,7 @@ describe("Challenges - Limited Support", () => {
|
|||||||
await game.doKillOpponents();
|
await game.doKillOpponents();
|
||||||
await game.toNextWave();
|
await game.toNextWave();
|
||||||
|
|
||||||
|
expect(game.scene.getModifiers(ExpBoosterModifier)).toHaveLength(1);
|
||||||
expect(playerPokemon).not.toHaveFullHp();
|
expect(playerPokemon).not.toHaveFullHp();
|
||||||
|
|
||||||
game.move.use(MoveId.SPLASH);
|
game.move.use(MoveId.SPLASH);
|
||||||
|
@ -9,7 +9,7 @@ import { TurnStartPhase } from "#phases/turn-start-phase";
|
|||||||
import { GameManager } from "#test/test-utils/game-manager";
|
import { GameManager } from "#test/test-utils/game-manager";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
describe("Moves - Focus Punch", () => {
|
describe("Moves - Focus Punch", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -125,8 +125,8 @@ describe("Moves - Focus Punch", () => {
|
|||||||
game.move.select(MoveId.FOCUS_PUNCH);
|
game.move.select(MoveId.FOCUS_PUNCH);
|
||||||
await game.phaseInterceptor.to("MoveEndPhase", true);
|
await game.phaseInterceptor.to("MoveEndPhase", true);
|
||||||
await game.phaseInterceptor.to("MessagePhase", false);
|
await game.phaseInterceptor.to("MessagePhase", false);
|
||||||
const consoleSpy = vi.spyOn(console, "log");
|
|
||||||
await game.phaseInterceptor.to("MoveEndPhase", true);
|
await game.phaseInterceptor.to("MoveEndPhase", true);
|
||||||
expect(consoleSpy).nthCalledWith(1, i18next.t("moveTriggers:lostFocus", { pokemonName: "Charizard" }));
|
expect(game.textInterceptor.logs).toContain(i18next.t("moveTriggers:lostFocus", { pokemonName: "Charizard" }));
|
||||||
|
expect(game.textInterceptor.logs).not.toContain(i18next.t("battle:attackFailed"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -6,17 +6,13 @@ import * as bypassLoginModule from "#app/global-vars/bypass-login";
|
|||||||
import { MoveAnim } from "#data/battle-anims";
|
import { MoveAnim } from "#data/battle-anims";
|
||||||
import { Pokemon } from "#field/pokemon";
|
import { Pokemon } from "#field/pokemon";
|
||||||
import { version } from "#package.json";
|
import { version } from "#package.json";
|
||||||
import { blobToString } from "#test/test-utils/game-manager-utils";
|
|
||||||
import { MockClock } from "#test/test-utils/mocks/mock-clock";
|
import { MockClock } from "#test/test-utils/mocks/mock-clock";
|
||||||
import { MockFetch } from "#test/test-utils/mocks/mock-fetch";
|
|
||||||
import { MockGameObjectCreator } from "#test/test-utils/mocks/mock-game-object-creator";
|
import { MockGameObjectCreator } from "#test/test-utils/mocks/mock-game-object-creator";
|
||||||
import { MockLoader } from "#test/test-utils/mocks/mock-loader";
|
import { MockLoader } from "#test/test-utils/mocks/mock-loader";
|
||||||
import { MockTextureManager } from "#test/test-utils/mocks/mock-texture-manager";
|
import { MockTextureManager } from "#test/test-utils/mocks/mock-texture-manager";
|
||||||
import { MockTimedEventManager } from "#test/test-utils/mocks/mock-timed-event-manager";
|
import { MockTimedEventManager } from "#test/test-utils/mocks/mock-timed-event-manager";
|
||||||
import { MockContainer } from "#test/test-utils/mocks/mocks-container/mock-container";
|
import { MockContainer } from "#test/test-utils/mocks/mocks-container/mock-container";
|
||||||
import { PokedexMonContainer } from "#ui/pokedex-mon-container";
|
import { PokedexMonContainer } from "#ui/pokedex-mon-container";
|
||||||
import { sessionIdKey } from "#utils/common";
|
|
||||||
import { setCookie } from "#utils/cookies";
|
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { vi } from "vitest";
|
import { vi } from "vitest";
|
||||||
@ -28,20 +24,6 @@ const GamepadPlugin = Phaser.Input.Gamepad.GamepadPlugin;
|
|||||||
const EventEmitter = Phaser.Events.EventEmitter;
|
const EventEmitter = Phaser.Events.EventEmitter;
|
||||||
const UpdateList = Phaser.GameObjects.UpdateList;
|
const UpdateList = Phaser.GameObjects.UpdateList;
|
||||||
|
|
||||||
window.URL.createObjectURL = (blob: Blob) => {
|
|
||||||
blobToString(blob).then((data: string) => {
|
|
||||||
localStorage.setItem("toExport", data);
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
navigator.getGamepads = () => [];
|
|
||||||
global.fetch = vi.fn(MockFetch);
|
|
||||||
setCookie(sessionIdKey, "fake_token");
|
|
||||||
|
|
||||||
window.matchMedia = () => ({
|
|
||||||
matches: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
export class GameWrapper {
|
export class GameWrapper {
|
||||||
public game: Phaser.Game;
|
public game: Phaser.Game;
|
||||||
public scene: BattleScene;
|
public scene: BattleScene;
|
||||||
@ -99,6 +81,7 @@ export class GameWrapper {
|
|||||||
removeAll: () => null,
|
removeAll: () => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: Can't we just turn on `noAudio` in audio config?
|
||||||
this.scene.sound = {
|
this.scene.sound = {
|
||||||
play: () => null,
|
play: () => null,
|
||||||
pause: () => null,
|
pause: () => null,
|
||||||
|
@ -19,6 +19,7 @@ import type { ModifierOverride } from "#modifiers/modifier-type";
|
|||||||
import type { Variant } from "#sprites/variant";
|
import type { Variant } from "#sprites/variant";
|
||||||
import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper";
|
import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper";
|
||||||
import { coerceArray, shiftCharCodes } from "#utils/common";
|
import { coerceArray, shiftCharCodes } from "#utils/common";
|
||||||
|
import chalk from "chalk";
|
||||||
import { vi } from "vitest";
|
import { vi } from "vitest";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -665,6 +666,6 @@ export class OverridesHelper extends GameManagerHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private log(...params: any[]) {
|
private log(...params: any[]) {
|
||||||
console.log("Overrides:", ...params);
|
console.log(chalk.hex("#b0b01eff")("Overrides:", ...params));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,80 +0,0 @@
|
|||||||
const originalLog = console.log;
|
|
||||||
const originalError = console.error;
|
|
||||||
const originalDebug = console.debug;
|
|
||||||
const originalWarn = console.warn;
|
|
||||||
|
|
||||||
const blacklist = ["Phaser", "variant icon does not exist", 'Texture "%s" not found'];
|
|
||||||
const whitelist = ["Phase"];
|
|
||||||
|
|
||||||
export class MockConsoleLog {
|
|
||||||
constructor(
|
|
||||||
private logDisabled = false,
|
|
||||||
private phaseText = false,
|
|
||||||
) {}
|
|
||||||
private logs: any[] = [];
|
|
||||||
private notified: any[] = [];
|
|
||||||
|
|
||||||
public log(...args) {
|
|
||||||
const argsStr = this.getStr(args);
|
|
||||||
this.logs.push(argsStr);
|
|
||||||
if (this.logDisabled && !this.phaseText) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((this.phaseText && !whitelist.some(b => argsStr.includes(b))) || blacklist.some(b => argsStr.includes(b))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
originalLog(args);
|
|
||||||
}
|
|
||||||
public error(...args) {
|
|
||||||
const argsStr = this.getStr(args);
|
|
||||||
this.logs.push(argsStr);
|
|
||||||
originalError(args); // Appelle le console.error originel
|
|
||||||
}
|
|
||||||
public debug(...args) {
|
|
||||||
const argsStr = this.getStr(args);
|
|
||||||
this.logs.push(argsStr);
|
|
||||||
if (this.logDisabled && !this.phaseText) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!whitelist.some(b => argsStr.includes(b)) || blacklist.some(b => argsStr.includes(b))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
originalDebug(args);
|
|
||||||
}
|
|
||||||
warn(...args) {
|
|
||||||
const argsStr = this.getStr(args);
|
|
||||||
this.logs.push(args);
|
|
||||||
if (this.logDisabled && !this.phaseText) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!whitelist.some(b => argsStr.includes(b)) || blacklist.some(b => argsStr.includes(b))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
originalWarn(args);
|
|
||||||
}
|
|
||||||
notify(msg) {
|
|
||||||
originalLog(msg);
|
|
||||||
this.notified.push(msg);
|
|
||||||
}
|
|
||||||
getLogs() {
|
|
||||||
return this.logs;
|
|
||||||
}
|
|
||||||
clearLogs() {
|
|
||||||
this.logs = [];
|
|
||||||
}
|
|
||||||
getStr(...args) {
|
|
||||||
return args
|
|
||||||
.map(arg => {
|
|
||||||
if (typeof arg === "object" && arg !== null) {
|
|
||||||
// Handle objects including arrays
|
|
||||||
return JSON.stringify(arg, (_key, value) => (typeof value === "bigint" ? value.toString() : value));
|
|
||||||
}
|
|
||||||
if (typeof arg === "bigint") {
|
|
||||||
// Handle BigInt values
|
|
||||||
return arg.toString();
|
|
||||||
}
|
|
||||||
return arg.toString();
|
|
||||||
})
|
|
||||||
.join(";");
|
|
||||||
}
|
|
||||||
}
|
|
150
test/test-utils/mocks/mock-console/color-map.json
Normal file
150
test/test-utils/mocks/mock-console/color-map.json
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
{
|
||||||
|
"AliceBlue": "f0f8ff",
|
||||||
|
"AntiqueWhite": "faebd7",
|
||||||
|
"Aqua": "00ffff",
|
||||||
|
"Aquamarine": "7fffd4",
|
||||||
|
"Azure": "f0ffff",
|
||||||
|
"Beige": "f5f5dc",
|
||||||
|
"Bisque": "ffe4c4",
|
||||||
|
"Black": "000000",
|
||||||
|
"BlanchedAlmond": "ffebcd",
|
||||||
|
"Blue": "0000ff",
|
||||||
|
"BlueViolet": "8a2be2",
|
||||||
|
"Brown": "a52a2a",
|
||||||
|
"BurlyWood": "deb887",
|
||||||
|
"CadetBlue": "5f9ea0",
|
||||||
|
"Chartreuse": "7fff00",
|
||||||
|
"Chocolate": "d2691e",
|
||||||
|
"Coral": "ff7f50",
|
||||||
|
"CornflowerBlue": "6495ed",
|
||||||
|
"Cornsilk": "fff8dc",
|
||||||
|
"Crimson": "dc143c",
|
||||||
|
"Cyan": "00ffff",
|
||||||
|
"DarkBlue": "00008b",
|
||||||
|
"DarkCyan": "008b8b",
|
||||||
|
"DarkGoldenRod": "b8860b",
|
||||||
|
"DarkGray": "a9a9a9",
|
||||||
|
"DarkGrey": "a9a9a9",
|
||||||
|
"DarkGreen": "006400",
|
||||||
|
"DarkKhaki": "bdb76b",
|
||||||
|
"DarkMagenta": "8b008b",
|
||||||
|
"DarkOliveGreen": "556b2f",
|
||||||
|
"DarkOrange": "ff8c00",
|
||||||
|
"DarkOrchid": "9932cc",
|
||||||
|
"DarkRed": "8b0000",
|
||||||
|
"DarkSalmon": "e9967a",
|
||||||
|
"DarkSeaGreen": "8fbc8f",
|
||||||
|
"DarkSlateBlue": "483d8b",
|
||||||
|
"DarkSlateGray": "2f4f4f",
|
||||||
|
"DarkSlateGrey": "2f4f4f",
|
||||||
|
"DarkTurquoise": "00ced1",
|
||||||
|
"DarkViolet": "9400d3",
|
||||||
|
"DeepPink": "ff1493",
|
||||||
|
"DeepSkyBlue": "00bfff",
|
||||||
|
"DimGray": "696969",
|
||||||
|
"DimGrey": "696969",
|
||||||
|
"DodgerBlue": "1e90ff",
|
||||||
|
"FireBrick": "b22222",
|
||||||
|
"FloralWhite": "fffaf0",
|
||||||
|
"ForestGreen": "228b22",
|
||||||
|
"Fuchsia": "ff00ff",
|
||||||
|
"Gainsboro": "dcdcdc",
|
||||||
|
"GhostWhite": "f8f8ff",
|
||||||
|
"Gold": "ffd700",
|
||||||
|
"GoldenRod": "daa520",
|
||||||
|
"Gray": "808080",
|
||||||
|
"Grey": "808080",
|
||||||
|
"Green": "008000",
|
||||||
|
"GreenYellow": "adff2f",
|
||||||
|
"HoneyDew": "f0fff0",
|
||||||
|
"HotPink": "ff69b4",
|
||||||
|
"IndianRed": "cd5c5c",
|
||||||
|
"Indigo": "4b0082",
|
||||||
|
"Ivory": "fffff0",
|
||||||
|
"Khaki": "f0e68c",
|
||||||
|
"Lavender": "e6e6fa",
|
||||||
|
"LavenderBlush": "fff0f5",
|
||||||
|
"LawnGreen": "7cfc00",
|
||||||
|
"LemonChiffon": "fffacd",
|
||||||
|
"LightBlue": "add8e6",
|
||||||
|
"LightCoral": "f08080",
|
||||||
|
"LightCyan": "e0ffff",
|
||||||
|
"LightGoldenRodYellow": "fafad2",
|
||||||
|
"LightGray": "d3d3d3",
|
||||||
|
"LightGrey": "d3d3d3",
|
||||||
|
"LightGreen": "90ee90",
|
||||||
|
"LightPink": "ffb6c1",
|
||||||
|
"LightSalmon": "ffa07a",
|
||||||
|
"LightSeaGreen": "20b2aa",
|
||||||
|
"LightSkyBlue": "87cefa",
|
||||||
|
"LightSlateGray": "778899",
|
||||||
|
"LightSlateGrey": "778899",
|
||||||
|
"LightSteelBlue": "b0c4de",
|
||||||
|
"LightYellow": "ffffe0",
|
||||||
|
"Lime": "00ff00",
|
||||||
|
"LimeGreen": "32cd32",
|
||||||
|
"Linen": "faf0e6",
|
||||||
|
"Magenta": "ff00ff",
|
||||||
|
"Maroon": "800000",
|
||||||
|
"MediumAquaMarine": "66cdaa",
|
||||||
|
"MediumBlue": "0000cd",
|
||||||
|
"MediumOrchid": "ba55d3",
|
||||||
|
"MediumPurple": "9370db",
|
||||||
|
"MediumSeaGreen": "3cb371",
|
||||||
|
"MediumSlateBlue": "7b68ee",
|
||||||
|
"MediumSpringGreen": "00fa9a",
|
||||||
|
"MediumTurquoise": "48d1cc",
|
||||||
|
"MediumVioletRed": "c71585",
|
||||||
|
"MidnightBlue": "191970",
|
||||||
|
"MintCream": "f5fffa",
|
||||||
|
"MistyRose": "ffe4e1",
|
||||||
|
"Moccasin": "ffe4b5",
|
||||||
|
"NavajoWhite": "ffdead",
|
||||||
|
"Navy": "000080",
|
||||||
|
"OldLace": "fdf5e6",
|
||||||
|
"Olive": "808000",
|
||||||
|
"OliveDrab": "6b8e23",
|
||||||
|
"Orange": "ffa500",
|
||||||
|
"OrangeRed": "ff4500",
|
||||||
|
"Orchid": "da70d6",
|
||||||
|
"PaleGoldenRod": "eee8aa",
|
||||||
|
"PaleGreen": "98fb98",
|
||||||
|
"PaleTurquoise": "afeeee",
|
||||||
|
"PaleVioletRed": "db7093",
|
||||||
|
"PapayaWhip": "ffefd5",
|
||||||
|
"PeachPuff": "ffdab9",
|
||||||
|
"Peru": "cd853f",
|
||||||
|
"Pink": "ffc0cb",
|
||||||
|
"Plum": "dda0dd",
|
||||||
|
"PowderBlue": "b0e0e6",
|
||||||
|
"Purple": "800080",
|
||||||
|
"RebeccaPurple": "663399",
|
||||||
|
"Red": "ff0000",
|
||||||
|
"RosyBrown": "bc8f8f",
|
||||||
|
"RoyalBlue": "4169e1",
|
||||||
|
"SaddleBrown": "8b4513",
|
||||||
|
"Salmon": "fa8072",
|
||||||
|
"SandyBrown": "f4a460",
|
||||||
|
"SeaGreen": "2e8b57",
|
||||||
|
"SeaShell": "fff5ee",
|
||||||
|
"Sienna": "a0522d",
|
||||||
|
"Silver": "c0c0c0",
|
||||||
|
"SkyBlue": "87ceeb",
|
||||||
|
"SlateBlue": "6a5acd",
|
||||||
|
"SlateGray": "708090",
|
||||||
|
"SlateGrey": "708090",
|
||||||
|
"Snow": "fffafa",
|
||||||
|
"SpringGreen": "00ff7f",
|
||||||
|
"SteelBlue": "4682b4",
|
||||||
|
"Tan": "d2b48c",
|
||||||
|
"Teal": "008080",
|
||||||
|
"Thistle": "d8bfd8",
|
||||||
|
"Tomato": "ff6347",
|
||||||
|
"Turquoise": "40e0d0",
|
||||||
|
"Violet": "ee82ee",
|
||||||
|
"Wheat": "f5deb3",
|
||||||
|
"White": "ffffff",
|
||||||
|
"WhiteSmoke": "f5f5f5",
|
||||||
|
"Yellow": "ffff00",
|
||||||
|
"YellowGreen": "9acd32"
|
||||||
|
}
|
61
test/test-utils/mocks/mock-console/infer-color.ts
Normal file
61
test/test-utils/mocks/mock-console/infer-color.ts
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import { hslToHex } from "#utils/common";
|
||||||
|
import chalk, { type ChalkInstance, type ForegroundColorName, foregroundColorNames } from "chalk";
|
||||||
|
import colorMap from "./color-map.json";
|
||||||
|
|
||||||
|
export function inferColorFormat(data: [string, ...unknown[]]): ChalkInstance {
|
||||||
|
// Remove all CSS format strings and find the first one containing something vaguely resembling a color
|
||||||
|
data[0] = data[0].replaceAll("%c", "");
|
||||||
|
const args = data.slice(1).filter(t => typeof t === "string");
|
||||||
|
const color = findColorPrefix(args);
|
||||||
|
|
||||||
|
// If the color is within Chalk's native roster, use it directly.
|
||||||
|
if ((foregroundColorNames as string[]).includes(color)) {
|
||||||
|
return chalk[color as ForegroundColorName];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, coerce it to hex before feeding it in.
|
||||||
|
return getColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the first string with a "color:" CSS directive in an argument list.
|
||||||
|
* @param args - The arguments containing the color directive
|
||||||
|
* @returns The found color, or `"green"` if none were found
|
||||||
|
*/
|
||||||
|
function findColorPrefix(args: string[]): string {
|
||||||
|
for (const arg of args) {
|
||||||
|
const match = /color:\s*(.+?)(?:;|$)/g.exec(arg);
|
||||||
|
if (match === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return match[1];
|
||||||
|
}
|
||||||
|
return "green";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Coerce an arbitrary CSS color string to a Chalk instance.
|
||||||
|
* @param color - The color to coerce
|
||||||
|
* @returns The Chalk color equivalent.
|
||||||
|
*/
|
||||||
|
function getColor(color: string): ChalkInstance {
|
||||||
|
if (/^#([a-z0-9]{3,4}|[a-z0-9]{6}|[a-z0-9]{8})$/i.test(color)) {
|
||||||
|
// already in hex
|
||||||
|
return chalk.hex(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
const rgbMatch = /^rgba?\((\d{1,3})%?,\s*(\d{1,3})%?,?\s*(\d{1,3})%?,\s*/i.exec(color);
|
||||||
|
if (rgbMatch) {
|
||||||
|
const [red, green, blue] = rgbMatch;
|
||||||
|
return chalk.rgb(+red, +green, +blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
const hslMatch = /^hslv?\((\d{1,3}),\s*(\d{1,3})%,\s*(\d{1,3})%\)$/i.exec(color);
|
||||||
|
if (hslMatch) {
|
||||||
|
const [hue, saturation, light] = hslMatch;
|
||||||
|
return chalk.hex(hslToHex(+hue, +saturation / 100, +light / 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
return chalk.hex(colorMap[color] ?? "#00ff95ff");
|
||||||
|
}
|
140
test/test-utils/mocks/mock-console/mock-console.ts
Normal file
140
test/test-utils/mocks/mock-console/mock-console.ts
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
import { inferColorFormat } from "#test/test-utils/mocks/mock-console/infer-color";
|
||||||
|
import { coerceArray } from "#utils/common";
|
||||||
|
import { Console } from "node:console";
|
||||||
|
import { stderr, stdout } from "node:process";
|
||||||
|
import util from "node:util";
|
||||||
|
import chalk, { type ChalkInstance } from "chalk";
|
||||||
|
|
||||||
|
// Tell chalk we support truecolor
|
||||||
|
chalk.level = 3;
|
||||||
|
|
||||||
|
// TODO: Review this
|
||||||
|
const blacklist = [
|
||||||
|
"variant icon does not exist", // Repetitive warnings about icons not found
|
||||||
|
'Texture "%s" not found', // Repetitive warnings about textures not found
|
||||||
|
"type: 'Pokemon',", // Large Pokemon objects
|
||||||
|
"gameVersion: ", // Large session-data and system-data objects
|
||||||
|
"Phaser v", // Phaser version text
|
||||||
|
"Seed:", // Stuff about wave seed (we should really stop logging this shit)
|
||||||
|
"Wave Seed:", // Stuff about wave seed (we should really stop logging this shit)
|
||||||
|
];
|
||||||
|
const whitelist = ["Start Phase"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@linkcode MockConsole} is a wrapper around the global {@linkcode console} object.
|
||||||
|
* It automatically colors text and such.
|
||||||
|
*/
|
||||||
|
export class MockConsole extends Console {
|
||||||
|
/**
|
||||||
|
* A list of warnings that are queued to be displayed after all tests in the same file are finished.
|
||||||
|
*/
|
||||||
|
private static queuedWarnings: unknown[][] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queue a warning to be printed after all tests in the same file are finished.
|
||||||
|
*/
|
||||||
|
// TODO: Add some warnings
|
||||||
|
public static queuePostTestWarning(...data: unknown[]): void {
|
||||||
|
MockConsole.queuedWarnings.push(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super(stdout, stderr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print all post-test warnings that have been queued, and then clears the queue.
|
||||||
|
*/
|
||||||
|
public static printPostTestWarnings() {
|
||||||
|
for (const data of MockConsole.queuedWarnings) {
|
||||||
|
console.warn(...data);
|
||||||
|
}
|
||||||
|
MockConsole.queuedWarnings = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether a given set of data is in the blacklist to be barred from logging.
|
||||||
|
* @param data - The data being logged
|
||||||
|
* @returns Whether `data` is blacklisted from console logging
|
||||||
|
*/
|
||||||
|
private checkBlacklist(data: unknown[]): boolean {
|
||||||
|
const dataStr = this.getStr(data);
|
||||||
|
return !whitelist.some(b => dataStr.includes(b)) && blacklist.some(b => dataStr.includes(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
public trace(...data: unknown[]) {
|
||||||
|
if (this.checkBlacklist(data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Figure out how to add color to the full trace text
|
||||||
|
super.trace(...this.format(chalk.hex("#b700ff"), data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public debug(...data: unknown[]) {
|
||||||
|
if (this.checkBlacklist(data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.debug(...this.format(chalk.hex("#874600ff"), data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public log(...data: unknown[]): void {
|
||||||
|
if (this.checkBlacklist(data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let formatter: ChalkInstance | undefined;
|
||||||
|
|
||||||
|
if (data.some(d => typeof d === "string" && d.includes("color:"))) {
|
||||||
|
// Infer the color format from the arguments, then remove everything but the message.
|
||||||
|
formatter = inferColorFormat(data as [string, ...unknown[]]);
|
||||||
|
data.splice(1);
|
||||||
|
} else if (data[0] === "[UI]") {
|
||||||
|
// Cyan for UI debug messages
|
||||||
|
formatter = chalk.hex("#009dffff");
|
||||||
|
} else if (typeof data[0] === "string" && data[0].startsWith("=====")) {
|
||||||
|
// Orange logging for "New Turn"/etc messages
|
||||||
|
formatter = chalk.hex("#ffad00ff");
|
||||||
|
}
|
||||||
|
|
||||||
|
super.log(...this.format(formatter, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public warn(...data: unknown[]) {
|
||||||
|
if (this.checkBlacklist(data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.warn(...this.format(chalk.yellow, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public error(...data: unknown[]) {
|
||||||
|
if (this.checkBlacklist(data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.error(...this.format(chalk.redBright, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a human-readable string representation of `data`.
|
||||||
|
*/
|
||||||
|
private getStr(data: unknown) {
|
||||||
|
return util.inspect(data, { sorted: true, breakLength: 120 });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stringify the given data in a manner fit for logging.
|
||||||
|
* @param color - A Chalk instance or other transformation function used to transform the output,
|
||||||
|
* or `undefined` to not transform it at all.
|
||||||
|
* @param data - The data that the format should be applied to.
|
||||||
|
* @returns A stringified copy of `data` with {@linkcode color} applied to each individual argument.
|
||||||
|
* @todo Do we need to apply color to each entry or just run it through `util.format`?
|
||||||
|
*/
|
||||||
|
private format(color: ((s: unknown) => unknown) | undefined, data: unknown | unknown[]): unknown[] {
|
||||||
|
data = coerceArray(data);
|
||||||
|
color ??= a => a;
|
||||||
|
return (data as unknown[]).map(a => color(typeof a === "function" || typeof a === "object" ? this.getStr(a) : a));
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object";
|
import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object";
|
||||||
|
import type { TextInterceptor } from "#test/test-utils/text-interceptor";
|
||||||
import { UI } from "#ui/ui";
|
import { UI } from "#ui/ui";
|
||||||
|
|
||||||
export class MockText implements MockGameObject {
|
export class MockText implements MockGameObject {
|
||||||
@ -82,13 +83,14 @@ export class MockText implements MockGameObject {
|
|||||||
|
|
||||||
showText(
|
showText(
|
||||||
text: string,
|
text: string,
|
||||||
delay?: number | null,
|
_delay?: number | null,
|
||||||
callback?: Function | null,
|
callback?: Function | null,
|
||||||
callbackDelay?: number | null,
|
_callbackDelay?: number | null,
|
||||||
prompt?: boolean | null,
|
_prompt?: boolean | null,
|
||||||
promptDelay?: number | null,
|
_promptDelay?: number | null,
|
||||||
) {
|
) {
|
||||||
this.scene.messageWrapper.showText(text, delay, callback, callbackDelay, prompt, promptDelay);
|
// TODO: this is a very bad way to pass calls around
|
||||||
|
(this.scene.messageWrapper as TextInterceptor).showText(text);
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
@ -96,13 +98,13 @@ export class MockText implements MockGameObject {
|
|||||||
|
|
||||||
showDialogue(
|
showDialogue(
|
||||||
keyOrText: string,
|
keyOrText: string,
|
||||||
name: string | undefined,
|
name: string,
|
||||||
delay: number | null = 0,
|
_delay: number | null,
|
||||||
callback: Function,
|
callback: Function,
|
||||||
callbackDelay?: number,
|
_callbackDelay?: number,
|
||||||
promptDelay?: number,
|
_promptDelay?: number,
|
||||||
) {
|
) {
|
||||||
this.scene.messageWrapper.showDialogue(keyOrText, name, delay, callback, callbackDelay, promptDelay);
|
(this.scene.messageWrapper as TextInterceptor).showDialogue(keyOrText, name);
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import { SESSION_ID_COOKIE_NAME } from "#app/constants";
|
import { SESSION_ID_COOKIE_NAME } from "#app/constants";
|
||||||
import { initializeGame } from "#app/init/init";
|
|
||||||
import { initI18n } from "#plugins/i18n";
|
|
||||||
import { blobToString } from "#test/test-utils/game-manager-utils";
|
import { blobToString } from "#test/test-utils/game-manager-utils";
|
||||||
import { manageListeners } from "#test/test-utils/listeners-manager";
|
import { manageListeners } from "#test/test-utils/listeners-manager";
|
||||||
import { MockConsoleLog } from "#test/test-utils/mocks/mock-console-log";
|
import { MockConsole } from "#test/test-utils/mocks/mock-console/mock-console";
|
||||||
import { mockContext } from "#test/test-utils/mocks/mock-context-canvas";
|
import { mockContext } from "#test/test-utils/mocks/mock-context-canvas";
|
||||||
import { mockLocalStorage } from "#test/test-utils/mocks/mock-local-storage";
|
import { mockLocalStorage } from "#test/test-utils/mocks/mock-local-storage";
|
||||||
import { MockImage } from "#test/test-utils/mocks/mocks-container/mock-image";
|
import { MockImage } from "#test/test-utils/mocks/mocks-container/mock-image";
|
||||||
@ -12,40 +10,35 @@ import Phaser from "phaser";
|
|||||||
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
||||||
import InputText from "phaser3-rex-plugins/plugins/inputtext";
|
import InputText from "phaser3-rex-plugins/plugins/inputtext";
|
||||||
|
|
||||||
let wasInitialized = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run initialization code upon starting a new file, both per-suite and per-instance oncess.
|
* Run per-suite initialization code upon starting a new file.
|
||||||
*/
|
*/
|
||||||
export function initTests(): void {
|
export function initTests(): void {
|
||||||
setupStubs();
|
setupStubs();
|
||||||
if (!wasInitialized) {
|
|
||||||
initTestFile();
|
|
||||||
wasInitialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
manageListeners();
|
manageListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize various values at the beginning of each testing instance.
|
|
||||||
*/
|
|
||||||
function initTestFile(): void {
|
|
||||||
initI18n();
|
|
||||||
initializeGame();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup various stubs for testing.
|
* Setup various stubs for testing.
|
||||||
* @todo Move this into a dedicated stub file instead of running it once per test instance
|
* @todo Move this into a dedicated stub file instead of running it once per test instance
|
||||||
|
* @todo review these to see which are actually necessary
|
||||||
* @todo Investigate why this resets on new test suite start
|
* @todo Investigate why this resets on new test suite start
|
||||||
*/
|
*/
|
||||||
function setupStubs(): void {
|
function setupStubs(): void {
|
||||||
Object.defineProperty(window, "localStorage", {
|
console.log(console instanceof MockConsole);
|
||||||
value: mockLocalStorage(),
|
console.log(Phaser.GameObjects.Image instanceof MockImage);
|
||||||
});
|
Object.defineProperties(global, {
|
||||||
Object.defineProperty(window, "console", {
|
localStorage: {
|
||||||
value: new MockConsoleLog(false),
|
value: mockLocalStorage(),
|
||||||
|
},
|
||||||
|
console: {
|
||||||
|
value: new MockConsole(),
|
||||||
|
},
|
||||||
|
matchMedia: {
|
||||||
|
value: () => ({
|
||||||
|
matches: false,
|
||||||
|
}),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Object.defineProperty(document, "fonts", {
|
Object.defineProperty(document, "fonts", {
|
||||||
writable: true,
|
writable: true,
|
||||||
@ -69,11 +62,6 @@ function setupStubs(): void {
|
|||||||
navigator.getGamepads = () => [];
|
navigator.getGamepads = () => [];
|
||||||
setCookie(SESSION_ID_COOKIE_NAME, "fake_token");
|
setCookie(SESSION_ID_COOKIE_NAME, "fake_token");
|
||||||
|
|
||||||
window.matchMedia = () =>
|
|
||||||
({
|
|
||||||
matches: false,
|
|
||||||
}) as any;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this object's position relative to another object with a given offset
|
* Sets this object's position relative to another object with a given offset
|
||||||
* @param guideObject - The {@linkcode Phaser.GameObjects.GameObject} to base the position off of
|
* @param guideObject - The {@linkcode Phaser.GameObjects.GameObject} to base the position off of
|
||||||
|
@ -1,39 +1,49 @@
|
|||||||
|
import type { BattleScene } from "#app/battle-scene";
|
||||||
|
import chalk from "chalk";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class will intercept any text or dialogue message calls and log them for test purposes
|
* The {@linkcode TextInterceptor} is a wrapper class that intercepts and logs any messages
|
||||||
|
* that would be displayed on-screen.
|
||||||
*/
|
*/
|
||||||
export class TextInterceptor {
|
export class TextInterceptor {
|
||||||
private scene;
|
/** A log containing messages having been displayed on screen, sorted in FIFO order. */
|
||||||
public logs: string[] = [];
|
public readonly logs: string[] = [];
|
||||||
constructor(scene) {
|
|
||||||
this.scene = scene;
|
constructor(scene: BattleScene) {
|
||||||
|
// @ts-expect-error: Find another more sanitary way of doing this
|
||||||
scene.messageWrapper = this;
|
scene.messageWrapper = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
showText(
|
/** Clear the current content of the TextInterceptor. */
|
||||||
text: string,
|
public clearLogs(): void {
|
||||||
_delay?: number,
|
this.logs.splice(0);
|
||||||
_callback?: Function,
|
}
|
||||||
_callbackDelay?: number,
|
|
||||||
_prompt?: boolean,
|
showText(text: string): void {
|
||||||
_promptDelay?: number,
|
// NB: We do not format the raw _logs_ themselves as tests will be actively checking it.
|
||||||
): void {
|
console.log(this.formatText(text));
|
||||||
console.log(text);
|
|
||||||
this.logs.push(text);
|
this.logs.push(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
showDialogue(
|
showDialogue(text: string, name: string): void {
|
||||||
text: string,
|
console.log(`${name}: \n${this.formatText(text)}`);
|
||||||
name: string,
|
|
||||||
_delay?: number,
|
|
||||||
_callback?: Function,
|
|
||||||
_callbackDelay?: number,
|
|
||||||
_promptDelay?: number,
|
|
||||||
): void {
|
|
||||||
console.log(name, text);
|
|
||||||
this.logs.push(name, text);
|
this.logs.push(name, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
getLatestMessage(): string {
|
/**
|
||||||
return this.logs.pop() ?? "";
|
* Format text to be displayed to the test console, as follows:
|
||||||
|
* 1. Replaces new lines and new text boxes (marked by `$`) with indented new lines.
|
||||||
|
* 2. Removes all `@c{}`, `@d{}`, `@s{}`, and `@f{}` flags from the text.
|
||||||
|
* 3. Makes text blue
|
||||||
|
* @param text - The unformatted text
|
||||||
|
* @returns The formatted text
|
||||||
|
*/
|
||||||
|
private formatText(text: string): string {
|
||||||
|
return chalk.blue(
|
||||||
|
text
|
||||||
|
.replace(/\n/g, " ")
|
||||||
|
.replace(/\$/g, "\n ")
|
||||||
|
.replace(/@\w{.*?}/g, ""),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import "vitest-canvas-mock";
|
import "vitest-canvas-mock";
|
||||||
|
import { initializeGame } from "#app/init/init";
|
||||||
|
import { MockConsole } from "#test/test-utils/mocks/mock-console/mock-console";
|
||||||
import { initTests } from "#test/test-utils/test-file-initialization";
|
import { initTests } from "#test/test-utils/test-file-initialization";
|
||||||
|
import chalk from "chalk";
|
||||||
import { afterAll, beforeAll, vi } from "vitest";
|
import { afterAll, beforeAll, vi } from "vitest";
|
||||||
|
|
||||||
/** Set the timezone to UTC for tests. */
|
/** Set the timezone to UTC for tests. */
|
||||||
@ -14,6 +17,20 @@ vi.mock("#app/overrides", async importOriginal => {
|
|||||||
} satisfies typeof import("#app/overrides");
|
} satisfies typeof import("#app/overrides");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//#region Mocking
|
||||||
|
|
||||||
|
/** Mock the override import to always return default values, ignoring any custom overrides. */
|
||||||
|
vi.mock("#app/overrides", async importOriginal => {
|
||||||
|
const { defaultOverrides } = await importOriginal<typeof import("#app/overrides")>();
|
||||||
|
|
||||||
|
return {
|
||||||
|
default: defaultOverrides,
|
||||||
|
// Export `defaultOverrides` as a *copy*.
|
||||||
|
// This ensures we can easily reset `overrides` back to its default values after modifying it.
|
||||||
|
defaultOverrides: { ...defaultOverrides },
|
||||||
|
} satisfies typeof import("#app/overrides");
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a hacky way to mock the i18n backend requests (with the help of {@link https://mswjs.io/ | msw}).
|
* This is a hacky way to mock the i18n backend requests (with the help of {@link https://mswjs.io/ | msw}).
|
||||||
* The reason to put it inside of a mock is to elevate it.
|
* The reason to put it inside of a mock is to elevate it.
|
||||||
@ -30,8 +47,11 @@ vi.mock("i18next", async importOriginal => {
|
|||||||
const filename = req.params[0];
|
const filename = req.params[0];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const json = await import(`../public/locales/en/${req.params[0]}`);
|
const localeFiles = import.meta.glob("../public/locales/en/**/*.json", { eager: true });
|
||||||
console.log("Loaded locale", filename);
|
const json = localeFiles[`../public/locales/en/${filename}`] || {};
|
||||||
|
if (import.meta.env.VITE_I18N_DEBUG === "1") {
|
||||||
|
console.log("Loaded locale", filename);
|
||||||
|
}
|
||||||
return HttpResponse.json(json);
|
return HttpResponse.json(json);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`Failed to load locale ${filename}!`, err);
|
console.log(`Failed to load locale ${filename}!`, err);
|
||||||
@ -48,13 +68,25 @@ vi.mock("i18next", async importOriginal => {
|
|||||||
return await importOriginal();
|
return await importOriginal();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** Ensure that i18n is initialized on all calls. */
|
||||||
|
// TODO: Initialize i18n directly on import instead of initializing it during importing of trainer code
|
||||||
|
vi.mock("#app/plugins/i18n", async importOriginal => {
|
||||||
|
const importedStuff = await importOriginal<typeof import("#app/plugins/i18n")>();
|
||||||
|
const { initI18n } = importedStuff;
|
||||||
|
await initI18n();
|
||||||
|
return importedStuff;
|
||||||
|
});
|
||||||
|
|
||||||
global.testFailed = false;
|
global.testFailed = false;
|
||||||
|
|
||||||
|
initializeGame();
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
initTests();
|
initTests();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
global.server.close();
|
global.server.close();
|
||||||
console.log("Closing i18n MSW server!");
|
MockConsole.printPostTestWarnings();
|
||||||
|
console.log(chalk.hex("#dfb8d8")("Closing i18n MSW server!"));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user