myst. chest enc.: remove manual game-over check

This commit is contained in:
Felix Staud 2024-07-17 10:11:34 -07:00
parent a862dabcd1
commit 78cbc22693

View File

@ -1,10 +1,10 @@
import { queueEncounterMessage, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
import { import {
leaveEncounterWithoutBattle, leaveEncounterWithoutBattle,
setEncounterRewards setEncounterRewards
} from "#app/data/mystery-encounters/utils/encounter-phase-utils"; } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import { getHighestLevelPlayerPokemon, koPlayerPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import { ModifierTier } from "#app/modifier/modifier-tier"; import { ModifierTier } from "#app/modifier/modifier-tier";
import { GameOverPhase } from "#app/phases";
import { randSeedInt } from "#app/utils";
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import BattleScene from "../../../battle-scene"; import BattleScene from "../../../battle-scene";
import IMysteryEncounter, { import IMysteryEncounter, {
@ -12,8 +12,6 @@ import IMysteryEncounter, {
MysteryEncounterTier, MysteryEncounterTier,
} from "../mystery-encounter"; } from "../mystery-encounter";
import { EncounterOptionMode, MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { EncounterOptionMode, MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import { queueEncounterMessage, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
import { getHighestLevelPlayerPokemon, koPlayerPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
export const MysteriousChestEncounter: IMysteryEncounter = export const MysteriousChestEncounter: IMysteryEncounter =
MysteryEncounterBuilder.withEncounterType( MysteryEncounterBuilder.withEncounterType(
@ -62,7 +60,8 @@ export const MysteriousChestEncounter: IMysteryEncounter =
}) })
.withOptionPhase(async (scene: BattleScene) => { .withOptionPhase(async (scene: BattleScene) => {
// Open the chest // Open the chest
const roll = randSeedInt(100); // const roll = randSeedInt(100);
const roll = 0;
if (roll > 60) { if (roll > 60) {
// Choose between 2 COMMON / 2 GREAT tier items (40%) // Choose between 2 COMMON / 2 GREAT tier items (40%)
setEncounterRewards(scene, { setEncounterRewards(scene, {
@ -117,13 +116,13 @@ export const MysteriousChestEncounter: IMysteryEncounter =
// Does this synchronously so that game over doesn't happen over result message // Does this synchronously so that game over doesn't happen over result message
await showEncounterText(scene, "mysteryEncounter:mysterious_chest_option_1_bad_result") await showEncounterText(scene, "mysteryEncounter:mysterious_chest_option_1_bad_result")
.then(() => { .then(() => {
if (scene.getParty().filter((p) => p.isAllowedInBattle()).length === 0) { // if (scene.getParty().filter((p) => p.isAllowedInBattle()).length === 0) {
// All pokemon fainted, game over // // All pokemon fainted, game over
scene.clearPhaseQueue(); // scene.clearPhaseQueue();
scene.unshiftPhase(new GameOverPhase(scene)); // scene.unshiftPhase(new GameOverPhase(scene));
} else { // } else {
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
} // }
}); });
} }
}) })