# default | pokemon-rogue-battle
Documentation for pokemon-rogue-battle

# Class default

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

- IMysteryEncounter

- Defined in src/data/mystery-encounters/mystery-encounter.ts:93

##### Index

### Constructors

constructor

### Properties

autoHideIntroVisuals
catchAllowed
continuousEncounter
dialogue
dialogueTokens
disallowedChallenges?
disallowedGameModes?
doContinueEncounter?
doEncounterExp?
doEncounterRewards?
encounterAnimations?
encounterMode
encounterTier
encounterType
enemyPartyConfigs
enterIntroVisualsFromRight
excludePrimaryFromSupportRequirements
expMultiplier
fleeAllowed
hasBattleAnimationsWithoutTargets
hideBattleIntroMessage
introVisuals?
loadAssets
localizationKey
lockEncounterRewardTiers
maxAllowedEncounters
misc?
onGameOver?
onInit?
onRewards?
onTurnStart?
onVisualsStart?
options
preventGameStatsUpdates
primaryPokemon?
primaryPokemonRequirements
requirements
secondaryPokemon?
secondaryPokemonRequirements
selectedOption?
skipEnemyBattleTurns
skipToFightInput
spriteConfigs
startOfBattleEffects
startOfBattleEffectsComplete

### Methods

getSeedOffset
initIntroVisuals
meetsRequirements
pokemonMeetsPrimaryRequirements
populateDialogueTokensFromRequirements
setDialogueToken
updateSeedOffset

## Constructors

### constructor

- new default(encounter: null | IMysteryEncounter ): default

  #### Parameters

  - encounter: null | IMysteryEncounter

  #### Returns default

  - Defined in src/data/mystery-encounters/mystery-encounter.ts:279

## Properties

### autoHideIntroVisuals

autoHideIntroVisuals: boolean

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

Implementation of IMysteryEncounter.autoHideIntroVisuals

- Defined in src/data/mystery-encounters/mystery-encounter.ts:125

### catchAllowed

catchAllowed: boolean

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

Implementation of IMysteryEncounter.catchAllowed

- Defined in src/data/mystery-encounters/mystery-encounter.ts:135

### continuousEncounter

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

Implementation of IMysteryEncounter.continuousEncounter

- Defined in src/data/mystery-encounters/mystery-encounter.ts:146

### dialogue

dialogue: default

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

Implementation of IMysteryEncounter.dialogue

- Defined in src/data/mystery-encounters/mystery-encounter.ts:214

### dialogueTokens

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

Implementation of IMysteryEncounter.dialogueTokens

- Defined in src/data/mystery-encounters/mystery-encounter.ts:234

### `Optional` disallowedChallenges

disallowedChallenges?: Challenges []

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

Implementation of IMysteryEncounter.disallowedChallenges

- Defined in src/data/mystery-encounters/mystery-encounter.ts:115

### `Optional` disallowedGameModes

disallowedGameModes?: GameModes []

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

Implementation of IMysteryEncounter.disallowedGameModes

- Defined in src/data/mystery-encounters/mystery-encounter.ts:111

### `Optional` doContinueEncounter

doContinueEncounter?: () => Promise<void>

Will execute callback during VictoryPhase of a continuousEncounter

Implementation of IMysteryEncounter.doContinueEncounter

- Defined in src/data/mystery-encounters/mystery-encounter.ts:186

### `Optional` doEncounterExp

doEncounterExp?: () => boolean

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

Implementation of IMysteryEncounter.doEncounterExp

- Defined in src/data/mystery-encounters/mystery-encounter.ts:182

### `Optional` doEncounterRewards

doEncounterRewards?: () => boolean

Will provide the player a rewards shop for that wave

Implementation of IMysteryEncounter.doEncounterRewards

- Defined in src/data/mystery-encounters/mystery-encounter.ts:184

### `Optional` encounterAnimations

encounterAnimations?: EncounterAnim []

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

