mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-07 17:02:16 +02:00
Fix trash-to-treasure-encounter.test.ts
This commit is contained in:
parent
51e0ff36dc
commit
2c06e5481e
@ -1,30 +1,37 @@
|
|||||||
|
import type BattleScene from "#app/battle-scene";
|
||||||
|
import * as BattleAnims from "#app/data/battle-anims";
|
||||||
|
import { TrashToTreasureEncounter } from "#app/data/mystery-encounters/encounters/trash-to-treasure-encounter";
|
||||||
import * as MysteryEncounters from "#app/data/mystery-encounters/mystery-encounters";
|
import * as MysteryEncounters from "#app/data/mystery-encounters/mystery-encounters";
|
||||||
|
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
|
import {
|
||||||
|
type EnemyPartyConfig,
|
||||||
|
type EnemyPokemonConfig,
|
||||||
|
generateModifierType,
|
||||||
|
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
|
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||||
import { Biome } from "#app/enums/biome";
|
import { Biome } from "#app/enums/biome";
|
||||||
import { MysteryEncounterType } from "#app/enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#app/enums/mystery-encounter-type";
|
||||||
import { Species } from "#app/enums/species";
|
import { Species } from "#app/enums/species";
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
import { PokemonMove } from "#app/field/pokemon";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { HealShopCostModifier, HitHealModifier, TurnHealModifier } from "#app/modifier/modifier";
|
||||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||||
import * as BattleAnims from "#app/data/battle-anims";
|
import { modifierTypes, type PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||||
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
|
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||||
|
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
||||||
|
import { Mode } from "#app/ui/ui";
|
||||||
|
import * as Utils from "#app/utils";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import {
|
import {
|
||||||
runMysteryEncounterToEnd,
|
runMysteryEncounterToEnd,
|
||||||
skipBattleRunMysteryEncounterRewardsPhase,
|
skipBattleRunMysteryEncounterRewardsPhase,
|
||||||
} from "#test/mystery-encounter/encounter-test-utils";
|
} from "#test/mystery-encounter/encounter-test-utils";
|
||||||
import { Moves } from "#enums/moves";
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
import type BattleScene from "#app/battle-scene";
|
|
||||||
import { PokemonMove } from "#app/field/pokemon";
|
|
||||||
import { Mode } from "#app/ui/ui";
|
|
||||||
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
|
||||||
import { HitHealModifier, HealShopCostModifier, TurnHealModifier } from "#app/modifier/modifier";
|
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
|
||||||
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
||||||
import { TrashToTreasureEncounter } from "#app/data/mystery-encounters/encounters/trash-to-treasure-encounter";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/trashToTreasure";
|
const namespace = "mysteryEncounters/trashToTreasure";
|
||||||
const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA];
|
const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA];
|
||||||
@ -73,6 +80,7 @@ describe("Trash to Treasure - Mystery Encounter", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should initialize fully", async () => {
|
it("should initialize fully", async () => {
|
||||||
|
vi.spyOn(Utils, "randSeedInt").mockImplementation((range, min = 0) => min + range - 1);
|
||||||
initSceneWithoutEncounterPhase(scene, defaultParty);
|
initSceneWithoutEncounterPhase(scene, defaultParty);
|
||||||
scene.currentBattle.mysteryEncounter = TrashToTreasureEncounter;
|
scene.currentBattle.mysteryEncounter = TrashToTreasureEncounter;
|
||||||
const moveInitSpy = vi.spyOn(BattleAnims, "initMoveAnim");
|
const moveInitSpy = vi.spyOn(BattleAnims, "initMoveAnim");
|
||||||
@ -85,22 +93,61 @@ describe("Trash to Treasure - Mystery Encounter", () => {
|
|||||||
TrashToTreasureEncounter.populateDialogueTokensFromRequirements();
|
TrashToTreasureEncounter.populateDialogueTokensFromRequirements();
|
||||||
const onInitResult = onInit!();
|
const onInitResult = onInit!();
|
||||||
|
|
||||||
expect(TrashToTreasureEncounter.enemyPartyConfigs).toEqual([
|
const bossSpecies = getPokemonSpecies(Species.GARBODOR);
|
||||||
{
|
const pokemonConfig: EnemyPokemonConfig = {
|
||||||
levelAdditiveModifier: 0.5,
|
species: bossSpecies,
|
||||||
disableSwitch: true,
|
isBoss: true,
|
||||||
pokemonConfigs: [
|
shiny: false, // Shiny lock because of custom intro sprite
|
||||||
{
|
formIndex: 1, // Gmax
|
||||||
species: getPokemonSpecies(Species.GARBODOR),
|
bossSegmentModifier: 1, // +1 Segment from normal
|
||||||
isBoss: true,
|
moveSet: [Moves.GUNK_SHOT, Moves.STOMPING_TANTRUM, Moves.HAMMER_ARM, Moves.PAYBACK],
|
||||||
shiny: false,
|
modifierConfigs: [
|
||||||
formIndex: 1,
|
{
|
||||||
bossSegmentModifier: 1,
|
modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType,
|
||||||
moveSet: [Moves.GUNK_SHOT, Moves.STOMPING_TANTRUM, Moves.HAMMER_ARM, Moves.PAYBACK],
|
},
|
||||||
},
|
{
|
||||||
],
|
modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType,
|
||||||
},
|
},
|
||||||
]);
|
{
|
||||||
|
modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
modifier: generateModifierType(modifierTypes.BASE_STAT_BOOSTER) as PokemonHeldItemModifierType,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
modifier: generateModifierType(modifierTypes.BASE_STAT_BOOSTER) as PokemonHeldItemModifierType,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
modifier: generateModifierType(modifierTypes.TOXIC_ORB) as PokemonHeldItemModifierType,
|
||||||
|
stackCount: Utils.randSeedInt(2, 0),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
modifier: generateModifierType(modifierTypes.SOOTHE_BELL) as PokemonHeldItemModifierType,
|
||||||
|
stackCount: Utils.randSeedInt(2, 1),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
modifier: generateModifierType(modifierTypes.LUCKY_EGG) as PokemonHeldItemModifierType,
|
||||||
|
stackCount: Utils.randSeedInt(3, 1),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
modifier: generateModifierType(modifierTypes.GOLDEN_EGG) as PokemonHeldItemModifierType,
|
||||||
|
stackCount: Utils.randSeedInt(2, 0),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const config: EnemyPartyConfig = {
|
||||||
|
levelAdditiveModifier: 0.5,
|
||||||
|
pokemonConfigs: [pokemonConfig],
|
||||||
|
disableSwitch: true,
|
||||||
|
};
|
||||||
|
const enemyPartyConfigs = [config];
|
||||||
|
|
||||||
|
expect(JSON.stringify(TrashToTreasureEncounter.enemyPartyConfigs, undefined, 2)).toEqual(
|
||||||
|
JSON.stringify(enemyPartyConfigs, undefined, 2),
|
||||||
|
);
|
||||||
await vi.waitFor(() => expect(moveInitSpy).toHaveBeenCalled());
|
await vi.waitFor(() => expect(moveInitSpy).toHaveBeenCalled());
|
||||||
await vi.waitFor(() => expect(moveLoadSpy).toHaveBeenCalled());
|
await vi.waitFor(() => expect(moveLoadSpy).toHaveBeenCalled());
|
||||||
expect(onInitResult).toBe(true);
|
expect(onInitResult).toBe(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user