From a598c1cb059facdcca8a5df578264939d3f9ff33 Mon Sep 17 00:00:00 2001 From: ImperialSympathizer Date: Thu, 18 Jul 2024 22:56:01 -0400 Subject: [PATCH] fix unit test breaks --- src/battle-scene.ts | 2 -- src/data/mystery-encounters/utils/encounter-phase-utils.ts | 4 ++-- .../encounters/lost-at-sea-encounter.test.ts | 4 ++-- src/test/utils/mocks/mocksContainer/mockContainer.ts | 4 ++++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 954b24fd10b..af92c41b784 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1038,8 +1038,6 @@ export default class BattleScene extends SceneBase { const playerField = this.getPlayerField(); - this.newArena(Biome.VOLCANO); - if (this.gameMode.isFixedBattle(newWaveIndex) && trainerData === undefined) { battleConfig = this.gameMode.getFixedBattle(newWaveIndex); newDouble = battleConfig.double; diff --git a/src/data/mystery-encounters/utils/encounter-phase-utils.ts b/src/data/mystery-encounters/utils/encounter-phase-utils.ts index ef542971057..d4720ce3e47 100644 --- a/src/data/mystery-encounters/utils/encounter-phase-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-phase-utils.ts @@ -34,7 +34,7 @@ export function doTrainerExclamation(scene: BattleScene) { const exclamationSprite = scene.addFieldSprite(0, 0, "exclaim"); exclamationSprite.setName("exclamation"); scene.field.add(exclamationSprite); - scene.field.moveTo(exclamationSprite, scene.field.list.length - 1); + scene.field.moveTo(exclamationSprite, scene.field.getAll().length - 1); exclamationSprite.setVisible(true); exclamationSprite.setPosition(110, 68); scene.tweens.add({ @@ -475,7 +475,7 @@ export function setEncounterExp(scene: BattleScene, participantId: integer | int const nonFaintedPartyMembers = party.filter(p => p.hp); const expPartyMembers = nonFaintedPartyMembers.filter(p => p.level < scene.getMaxExpLevel()); const partyMemberExp = []; - let expValue = baseExpValue * (useWaveIndex ? scene.currentBattle.waveIndex : 1) / 5 + 1; + let expValue = Math.floor(baseExpValue * (useWaveIndex ? scene.currentBattle.waveIndex : 1) / 5 + 1); if (participantIds?.length > 0) { if (scene.currentBattle.mysteryEncounter.encounterVariant === MysteryEncounterVariant.TRAINER_BATTLE) { diff --git a/src/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts b/src/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts index e8dcc369662..22dde79c50e 100644 --- a/src/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts +++ b/src/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts @@ -122,7 +122,7 @@ describe("Lost at Sea - Mystery Encounter", () => { await runSelectMysteryEncounterOption(game, 2); - expect(blastoise.exp).toBe(expBefore + laprasSpecies.baseExp * defaultWave); + expect(blastoise.exp).toBe(expBefore + Math.floor(laprasSpecies.baseExp * defaultWave / 5 + 1)); }); it("should leave encounter without battle", async () => { @@ -171,7 +171,7 @@ describe("Lost at Sea - Mystery Encounter", () => { await runSelectMysteryEncounterOption(game, 2); - expect(pidgeot.exp).toBe(expBefore + laprasBaseExp * wave); + expect(pidgeot.exp).toBe(expBefore + Math.floor(laprasBaseExp * defaultWave / 5 + 1)); }); it("should leave encounter without battle", async () => { diff --git a/src/test/utils/mocks/mocksContainer/mockContainer.ts b/src/test/utils/mocks/mocksContainer/mockContainer.ts index 4f8a58f7251..ea06c9de326 100644 --- a/src/test/utils/mocks/mocksContainer/mockContainer.ts +++ b/src/test/utils/mocks/mocksContainer/mockContainer.ts @@ -154,6 +154,10 @@ export default class MockContainer { // Sends this Game Object to the back of its parent's display list. } + moveTo(obj) { + // Moves this Game Object to the given index in the list. + } + moveAbove(obj) { // Moves this Game Object to be above the given Game Object in the display list. }