mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-09 00:49:27 +02:00
More partial test fixes
This commit is contained in:
parent
ee2412cafb
commit
6fc7db8939
@ -35,7 +35,7 @@ import { Stat } from "#enums/stat";
|
|||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
import { MoveUseMode } from "#enums/move-use-mode";
|
import { MoveUseMode } from "#enums/move-use-mode";
|
||||||
import type { PokemonItemMap } from "#app/items/held-item-data-types";
|
import type { PokemonItemMap } from "#app/items/held-item-data-types";
|
||||||
import { HeldItemCategoryId } from "#enums/held-item-id";
|
import { HeldItemCategoryId, type HeldItemId } from "#enums/held-item-id";
|
||||||
|
|
||||||
/** the i18n namespace for the encounter */
|
/** the i18n namespace for the encounter */
|
||||||
const namespace = "mysteryEncounters/uncommonBreed";
|
const namespace = "mysteryEncounters/uncommonBreed";
|
||||||
@ -213,7 +213,7 @@ export const UncommonBreedEncounter: MysteryEncounter = MysteryEncounterBuilder.
|
|||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
const index = randSeedInt(berryMap.length);
|
const index = randSeedInt(berryMap.length);
|
||||||
const randBerry = berryMap[index];
|
const randBerry = berryMap[index];
|
||||||
globalScene.getPokemonById(randBerry.pokemonId)?.heldItemManager.remove(randBerry.item.id);
|
globalScene.getPokemonById(randBerry.pokemonId)?.heldItemManager.remove(randBerry.item.id as HeldItemId);
|
||||||
stolenBerryMap.push(randBerry);
|
stolenBerryMap.push(randBerry);
|
||||||
berryMap.splice(index, 1);
|
berryMap.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
@ -3,20 +3,13 @@ import * as BattleAnims from "#app/data/battle-anims";
|
|||||||
import { TrashToTreasureEncounter } from "#app/data/mystery-encounters/encounters/trash-to-treasure-encounter";
|
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 * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import {
|
import type { EnemyPartyConfig, EnemyPokemonConfig } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
type EnemyPartyConfig,
|
|
||||||
type EnemyPokemonConfig,
|
|
||||||
generateModifierType,
|
|
||||||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
|
||||||
import { getPokemonSpecies } from "#app/utils/pokemon-utils";
|
import { getPokemonSpecies } from "#app/utils/pokemon-utils";
|
||||||
import { BiomeId } from "#enums/biome-id";
|
import { BiomeId } from "#enums/biome-id";
|
||||||
import { MysteryEncounterType } from "#app/enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#app/enums/mystery-encounter-type";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { PokemonMove } from "#app/data/moves/pokemon-move";
|
import { PokemonMove } from "#app/data/moves/pokemon-move";
|
||||||
import { HealShopCostModifier, HitHealModifier, TurnHealModifier } from "#app/modifier/modifier";
|
|
||||||
import { RewardTier } from "#enums/reward-tier";
|
import { RewardTier } from "#enums/reward-tier";
|
||||||
import type { PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
|
||||||
import { modifierTypes } from "#app/data/data-lists";
|
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||||
@ -33,6 +26,9 @@ import {
|
|||||||
import GameManager from "#test/testUtils/gameManager";
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
import { HeldItemCategoryId, HeldItemId } from "#enums/held-item-id";
|
||||||
|
import { randSeedInt } from "#app/utils/common";
|
||||||
|
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/trashToTreasure";
|
const namespace = "mysteryEncounters/trashToTreasure";
|
||||||
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
||||||
@ -101,41 +97,13 @@ describe("Trash to Treasure - Mystery Encounter", () => {
|
|||||||
formIndex: 1, // Gmax
|
formIndex: 1, // Gmax
|
||||||
bossSegmentModifier: 1, // +1 Segment from normal
|
bossSegmentModifier: 1, // +1 Segment from normal
|
||||||
moveSet: [MoveId.GUNK_SHOT, MoveId.STOMPING_TANTRUM, MoveId.HAMMER_ARM, MoveId.PAYBACK],
|
moveSet: [MoveId.GUNK_SHOT, MoveId.STOMPING_TANTRUM, MoveId.HAMMER_ARM, MoveId.PAYBACK],
|
||||||
modifierConfigs: [
|
heldItemConfig: [
|
||||||
{
|
{ entry: HeldItemCategoryId.BERRY, count: 4 },
|
||||||
modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType,
|
{ entry: HeldItemCategoryId.BASE_STAT_BOOST, count: 2 },
|
||||||
},
|
{ entry: HeldItemId.TOXIC_ORB, count: randSeedInt(2, 0) },
|
||||||
{
|
{ entry: HeldItemId.SOOTHE_BELL, count: randSeedInt(2, 1) },
|
||||||
modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType,
|
{ entry: HeldItemId.LUCKY_EGG, count: randSeedInt(3, 1) },
|
||||||
},
|
{ entry: HeldItemId.GOLDEN_EGG, count: randSeedInt(2, 0) },
|
||||||
{
|
|
||||||
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 = {
|
const config: EnemyPartyConfig = {
|
||||||
@ -175,17 +143,11 @@ describe("Trash to Treasure - Mystery Encounter", () => {
|
|||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
||||||
|
|
||||||
const leftovers = scene.findModifier(m => m instanceof TurnHealModifier) as TurnHealModifier;
|
expect(scene.getPlayerParty()[0].heldItemManager.getStack(HeldItemId.LEFTOVERS)).toBe(2);
|
||||||
expect(leftovers).toBeDefined();
|
|
||||||
expect(leftovers?.stackCount).toBe(2);
|
|
||||||
|
|
||||||
const shellBell = scene.findModifier(m => m instanceof HitHealModifier) as HitHealModifier;
|
expect(scene.getPlayerParty()[0].heldItemManager.getStack(HeldItemId.SHELL_BELL)).toBe(1);
|
||||||
expect(shellBell).toBeDefined();
|
|
||||||
expect(shellBell?.stackCount).toBe(1);
|
|
||||||
|
|
||||||
const blackSludge = scene.findModifier(m => m instanceof HealShopCostModifier) as HealShopCostModifier;
|
expect(scene.trainerItems.getStack(TrainerItemId.BLACK_SLUDGE)).toBe(1);
|
||||||
expect(blackSludge).toBeDefined();
|
|
||||||
expect(blackSludge?.stackCount).toBe(1);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should leave encounter without battle", async () => {
|
it("should leave encounter without battle", async () => {
|
||||||
|
@ -15,19 +15,16 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
|
|||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
||||||
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import { generateModifierType } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
|
||||||
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { UncommonBreedEncounter } from "#app/data/mystery-encounters/encounters/uncommon-breed-encounter";
|
import { UncommonBreedEncounter } from "#app/data/mystery-encounters/encounters/uncommon-breed-encounter";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { speciesEggMoves } from "#app/data/balance/egg-moves";
|
import { speciesEggMoves } from "#app/data/balance/egg-moves";
|
||||||
import { getPokemonSpecies } from "#app/utils/pokemon-utils";
|
import { getPokemonSpecies } from "#app/utils/pokemon-utils";
|
||||||
import { BerryType } from "#enums/berry-type";
|
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import type { BerryModifier } from "#app/modifier/modifier";
|
|
||||||
import { modifierTypes } from "#app/data/data-lists";
|
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/uncommonBreed";
|
const namespace = "mysteryEncounters/uncommonBreed";
|
||||||
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
||||||
@ -184,11 +181,6 @@ describe("Uncommon Breed - Mystery Encounter", () => {
|
|||||||
// TODO: there is some severe test flakiness occurring for this file, needs to be looked at/addressed in separate issue
|
// TODO: there is some severe test flakiness occurring for this file, needs to be looked at/addressed in separate issue
|
||||||
it.skip("should NOT be selectable if the player doesn't have enough berries", async () => {
|
it.skip("should NOT be selectable if the player doesn't have enough berries", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.UNCOMMON_BREED, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.UNCOMMON_BREED, defaultParty);
|
||||||
// Clear out any pesky mods that slipped through test spin-up
|
|
||||||
scene.modifiers.forEach(mod => {
|
|
||||||
scene.removeModifier(mod);
|
|
||||||
});
|
|
||||||
await scene.updateItems(true);
|
|
||||||
await game.phaseInterceptor.to(MysteryEncounterPhase, false);
|
await game.phaseInterceptor.to(MysteryEncounterPhase, false);
|
||||||
|
|
||||||
const encounterPhase = scene.phaseManager.getCurrentPhase();
|
const encounterPhase = scene.phaseManager.getCurrentPhase();
|
||||||
@ -213,15 +205,9 @@ describe("Uncommon Breed - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.UNCOMMON_BREED, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.UNCOMMON_BREED, defaultParty);
|
||||||
|
|
||||||
// Berries on party lead
|
// Berries on party lead
|
||||||
const sitrus = generateModifierType(modifierTypes.BERRY, [BerryType.SITRUS])!;
|
scene.getPlayerParty()[0].heldItemManager.add(HeldItemId.SITRUS_BERRY, 2);
|
||||||
const sitrusMod = sitrus.newModifier(scene.getPlayerParty()[0]) as BerryModifier;
|
scene.getPlayerParty()[0].heldItemManager.add(HeldItemId.GANLON_BERRY, 3);
|
||||||
sitrusMod.stackCount = 2;
|
scene.updateItems(true);
|
||||||
scene.addModifier(sitrusMod, true, false, false, true);
|
|
||||||
const ganlon = generateModifierType(modifierTypes.BERRY, [BerryType.GANLON])!;
|
|
||||||
const ganlonMod = ganlon.newModifier(scene.getPlayerParty()[0]) as BerryModifier;
|
|
||||||
ganlonMod.stackCount = 3;
|
|
||||||
scene.addModifier(ganlonMod, true, false, false, true);
|
|
||||||
await scene.updateItems(true);
|
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import GameManager from "#test/testUtils/gameManager";
|
|||||||
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
||||||
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, vi } from "vitest";
|
||||||
|
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||||
|
|
||||||
describe("SelectModifierPhase", () => {
|
describe("SelectModifierPhase", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -110,7 +111,7 @@ describe("SelectModifierPhase", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it.todo("should generate random modifiers of same tier for reroll with reroll lock", async () => {
|
it.todo("should generate random modifiers of same tier for reroll with reroll lock", async () => {
|
||||||
game.override.startingModifier([{ name: "LOCK_CAPSULE" }]);
|
game.override.startingTrainerItems([{ entry: TrainerItemId.LOCK_CAPSULE }]);
|
||||||
await game.classicMode.startBattle([SpeciesId.ABRA, SpeciesId.VOLCARONA]);
|
await game.classicMode.startBattle([SpeciesId.ABRA, SpeciesId.VOLCARONA]);
|
||||||
scene.money = 1000000;
|
scene.money = 1000000;
|
||||||
// Just use fully random seed for this test
|
// Just use fully random seed for this test
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { BerryType } from "#app/enums/berry-type";
|
|
||||||
import { Button } from "#app/enums/buttons";
|
import { Button } from "#app/enums/buttons";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
@ -9,6 +8,7 @@ import GameManager from "#test/testUtils/gameManager";
|
|||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
|
|
||||||
describe("UI - Transfer Items", () => {
|
describe("UI - Transfer Items", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -31,9 +31,9 @@ describe("UI - Transfer Items", () => {
|
|||||||
.startingLevel(100)
|
.startingLevel(100)
|
||||||
.startingWave(1)
|
.startingWave(1)
|
||||||
.startingHeldItems([
|
.startingHeldItems([
|
||||||
{ name: "BERRY", count: 1, type: BerryType.SITRUS },
|
{ entry: HeldItemId.SITRUS_BERRY, count: 1 },
|
||||||
{ name: "BERRY", count: 2, type: BerryType.APICOT },
|
{ entry: HeldItemId.APICOT_BERRY, count: 2 },
|
||||||
{ name: "BERRY", count: 2, type: BerryType.LUM },
|
{ entry: HeldItemId.LUM_BERRY, count: 2 },
|
||||||
])
|
])
|
||||||
.moveset([MoveId.DRAGON_CLAW])
|
.moveset([MoveId.DRAGON_CLAW])
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
.enemySpecies(SpeciesId.MAGIKARP)
|
||||||
|
Loading…
Reference in New Issue
Block a user