From fe2888be4b28e873c182f9aef55c33918428f88c Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Wed, 17 Jul 2024 15:08:08 -0700 Subject: [PATCH] mystery encounters: resolve review comments: Lost at Sea: -fix typo in handlePokemonGuidingYouPhase function Mysterious Chest: - remove obsolete commented code mystery-encounter.ts - remove unused `onDone` field from MysteryEncounterBuilder --- .../encounters/lost-at-sea-encounter.ts | 13 +++++++------ .../encounters/mysterious-chest-encounter.ts | 13 +++---------- src/data/mystery-encounters/mystery-encounter.ts | 1 - 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/data/mystery-encounters/encounters/lost-at-sea-encounter.ts b/src/data/mystery-encounters/encounters/lost-at-sea-encounter.ts index 49d670a29d5..9e25e003e1b 100644 --- a/src/data/mystery-encounters/encounters/lost-at-sea-encounter.ts +++ b/src/data/mystery-encounters/encounters/lost-at-sea-encounter.ts @@ -1,4 +1,6 @@ +import { getPokemonSpecies } from "#app/data/pokemon-species.js"; import { Moves } from "#app/enums/moves"; +import { Species } from "#app/enums/species.js"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import BattleScene from "../../../battle-scene"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; @@ -62,7 +64,7 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with }, ], }) - .withOptionPhase(async (scene: BattleScene) => handlePokemongGuidingYouPhase(scene)) + .withOptionPhase(async (scene: BattleScene) => handlePokemonGuidingYouPhase(scene)) .build() ) .withOption( @@ -81,7 +83,7 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with }, ], }) - .withOptionPhase(async (scene: BattleScene) => handlePokemongGuidingYouPhase(scene)) + .withOptionPhase(async (scene: BattleScene) => handlePokemonGuidingYouPhase(scene)) .build() ) .withSimpleOption( @@ -122,13 +124,12 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with * @param scene Battle scene * @param guidePokemon pokemon choosen as a guide */ -function handlePokemongGuidingYouPhase(scene: BattleScene) { - /** Base EXP value for guiding pokemon. Currently Lapras base-value */ - const baseExpValue: number = 187; +function handlePokemonGuidingYouPhase(scene: BattleScene) { + const laprasSpecies = getPokemonSpecies(Species.LAPRAS); const { mysteryEncounter } = scene.currentBattle; if (mysteryEncounter.selectedOption) { - setEncounterExp(scene, mysteryEncounter.selectedOption.primaryPokemon.id, baseExpValue, true); + setEncounterExp(scene, mysteryEncounter.selectedOption.primaryPokemon.id, laprasSpecies.baseExp, true); } else { console.warn("Lost at sea: No guide pokemon found but pokemon guides player. huh!?"); } diff --git a/src/data/mystery-encounters/encounters/mysterious-chest-encounter.ts b/src/data/mystery-encounters/encounters/mysterious-chest-encounter.ts index 5842ab407a3..9a0a42af2c8 100644 --- a/src/data/mystery-encounters/encounters/mysterious-chest-encounter.ts +++ b/src/data/mystery-encounters/encounters/mysterious-chest-encounter.ts @@ -114,16 +114,9 @@ export const MysteriousChestEncounter: IMysteryEncounter = scene.currentBattle.mysteryEncounter.setDialogueToken("pokeName", highestLevelPokemon.name); // Show which Pokemon was KOed, then leave encounter with no rewards // Does this synchronously so that game over doesn't happen over result message - await showEncounterText(scene, "mysteryEncounter:mysterious_chest_option_1_bad_result") - .then(() => { - // if (scene.getParty().filter((p) => p.isAllowedInBattle()).length === 0) { - // // All pokemon fainted, game over - // scene.clearPhaseQueue(); - // scene.unshiftPhase(new GameOverPhase(scene)); - // } else { - leaveEncounterWithoutBattle(scene); - // } - }); + await showEncounterText(scene, "mysteryEncounter:mysterious_chest_option_1_bad_result").then(() => { + leaveEncounterWithoutBattle(scene); + }); } }) .build() diff --git a/src/data/mystery-encounters/mystery-encounter.ts b/src/data/mystery-encounters/mystery-encounter.ts index 983be1fdb2a..c6fc8c1ca66 100644 --- a/src/data/mystery-encounters/mystery-encounter.ts +++ b/src/data/mystery-encounters/mystery-encounter.ts @@ -363,7 +363,6 @@ export class MysteryEncounterBuilder implements Partial { doEncounterExp?: (scene: BattleScene) => boolean; doEncounterRewards?: (scene: BattleScene) => boolean; onInit?: (scene: BattleScene) => boolean; - onDone?: (scene: BattleScene) => boolean; hideBattleIntroMessage?: boolean; hideIntroVisuals?: boolean; enemyPartyConfigs?: EnemyPartyConfig[] = [];