Implementation of IMysteryEncounter.encounterAnimations

- Defined in src/data/mystery-encounters/mystery-encounter.ts:107

### encounterMode

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

- Defined in src/data/mystery-encounters/mystery-encounter.ts:240

### encounterTier

encounterTier: MysteryEncounterTier

Implementation of IMysteryEncounter.encounterTier

- Defined in src/data/mystery-encounters/mystery-encounter.ts:102

### encounterType

encounterType: MysteryEncounterType

Implementation of IMysteryEncounter.encounterType

- Defined in src/data/mystery-encounters/mystery-encounter.ts:96

### enemyPartyConfigs

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

Implementation of IMysteryEncounter.enemyPartyConfigs

- Defined in src/data/mystery-encounters/mystery-encounter.ts:220

### enterIntroVisualsFromRight

enterIntroVisualsFromRight: boolean

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

Implementation of IMysteryEncounter.enterIntroVisualsFromRight

- Defined in src/data/mystery-encounters/mystery-encounter.ts:130

### excludePrimaryFromSupportRequirements

excludePrimaryFromSupportRequirements: boolean

Implementation of IMysteryEncounter.excludePrimaryFromSupportRequirements

- Defined in src/data/mystery-encounters/mystery-encounter.ts:205

### expMultiplier

expMultiplier: number

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

Implementation of IMysteryEncounter.expMultiplier

- Defined in src/data/mystery-encounters/mystery-encounter.ts:263

### fleeAllowed

fleeAllowed: boolean

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

Implementation of IMysteryEncounter.fleeAllowed

- Defined in src/data/mystery-encounters/mystery-encounter.ts:140

### hasBattleAnimationsWithoutTargets

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)

Implementation of IMysteryEncounter.hasBattleAnimationsWithoutTargets

- Defined in src/data/mystery-encounters/mystery-encounter.ts:156

### hideBattleIntroMessage

hideBattleIntroMessage: boolean

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

Implementation of IMysteryEncounter.hideBattleIntroMessage

- Defined in src/data/mystery-encounters/mystery-encounter.ts:120

### `Optional` introVisuals

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

- Defined in src/data/mystery-encounters/mystery-encounter.ts:226

### loadAssets

loadAssets: Promise<void>[]

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

- Defined in src/data/mystery-encounters/mystery-encounter.ts:267

### localizationKey

localizationKey: string

- Defined in src/data/mystery-encounters/mystery-encounter.ts:210

### lockEncounterRewardTiers

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)

- Defined in src/data/mystery-encounters/mystery-encounter.ts:246

### maxAllowedEncounters

maxAllowedEncounters: number

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

Implementation of IMysteryEncounter.maxAllowedEncounters

- Defined in src/data/mystery-encounters/mystery-encounter.ts:151

### `Optional` misc

misc?: any

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

- Defined in src/data/mystery-encounters/mystery-encounter.ts:272

### `Optional` onGameOver

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.

- Defined in src/data/mystery-encounters/mystery-encounter.ts:191

### `Optional` onInit

onInit?: () => boolean

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

Implementation of IMysteryEncounter.onInit

- Defined in src/data/mystery-encounters/mystery-encounter.ts:174

### `Optional` onRewards

onRewards?: () => Promise<void>

Event prior to any rewards logic in MysteryEncounterRewardsPhase

- Defined in src/data/mystery-encounters/mystery-encounter.ts:180

### `Optional` onTurnStart

onTurnStart?: () => boolean

Event triggered prior to CommandPhase, during TurnInitPhase

- Defined in src/data/mystery-encounters/mystery-encounter.ts:178

### `Optional` onVisualsStart

onVisualsStart?: () => boolean

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

Implementation of IMysteryEncounter.onVisualsStart

- Defined in src/data/mystery-encounters/mystery-encounter.ts:176

### options

options: [ default , default , ... default []]

Implementation of IMysteryEncounter.options

