diff --git a/src/data/mystery-encounters/mystery-encounter-dialogue.ts b/src/data/mystery-encounters/mystery-encounter-dialogue.ts index 9e4943f37a2..d96aeb87ba6 100644 --- a/src/data/mystery-encounters/mystery-encounter-dialogue.ts +++ b/src/data/mystery-encounters/mystery-encounter-dialogue.ts @@ -71,8 +71,3 @@ export default class MysteryEncounterDialogue { } * */ - -export const allMysteryEncounterDialogue: { [encounterType: number]: MysteryEncounterDialogue } = {}; - -export function initMysteryEncounterDialogue() { -} diff --git a/src/data/mystery-encounters/mystery-encounter.ts b/src/data/mystery-encounters/mystery-encounter.ts index 0780aa33ae4..c367f2377b2 100644 --- a/src/data/mystery-encounters/mystery-encounter.ts +++ b/src/data/mystery-encounters/mystery-encounter.ts @@ -7,7 +7,6 @@ import MysteryEncounterIntroVisuals, { MysteryEncounterSpriteConfig } from "../. import * as Utils from "../../utils"; import { StatusEffect } from "../status-effect"; import MysteryEncounterDialogue, { - allMysteryEncounterDialogue, OptionTextDisplay } from "./mystery-encounter-dialogue"; import MysteryEncounterOption, { MysteryEncounterOptionBuilder, OptionPhaseCallback } from "./mystery-encounter-option"; @@ -137,17 +136,12 @@ export default class MysteryEncounter implements MysteryEncounter { Object.assign(this, encounter); } this.encounterTier = this.encounterTier ? this.encounterTier : MysteryEncounterTier.COMMON; - this.dialogue = Object.assign((this.dialogue ?? {}), allMysteryEncounterDialogue[this.encounterType] ?? {}); + this.dialogue = {}; this.encounterVariant = MysteryEncounterVariant.DEFAULT; this.requirements = this.requirements ? this.requirements : []; this.hideBattleIntroMessage = !isNullOrUndefined(this.hideBattleIntroMessage) ? this.hideBattleIntroMessage : false; this.hideIntroVisuals = !isNullOrUndefined(this.hideIntroVisuals) ? this.hideIntroVisuals : true; - // Populate options with respective dialogue - if (this.dialogue?.encounterOptionsDialogue) { - // this.options.forEach((o, i) => o.dialogue = this.dialogue.encounterOptionsDialogue.options[i]); - } - // Reset any dirty flags or encounter data this.lockEncounterRewardTiers = true; this.dialogueTokens = new Map; @@ -482,15 +476,37 @@ export class MysteryEncounterBuilder implements Partial { return this.withSceneRequirement(new PartySizeRequirement([min, max ?? min])); } + /** + * Add a primary pokemon requirement + * + * @param requirement {@linkcode EncounterPokemonRequirement} + * @returns + */ withPrimaryPokemonRequirement(requirement: EncounterPokemonRequirement): this & Required> { this.primaryPokemonRequirements.push(requirement); return Object.assign(this, { primaryPokemonRequirements: this.primaryPokemonRequirements }); } + /** + * Add a primary pokemon status effect requirement + * + * @param statusEffect the status effect/s to check + * @param minNumberOfPokemon minimum number of pokemon to have the effect + * @param invertQuery if true will invert the query + * @returns + */ withPrimaryPokemonStatusEffectRequirement(statusEffect: StatusEffect | StatusEffect[], minNumberOfPokemon: number = 1, invertQuery: boolean = false): this & Required> { return this.withPrimaryPokemonRequirement(new StatusEffectRequirement(statusEffect, minNumberOfPokemon, invertQuery)); } + /** + * Add a primary pokemon health ratio requirement + * + * @param requiredHealthRange the health range to check + * @param minNumberOfPokemon minimum number of pokemon to have the health range + * @param invertQuery if true will invert the query + * @returns + */ withPrimaryPokemonHealthRatioRequirement(requiredHealthRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false): this & Required> { return this.withPrimaryPokemonRequirement(new HealthRatioRequirement(requiredHealthRange, minNumberOfPokemon, invertQuery)); } @@ -579,12 +595,17 @@ export class MysteryEncounterBuilder implements Partial { return Object.assign(this, { hideIntroVisuals: hideIntroVisuals }); } + /** + * Add a title for the encounter + * + * @param title - title of the encounter + * @returns + */ withTitle(title: TemplateStringsArray | `mysteryEncounter:${string}`) { - const dialogue = this.dialogue ?? {}; - const encounterOptionsDialogue = this.dialogue?.encounterOptionsDialogue ?? {}; + const encounterOptionsDialogue = this.dialogue.encounterOptionsDialogue ?? {}; this.dialogue = { - ...dialogue, + ...this.dialogue, encounterOptionsDialogue: { ...encounterOptionsDialogue, title, @@ -594,12 +615,17 @@ export class MysteryEncounterBuilder implements Partial { return this; } + /** + * Add a description of the encounter + * + * @param description - description of the encounter + * @returns + */ withDescription(description: TemplateStringsArray | `mysteryEncounter:${string}`) { - const dialogue = this.dialogue ?? {}; - const encounterOptionsDialogue = this.dialogue?.encounterOptionsDialogue ?? {}; + const encounterOptionsDialogue = this.dialogue.encounterOptionsDialogue ?? {}; this.dialogue = { - ...dialogue, + ...this.dialogue, encounterOptionsDialogue: { ...encounterOptionsDialogue, description, @@ -609,12 +635,17 @@ export class MysteryEncounterBuilder implements Partial { return this; } + /** + * Add a query for the encounter + * + * @param query - query to use for the encounter + * @returns + */ withQuery(query: TemplateStringsArray | `mysteryEncounter:${string}`) { - const dialogue = this.dialogue ?? {}; - const encounterOptionsDialogue = this.dialogue?.encounterOptionsDialogue ?? {}; + const encounterOptionsDialogue = this.dialogue.encounterOptionsDialogue ?? {}; this.dialogue = { - ...dialogue, + ...this.dialogue, encounterOptionsDialogue: { ...encounterOptionsDialogue, query, @@ -624,11 +655,23 @@ export class MysteryEncounterBuilder implements Partial { return this; } + /** + * Add outro dialogue/s for the encounter + * + * @param dialogue - outro dialogue/s + * @returns + */ withOutroDialogue(dialogue: MysteryEncounterDialogue["outro"] = []) { this.dialogue = {...this.dialogue, outro: dialogue }; return this; } + /** + * Builds the mystery encounter + * + * @param this - MysteryEncounter + * @returns + */ build(this: MysteryEncounter) { return new MysteryEncounter(this); } diff --git a/src/loading-scene.ts b/src/loading-scene.ts index 096986ebcc8..1ce8ed87156 100644 --- a/src/loading-scene.ts +++ b/src/loading-scene.ts @@ -22,7 +22,6 @@ import { initStatsKeys } from "./ui/game-stats-ui-handler"; import { initVouchers } from "./system/voucher"; import { Biome } from "#enums/biome"; import { TrainerType } from "#enums/trainer-type"; -import {initMysteryEncounterDialogue} from "#app/data/mystery-encounters/mystery-encounter-dialogue"; import {initMysteryEncounters} from "#app/data/mystery-encounters/mystery-encounters"; export class LoadingScene extends SceneBase { @@ -346,7 +345,6 @@ export class LoadingScene extends SceneBase { initMoves(); initAbilities(); initChallenges(); - initMysteryEncounterDialogue(); initMysteryEncounters(); } diff --git a/src/overrides.ts b/src/overrides.ts index c2a6edf9868..1e428c6dd2d 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -117,9 +117,9 @@ export const EGG_GACHA_PULL_COUNT_OVERRIDE: number = 0; */ // 1 to 256, set to null to ignore -export const MYSTERY_ENCOUNTER_RATE_OVERRIDE: number = 10000; +export const MYSTERY_ENCOUNTER_RATE_OVERRIDE: number = null; export const MYSTERY_ENCOUNTER_TIER_OVERRIDE: MysteryEncounterTier = null; -export const MYSTERY_ENCOUNTER_OVERRIDE: MysteryEncounterType = MysteryEncounterType.DARK_DEAL; +export const MYSTERY_ENCOUNTER_OVERRIDE: MysteryEncounterType = null; /** * MODIFIER / ITEM OVERRIDES diff --git a/src/test/vitest.setup.ts b/src/test/vitest.setup.ts index b8b655e3e96..37c533a33db 100644 --- a/src/test/vitest.setup.ts +++ b/src/test/vitest.setup.ts @@ -13,7 +13,6 @@ import { initVouchers } from "#app/system/voucher"; import { initAchievements } from "#app/system/achv"; import { initStatsKeys } from "#app/ui/game-stats-ui-handler"; import { initMysteryEncounters } from "#app/data/mystery-encounters/mystery-encounters"; -import { initMysteryEncounterDialogue } from "#app/data/mystery-encounters/mystery-encounter-dialogue"; import { beforeAll, beforeEach, vi } from "vitest"; import * as overrides from "#app/overrides"; @@ -28,7 +27,6 @@ initSpecies(); initMoves(); initAbilities(); initLoggedInUser(); -initMysteryEncounterDialogue(); initMysteryEncounters(); global.testFailed = false;