pokemon-rogue-battle

    MysteryEncounter class that defines the logic for a single encounter These objects will be saved as part of session data any time the player is on a floor with an encounter Unless you know what you're doing, you should use MysteryEncounterBuilder to create an instance for this class

    Implements

    Index

    Constructors

    Properties

    autoHideIntroVisuals: boolean

    If true, when an option is selected the field visuals will fade out automatically Default false

    catchAllowed: boolean

    If true, allows catching a wild pokemon during the encounter Default false

    continuousEncounter: boolean

    If true, encounter will continuously run through multiple battles/puzzles/etc. instead of going to next wave MUST EVENTUALLY BE DISABLED TO CONTINUE TO NEXT WAVE Default false

    dialogue: default

    Dialogue object containing all the dialogue, messages, tooltips, etc. for an encounter

    dialogueTokens: Record<string, string>

    Can be set for uses programatic dialogue during an encounter (storing the name of one of the party's pokemon, etc.) Example use: see MYSTERIOUS_CHEST

    disallowedChallenges?: Challenges[]

    If specified, defines any challenges (from Challenge game mode) where the MysteryEncounter should NOT spawn

    disallowedGameModes?: GameModes[]

    If specified, defines any game modes where the MysteryEncounter should NOT spawn

    doContinueEncounter?: () => Promise<void>

    Will execute callback during VictoryPhase of a continuousEncounter

    doEncounterExp?: () => boolean

    Will provide the player party EXP before rewards are displayed for that wave

    doEncounterRewards?: () => boolean

    Will provide the player a rewards shop for that wave

    encounterAnimations?: EncounterAnim[]

    Custom battle animations that are configured for encounter effects and visuals Specify here so that assets are loaded on initialization of encounter

    encounterMode: MysteryEncounterMode

    Should be set depending upon option selected as part of an encounter For example, if there is no battle as part of the encounter/selected option, should be set to NO_BATTLE Defaults to DEFAULT

    encounterTier: MysteryEncounterTier
    encounterType: MysteryEncounterType
    enemyPartyConfigs: EnemyPartyConfig[]

    Data used for setting up/initializing enemy party in battles Can store multiple configs so that one can be chosen based on option selected Should usually be defined in onInit() or onPreOptionPhase()

    enterIntroVisualsFromRight: boolean

    Intro visuals on the field will slide in from the right instead of the left Default false

    excludePrimaryFromSupportRequirements: boolean
    expMultiplier: number

    Can be set higher or lower based on the type of battle or exp gained for an option/encounter Defaults to 1

    fleeAllowed: boolean

    If true, allows fleeing from a wild encounter (trainer battle MEs auto-disable fleeing) Default true

    hasBattleAnimationsWithoutTargets: boolean

    If true, encounter will not animate the target Pokemon as part of battle animations Used for encounters where it is not a "real" battle, but still uses battle animations and commands (see FunAndGamesEncounter for an example)

    hideBattleIntroMessage: boolean

    If true, hides "A Wild X Appeared" etc. messages Default true

    introVisuals?: default

    Object instance containing sprite data for an encounter when it is being spawned Otherwise, will be undefined You probably shouldn't do anything directly with this unless you have a very specific need

    loadAssets: Promise<void>[]

    Can add any asset load promises here during onInit() to make sure the scene awaits the loads properly

    localizationKey: string
    lockEncounterRewardTiers: boolean

    Flag for checking if it's the first time a shop is being shown for an encounter. Defaults to true so that the first shop does not override the specified rewards. Will be set to false after a shop is shown (so can't reroll same rarity items for free)

    maxAllowedEncounters: number

    Maximum number of times the encounter can be seen per run Rogue tier encounters default to 1, others default to 3

    misc?: any

    Generic property to set any custom data required for the encounter Extremely useful for carrying state/data between onPreOptionPhase/onOptionPhase/onPostOptionPhase

    onGameOver?: () => boolean

    Can perform special logic when a ME battle is lost, before GameOver/battle retry prompt. Should return true if it is treated as "real" Game Over, false if not.

    onInit?: () => boolean

    Event when Encounter is first loaded, use it for data conditioning

    onRewards?: () => Promise<void>

    Event prior to any rewards logic in MysteryEncounterRewardsPhase

    onTurnStart?: () => boolean

    Event triggered prior to CommandPhase, during TurnInitPhase

    onVisualsStart?: () => boolean

    Event when battlefield visuals have finished sliding in and the encounter dialogue begins

    options: [default, default, ...default[]]
    preventGameStatsUpdates: boolean

    If true, will prevent updating GameStats for encountering and/or defeating Pokemon

    primaryPokemon?: PlayerPokemon
    primaryPokemonRequirements: EncounterPokemonRequirement[]

    Primary Pokemon is a single pokemon randomly selected from the party that meet ALL primary pokemon requirements

    Requirements

    secondaryPokemon?: PlayerPokemon[]
    secondaryPokemonRequirements: EncounterPokemonRequirement[]

    Secondary Pokemon are pokemon that meet ALL secondary pokemon requirements Note that an individual requirement may require multiple pokemon, but the resulting pokemon after all secondary requirements are met may be lower than expected If the primary pokemon and secondary pokemon are the same and ExcludePrimaryFromSupportRequirements flag is true, primary pokemon may be promoted from secondary pool

    selectedOption?: default

    Will be set by option select handlers automatically, and can be used to refer to which option was chosen by later phases

    skipEnemyBattleTurns: boolean

    If true, will skip enemy pokemon turns during battle for the encounter Used for encounters where it is not a "real" battle, but still uses battle animations and commands (see FunAndGamesEncounter for an example)

    skipToFightInput: boolean

    If true, will skip COMMAND input and go straight to FIGHT (move select) input menu

    startOfBattleEffects: EncounterStartOfBattleEffect[] = []

    Will be set by option select handlers automatically, and can be used to refer to which option was chosen by later phases

    startOfBattleEffectsComplete: boolean

    Will be set automatically, indicates special moves in startOfBattleEffects are complete (so will not repeat)

    Methods

    • If an encounter uses MysteryEncounterMode.continuousEncounter, should rely on this value for seed offset instead of wave index.

      This offset is incremented for each new MysteryEncounterPhase that occurs, so multi-encounter RNG will be consistent on resets and not be affected by number of turns, move RNG, etc.

      Returns any

    • Checks if the current scene state meets the requirements for the MysteryEncounter to spawn This is used to filter the pool of encounters down to only the ones with all requirements met

      Returns boolean

    • Auto-pushes dialogue tokens from the encounter (and option) requirements. Will use the first support pokemon in list For multiple support pokemon in the dialogue token, it will have to be overridden.

      Returns void

    • Used to cache a dialogue token for the encounter. Tokens will be auto-injected via the {{key}} pattern with value, when using the showEncounterText and showEncounterDialogue helper functions.

      Parameters

      • key: string
      • value: string

      Returns void

    MMNEPVFCICPMFPCPTTAAATR