- Defined in src/data/mystery-encounters/mystery-encounter.ts:97

### preventGameStatsUpdates

preventGameStatsUpdates: boolean

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

Implementation of IMysteryEncounter.preventGameStatsUpdates

- Defined in src/data/mystery-encounters/mystery-encounter.ts:169

### `Optional` primaryPokemon

primaryPokemon?: PlayerPokemon

- Defined in src/data/mystery-encounters/mystery-encounter.ts:206

### primaryPokemonRequirements

primaryPokemonRequirements: EncounterPokemonRequirement []

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

Implementation of IMysteryEncounter.primaryPokemonRequirements

- Defined in src/data/mystery-encounters/mystery-encounter.ts:198

### requirements

requirements: EncounterSceneRequirement []

Requirements

Implementation of IMysteryEncounter.requirements

- Defined in src/data/mystery-encounters/mystery-encounter.ts:196

### `Optional` secondaryPokemon

secondaryPokemon?: PlayerPokemon []

- Defined in src/data/mystery-encounters/mystery-encounter.ts:207

### secondaryPokemonRequirements

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

Implementation of IMysteryEncounter.secondaryPokemonRequirements

- Defined in src/data/mystery-encounters/mystery-encounter.ts:204

### `Optional` selectedOption

selectedOption?: default

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

- Defined in src/data/mystery-encounters/mystery-encounter.ts:254

### skipEnemyBattleTurns

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)

Implementation of IMysteryEncounter.skipEnemyBattleTurns

- Defined in src/data/mystery-encounters/mystery-encounter.ts:161

### skipToFightInput

skipToFightInput: boolean

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

Implementation of IMysteryEncounter.skipToFightInput

- Defined in src/data/mystery-encounters/mystery-encounter.ts:165

### spriteConfigs

spriteConfigs: MysteryEncounterSpriteConfig []

Implementation of IMysteryEncounter.spriteConfigs

- Defined in src/data/mystery-encounters/mystery-encounter.ts:98

### startOfBattleEffects

startOfBattleEffects: EncounterStartOfBattleEffect [] = []

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

- Defined in src/data/mystery-encounters/mystery-encounter.ts:258

### startOfBattleEffectsComplete

startOfBattleEffectsComplete: boolean

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

- Defined in src/data/mystery-encounters/mystery-encounter.ts:250

## Methods

### getSeedOffset

- getSeedOffset(): any

  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

  - Defined in src/data/mystery-encounters/mystery-encounter.ts:529

### initIntroVisuals

- initIntroVisuals(): void

  Initializes encounter intro sprites based on the sprite configs defined in spriteConfigs

  #### Returns void

  - Defined in src/data/mystery-encounters/mystery-encounter.ts:429

### meetsRequirements

- meetsRequirements(): boolean

  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

  - Defined in src/data/mystery-encounters/mystery-encounter.ts:316

### pokemonMeetsPrimaryRequirements

- pokemonMeetsPrimaryRequirements(pokemon: default ): boolean

  Checks if a specific player pokemon meets all given primary EncounterPokemonRequirements Used automatically as part of `meetsRequirements`, but can also be used to manually check certain Pokemon where needed

  #### Parameters

  - pokemon: default

  #### Returns boolean

  - Defined in src/data/mystery-encounters/mystery-encounter.ts:329

### populateDialogueTokensFromRequirements

- populateDialogueTokensFromRequirements(): void

  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

  - Defined in src/data/mystery-encounters/mystery-encounter.ts:438

### setDialogueToken

- setDialogueToken(key: string, value: string): 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

  - Defined in src/data/mystery-encounters/mystery-encounter.ts:518

### updateSeedOffset

- updateSeedOffset(): void

  Maintains seed offset for RNG consistency Increments if the same MysteryEncounter has multiple option select cycles

  #### Returns void

  - Defined in src/data/mystery-encounters/mystery-encounter.ts:537