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
This commit is contained in:
Felix Staud 2024-07-17 15:08:08 -07:00
parent fd80036dac
commit fe2888be4b
3 changed files with 10 additions and 17 deletions

View File

@ -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!?");
}

View File

@ -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()

View File

@ -363,7 +363,6 @@ export class MysteryEncounterBuilder implements Partial<IMysteryEncounter> {
doEncounterExp?: (scene: BattleScene) => boolean;
doEncounterRewards?: (scene: BattleScene) => boolean;
onInit?: (scene: BattleScene) => boolean;
onDone?: (scene: BattleScene) => boolean;
hideBattleIntroMessage?: boolean;
hideIntroVisuals?: boolean;
enemyPartyConfigs?: EnemyPartyConfig[] = [];