Hierarchy (view full)

Constructors

Properties

Methods

addEnemyModifier addEnemyPokemon addFaintedEnemyScore addFieldSprite addInfoToggle addModifier addMoney addPlayerPokemon addPokemonIcon addPokemonSprite animateMoneyChanged appendToPhase applyModifier applyModifiers applyModifiersInternal applyPartyExp applyShuffledModifiers cachedFetch clearEnemyHeldItemModifiers clearEnemyModifiers clearPhaseQueue clearPhaseQueueSplice create executeWithSeedOffset fadeAndSwitchBgm fadeOutBgm findModifier findModifiers findPhase generateEnemyModifiers generateRandomBiome getActiveKeys getBgmLoopPoint getCachedUrl getCurrentPhase getDoubleBattleChance getEncounterBossSegments getEnemyField getEnemyParty getEnemyPokemon getField getInfoToggles getMaxExpLevel getModifierBar getModifiers getMysteryEncounter getPlayerField getPlayerParty getPlayerPokemon getPokemonAllowedInBattle getPokemonById getSpeciesFormIndex getStandbyPhase getWaveMoneyAmount hasExpSprite hideEnemyModifierBar hideFieldOverlay hideLuckText hideShopOverlay initExpSprites initFinalBossPhaseTwo initPokemonSprite initSession initStarterColors initVariantData isBgmPlaying isMysteryEncounterValidForWave launchBattle loadAtlas loadBgm loadImage loadPokemonAtlas loadPokemonVariantAssets loadSe loadSpritesheet moveBelowOverlay newArena newBattle overridePhase pauseBgm playBgm playSound playSoundWithoutBgm populatePhaseQueue preload prependToPhase processInfoButton pushConditionalPhase pushPhase queueMessage randBattleSeedInt randomSpecies redirectPokemonMoves removeModifier removePartyMemberModifiers removePokemonFromPlayerParty reset resetSeed resumeBgm sendTextToBack setFieldScale setModifiersVisible setPhaseQueueSplice setSeed shiftPhase showEnemyModifierBar showFieldOverlay showShopOverlay toggleInvert triggerPokemonBattleAnim triggerPokemonFormChange tryRemovePhase tryRemoveUnshiftedPhase tryReplacePhase trySpreadPokerus tryTransferHeldItemModifier unshiftPhase update updateAndShowText updateBiomeWaveText updateFieldScale updateGameInfo updateModifiers updateMoneyText updatePartyForModifiers updateScoreText updateShopOverlayOpacity updateSoundVolume updateUIPositions validateAchv validateAchvs validateVoucher

Constructors

Properties

abilityBar: default
add: GameObjectFactory

The Scene Game Object Factory.

This property will only be available if defined in the Scene Injection Map.

anims: AnimationManager

A reference to the global Animation Manager.

This property will only be available if defined in the Scene Injection Map.

arena: Arena
arenaBg: Sprite
arenaBgTransition: Sprite
arenaEnemy: ArenaBase
arenaFlyout: ArenaFlyout
arenaNextEnemy: ArenaBase
arenaPlayer: ArenaBase
arenaPlayerTransition: ArenaBase
battleStyle: number = BattleStyle.SWITCH

Determines the selected battle style.

  • 0 = 'Switch'
  • 1 = 'Set' - The option to switch the active pokemon at the start of a battle will not display.
bgmVolume: number = 1
cache: CacheManager

A reference to the global Cache.

This property will only be available if defined in the Scene Injection Map.

cameras: CameraManager

The Scene Camera Manager.

This property will only be available if defined in the Scene Injection Map.

candyBar: default
candyUpgradeDisplay: number = 0

Determines what type of notification is used for Candy Upgrades

  • 0 = 'Icon'
  • 1 = 'Animation'
candyUpgradeNotification: number = 0

Determines the condition for a notification should be shown for Candy Upgrades

  • 0 = 'Off'
  • 1 = 'Passives Only'
  • 2 = 'On'
charSprite: default
children: DisplayList

The Game Object Display List belonging to this Scene.

This property will only be available if defined in the Scene Injection Map.

conditionalQueue: [(() => boolean), Phase][]
currentBattle: default
damageNumberHandler: default
damageNumbersMode: number = 0
data: DataManager

A Scene specific Data Manager Plugin.

See the registry property for the global Data Manager.

This property will only be available if defined in the Scene Injection Map and the plugin is installed.

disableMenu: boolean = false
eggSkipPreference: number = 0

Determines if the egg hatching animation should be skipped

  • 0 = Never (never skip animation)
  • 1 = Ask (ask to skip animation when hatching 2 or more eggs)
  • 2 = Always (automatically skip animation when hatching 2 or more eggs)
enableMoveInfo: boolean = true
enableRetries: boolean = false
enableTouchControls: boolean = false
enableTutorials: boolean = ...
enableVibration: boolean = false
eventManager: TimedEventManager
eventTarget: EventTarget = ...

Allows subscribers to listen for events

Current Events:

  • BattleSceneEventType.MOVE_USED MoveUsedEvent
  • BattleSceneEventType.TURN_INIT TurnInitEvent
  • BattleSceneEventType.TURN_END TurnEndEvent
  • BattleSceneEventType.NEW_ARENA NewArenaEvent
events: EventEmitter

A Scene specific Event Emitter.

This property will only be available if defined in the Scene Injection Map.

expGainsSpeed: ExpGainsSpeed = ExpGainsSpeed.DEFAULT
expParty: ExpNotification = 0

Defines the experience gain display mode.

The expParty can have several modes:

  • 0 - Default: The normal experience gain display, nothing changed.
  • 1 - Level Up Notification: Displays the level up in the small frame instead of a message.
  • 2 - Skip: No level up frame nor message.

Modes 1 and 2 are still compatible with stats display, level up, new move, etc.

0 - Uses the default normal experience gain display.
experimentalSprites: boolean = false
facebook: FacebookInstantGamesPlugin

The Facebook Instant Games Plugin.

This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.

field: Container
fieldSpritePipeline: default
fieldUI: Container
fieldVolume: number = 1
fusionPaletteSwaps: boolean = true
game: Game

A reference to the Phaser.Game instance.

This property will only be available if defined in the Scene Injection Map.

gameData: GameData
gameMode: GameMode
gameSpeed: number = 1
hideIvs: boolean = false
hpBarSpeed: number = 0
input: InputPlugin

The Scene Input Manager Plugin.

This property will only be available if defined in the Scene Injection Map and the plugin is installed.

inputController: InputsController
inputMethod: string
lastEnemyTrainer: null | default
lastMysteryEncounter?: default

If the previous wave was a MysteryEncounter, tracks the object with this variable. Mostly used for visual object cleanup

lastSavePlayTime: null | number = null
lights: LightsManager

The Scene Lights Manager Plugin.

This property will only be available if defined in the Scene Injection Map and the plugin is installed.

load: LoaderPlugin

The Scene Loader Plugin.

This property will only be available if defined in the Scene Injection Map and the plugin is installed.

lockModifierTiers: boolean
make: GameObjectCreator

The Scene Game Object Creator.

This property will only be available if defined in the Scene Injection Map.

masterVolume: number = 0.5
matter: MatterPhysics

The Scene Matter Physics Plugin.

This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.

modifiers: PersistentModifier[]
money: number
moneyFormat: MoneyFormat = MoneyFormat.NORMAL
moveAnimations: boolean = true
musicPreference: number = MusicPreference.MIXED
mysteryEncounterSaveData: MysteryEncounterSaveData = ...

Session save data that pertains to Mystery Encounters

offsetGym: boolean
partyExpBar: default
pbTray: default
pbTrayEnemy: default
phaseQueue: Phase[]

PhaseQueue: dequeue/remove the first element to get the next phase

physics: ArcadePhysics

The Scene Arcade Physics Plugin.

This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.

plugins: PluginManager

A reference to the global Plugin Manager.

The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install those plugins into Scenes as required.

pokeballCounts: PokeballCounts
pokemonInfoContainer: default
registry: DataManager

A reference to the global Data Manager.

This property will only be available if defined in the Scene Injection Map.

renderer: CanvasRenderer | WebGLRenderer

A reference to the renderer instance Phaser is using, either Canvas Renderer or WebGL Renderer.

reroll: boolean = false
rexUI: UIPlugin
rngCounter: number = 0
rngOffset: number = 0
rngSeedOverride: string = ""
scale: ScaleManager

A reference to the global Scale Manager.

This property will only be available if defined in the Scene Injection Map.

scaledCanvas: {
    height: number;
    width: number;
} = ...

Since everything is scaled up by 6 by default using the game.canvas is annoying Until such point that we use the canvas normally, this will be easier than having to divide every width and heigh by 6 to position and scale the ui

width: 320 height: 180

scene: ScenePlugin

A reference to the Scene Manager Plugin.

This property will only be available if defined in the Scene Injection Map.

score: number
seVolume: number = 1
seed: string
sessionPlayTime: null | number = null
sessionSlotId: number
shopCursorTarget: number = ShopCursorTarget.REWARDS
showArenaFlyout: boolean = true
showBgmBar: boolean = true
showLevelUpStats: boolean = true
showMovesetFlyout: boolean = true
showTimeOfDayWidget: boolean = true
skipSeenDialogues: boolean = false
sound: NoAudioSoundManager | HTML5AudioSoundManager | WebAudioSoundManager

A reference to the Sound Manager.

This property will only be available if defined in the Scene Injection Map and the plugin is installed.

spritePipeline: default
sys: Systems

The Scene Systems. You must never overwrite this property, or all hell will break lose.

textures: TextureManager

A reference to the Texture Manager.

This property will only be available if defined in the Scene Injection Map.

time: Clock

The Scene Time and Clock Plugin.

This property will only be available if defined in the Scene Injection Map and the plugin is installed.

timeOfDayAnimation: EaseType = EaseType.NONE
trainer: Sprite
tweens: TweenManager

The Scene Tween Manager Plugin.

This property will only be available if defined in the Scene Injection Map and the plugin is installed.

typeHints: boolean = false

Defines whether or not to show type effectiveness hints

  • true: No hints
  • false: Show hints for moves
uiContainer: Container
uiInputs: UiInputs
uiTheme: UiTheme = UiTheme.DEFAULT
uiVolume: number = 1
waveCycleOffset: number
waveSeed: string
windowType: number = 0

Methods

  • Parameters

    Returns Promise<void>

  • Parameters

    • x: number
    • y: number
    • texture: string | Texture
    • Optionalframe: string | number
    • terrainColorRatio: number = 0

    Returns Sprite

  • Parameters

    • modifier: null | Modifier
    • OptionalignoreUpdate: boolean
    • OptionalplaySound: boolean
    • Optionalvirtual: boolean
    • Optionalinstant: boolean
    • Optionalcost: number

    Returns Promise<boolean>

  • Parameters

    • pokemon: default
    • x: number
    • y: number
    • originX: number = 0.5
    • originY: number = 0.5
    • ignoreOverride: boolean = false

    Returns Container

  • Parameters

    • pokemon: default
    • x: number
    • y: number
    • texture: string | Texture
    • Optionalframe: string | number
    • hasShadow: boolean = false
    • ignoreOverride: boolean = false

    Returns Sprite

  • Parameters

    • positiveChange: boolean

    Returns void

  • Apply the first modifier that matches modifierType

    Type Parameters

    Parameters

    • modifierType: Constructor<T>

      The type of modifier to apply; must extend PersistentModifier

    • player: boolean = true

      Whether to search the player (true) or the enemy (false); Defaults to true

    • Rest...args: Parameters<T["apply"]>

    Returns null | T

    the first modifier that matches modifierType and was applied; return null if none matched

  • Apply all modifiers that match modifierType

    Type Parameters

    Parameters

    • modifierType: Constructor<T>

      The type of modifier to apply; must extend PersistentModifier

    • player: boolean = true

      Whether to search the player (true) or the enemy (false); Defaults to true

    • Rest...args: Parameters<T["apply"]>

    Returns T[]

    the list of all modifiers that matched modifierType and were applied.

  • Helper function to apply all passed modifiers

    Type Parameters

    Parameters

    • modifiers: T[]
    • player: boolean
    • args: Parameters<T["apply"]>

    Returns T[]

  • Updates Exp and level values for Player's party, adding new level up phases as required

    Parameters

    • expValue: number

      raw value of exp to split among participants, OR the base multiplier to use with waveIndex

    • pokemonDefeated: boolean

      If true, will increment Macho Brace stacks and give the party Pokemon friendship increases

    • OptionaluseWaveIndexMultiplier: boolean

      Default false. If true, will multiply expValue by a scaling waveIndex multiplier. Not needed if expValue is already scaled by level/wave

    • OptionalpokemonParticipantIds: Set<number>

      Participants. If none are defined, no exp will be given. To spread evenly among the party, should pass all ids of party members.

    Returns void

  • Apply all modifiers that match modifierType in a random order

    Type Parameters

    Parameters

    • scene: default

      BattleScene used to randomize the order of modifiers

    • modifierType: Constructor<T>

      The type of modifier to apply; must extend PersistentModifier

    • player: boolean = true

      Whether to search the player (true) or the enemy (false); Defaults to true

    • Rest...args: Parameters<T["apply"]>

    Returns T[]

    the list of all modifiers that matched modifierType and were applied.

  • Parameters

    • url: string
    • Optionalinit: RequestInit

    Returns Promise<Response>

  • Resets phaseQueuePrependSpliceIndex to -1, implies that calls to unshiftPhase will insert at end of phaseQueuePrepend

    Returns void

  • Parameters

    • func: Function
    • offset: number
    • OptionalseedOverride: string

    Returns void

  • Fades out current track for delay ms, then fades in new track.

    Parameters

    • newBgmKey: string
    • destroy: boolean = false
    • delay: number = 2000

    Returns void

  • Parameters

    • duration: number = 500
    • destroy: boolean = true

    Returns boolean

  • Find the first modifier that pass the modifierFilter function

    Parameters

    • modifierFilter: ModifierPredicate

      The function used to filter a target's modifiers

    • player: boolean = true

      Whether to search the player (true) or the enemy (false); Defaults to true

    Returns undefined | PersistentModifier

    the first modifier that passed the modifierFilter function; undefined if none passed

  • Get all of the modifiers that pass the modifierFilter function

    Parameters

    • modifierFilter: ModifierPredicate

      The function used to filter a target's modifiers

    • isPlayer: boolean = true

      Whether to search the player (true) or the enemy (false); Defaults to true

    Returns PersistentModifier[]

    the list of all modifiers that passed the modifierFilter function

  • Find a specific Phase in the phase queue.

    Type Parameters

    Parameters

    • phaseFilter: ((phase: P) => boolean)

      filter function to use to find the wanted phase

        • (phase): boolean
        • Parameters

          • phase: P

          Returns boolean

    Returns undefined | P

    the found phase or undefined if none found

  • Parameters

    • OptionalheldModifiersConfigs: default[][]

    Returns Promise<void>

  • This function retrieves the sprite and audio keys for active Pokemon. Active Pokemon include both enemy and player Pokemon of the current wave. Note: Questions on garbage collection go to

    Returns string[]

    a string array of active sprite and audio keys that should not be deleted

  • Parameters

    • waveIndex: number
    • level: number
    • Optionalspecies: default
    • forceBoss: boolean = false

    Returns number

  • Parameters

    • OptionalignoreLevelCap: boolean

    Returns number

  • Returns the ModifierBar of this scene, which is declared private and therefore not accessible elsewhere

    Parameters

    • OptionalisEnemy: boolean

      Whether to return the enemy's modifier bar

    Returns ModifierBar

  • Get all of the modifiers that match modifierType

    Type Parameters

    Parameters

    • modifierType: Constructor<T>

      The type of modifier to apply; must extend PersistentModifier

    • player: boolean = true

      Whether to search the player (true) or the enemy (false); Defaults to true

    Returns T[]

    the list of all modifiers that matched modifierType.

  • Loads or generates a mystery encounter

    Parameters

    • OptionalencounterType: MysteryEncounterType

      used to load session encounter when restarting game, etc.

    • OptionalcanBypass: boolean

      optional boolean to indicate that the request is coming from a function that needs to access a Mystery Encounter outside of gameplay requirements

    Returns default

  • Parameters

    Returns number

  • Parameters

    • moneyMultiplier: number

    Returns number

  • Parameters

    • duration: number

    Returns Promise<void>

  • Parameters

    • duration: number

    Returns Promise<void>

  • Initialized the 2nd phase of the final boss (e.g. form-change for Eternatus)

    Parameters

    • pokemon: default

      The (enemy) pokemon

    Returns void

  • Parameters

    • sprite: Sprite
    • Optionalpokemon: default
    • hasShadow: boolean = false
    • ignoreOverride: boolean = false

    Returns Sprite

  • Returns if a wave COULD spawn a MysteryEncounter. Even if returns true, does not guarantee that a wave will actually be a ME. That check is made in BattleScene.isWaveMysteryEncounter instead.

    Parameters

    Returns boolean

  • Parameters

    • key: string
    • atlasPath: string
    • Optionalexperimental: boolean

    Returns void

  • Load the variant assets for the given sprite and stores them in variantColorCache

    Parameters

    • spriteKey: string
    • fileRoot: string
    • Optionalvariant: Variant

    Returns void

  • Parameters

    • key: string
    • Optionalfolder: string
    • Optionalfilenames: string | string[]

    Returns void

  • Type Parameters

    • T extends GameObject

    Parameters

    • gameObject: T

    Returns void

  • Parameters

    • OptionalbgmName: string
    • OptionalfadeOut: boolean

    Returns void

  • Moves everything from nextCommandPhaseQueue to phaseQueue (keeping order)

    Returns void

  • Tries to add the input phase to index before target phase in the phaseQueue, else simply calls unshiftPhase()

    Parameters

    Returns boolean

    boolean if a targetPhase was found and added

  • Adds a phase to the conditional queue and ensures it is executed only when the specified condition is met.

    This method allows deferring the execution of a phase until certain conditions are met, which is useful for handling situations like abilities and entry hazards that depend on specific game states.

    Parameters

    • phase: Phase

      The phase to be added to the conditional queue.

    • condition: (() => boolean)

      A function that returns a boolean indicating whether the phase should be executed.

        • (): boolean
        • Returns boolean

    Returns void

  • Adds a phase to nextCommandPhaseQueue, as long as boolean passed in is false

    Parameters

    • phase: Phase

      Phase the phase to add

    • defer: boolean = false

      boolean on which queue to add to, defaults to false, and adds to phaseQueue

    Returns void

  • Adds a MessagePhase, either to PhaseQueuePrepend or nextCommandPhaseQueue

    Parameters

    • message: string

      string for MessagePhase

    • OptionalcallbackDelay: null | number

      optional param for MessagePhase constructor

    • Optionalprompt: null | boolean

      optional param for MessagePhase constructor

    • OptionalpromptDelay: null | number

      optional param for MessagePhase constructor

    • Optionaldefer: null | boolean

      boolean for which queue to add it to, false -> add to PhaseQueuePrepend, true -> nextCommandPhaseQueue

    Returns void

  • Generates a random number using the current battle's seed

    This calls Battle.randSeedInt(scene, range, min) in src/battle.ts which calls randSeedInt(range, min) in src/utils.ts

    Parameters

    • range: number

      How large of a range of random numbers to choose from. If range <= 1, returns min

    • min: number = 0

      The minimum integer to pick, default 0

    Returns number

    A random integer between min and (min + range - 1)

  • Parameters

    • waveIndex: number
    • level: number
    • OptionalfromArenaPool: boolean
    • OptionalspeciesFilter: PokemonSpeciesFilter
    • OptionalfilterAllEvolutions: boolean

    Returns default

  • Used in doubles battles to redirect moves from one pokemon to another when one faints or is removed from the field

    Parameters

    • removedPokemon: default

      Pokemon the pokemon that is being removed from the field (flee, faint), moves to be redirected FROM

    • allyPokemon: default

      Pokemon the pokemon that will have the moves be redirected TO

    Returns void

  • Removes a currently owned item. If the item is stacked, the entire item stack gets removed. This function does NOT apply in-battle effects, such as Unburden. If in-battle effects are needed, use Pokemon.loseHeldItem instead.

    Parameters

    • modifier: PersistentModifier

      The item to be removed.

    • enemy: boolean = false

      If true, remove an item owned by the enemy. If false, remove an item owned by the player. Default is false.

    Returns boolean

    true if the item exists and was successfully removed, false otherwise.

  • Parameters

    • partyMemberIndex: number

    Returns Promise<void>

  • Removes a PlayerPokemon from the party, and clears modifiers for that Pokemon's id Useful for MEs/Challenges that remove Pokemon from the player party temporarily or permanently

    Parameters

    Returns void

  • Parameters

    • clearScene: boolean = false
    • clearData: boolean = false
    • reloadI18n: boolean = false

    Returns void

  • Pushes all Phaser.GameObjects.Text objects in the top right to the bottom of the canvas

    Returns void

  • Parameters

    • scale: number
    • instant: boolean = false

    Returns Promise<void>

  • Used by function unshiftPhase(), sets index to start inserting at current length instead of the end of the array, useful if phaseQueuePrepend gets longer with Phases

    Returns void

  • Is called by each Phase implementations "end()" by default We dump everything from phaseQueuePrepend to the start of of phaseQueue then removes first Phase and starts it

    Returns void

  • Parameters

    • duration: number

    Returns Promise<void>

  • Parameters

    • duration: number

    Returns Promise<void>

  • Parameters

    Returns boolean

  • Parameters

    • phaseFilter: ((phase: Phase) => boolean)
        • (phase): boolean
        • Parameters

          Returns boolean

    Returns boolean

  • Will search for a specific phase in phaseQueuePrepend via filter, and remove the first result if a match is found.

    Parameters

    • phaseFilter: ((phase: Phase) => boolean)

      filter function

        • (phase): boolean
        • Parameters

          Returns boolean

    Returns boolean

  • Parameters

    • phaseFilter: ((phase: Phase) => boolean)
        • (phase): boolean
        • Parameters

          Returns boolean

    • phase: Phase

    Returns boolean

  • Try to transfer a held item to another pokemon. If the recepient already has the maximum amount allowed for this item, the transfer is cancelled. The quantity to transfer is automatically capped at how much the recepient can take before reaching the maximum stack size for the item. A transfer that moves a quantity smaller than what is specified in the transferQuantity parameter is still considered successful.

    Parameters

    • itemModifier: PokemonHeldItemModifier

      PokemonHeldItemModifier item to transfer (represents the whole stack)

    • target: default

      Pokemon recepient in this transfer

    • playSound: boolean

      true to play a sound when transferring the item

    • transferQuantity: number = 1

      How many items of the stack to transfer. Optional, defaults to 1

    • Optionalinstant: boolean

      ??? (Optional)

    • OptionalignoreUpdate: boolean

      ??? (Optional)

    • itemLost: boolean = true

      If true, treat the item's current holder as losing the item (for now, this simply enables Unburden). Default is true.

    Returns Promise<boolean>

    true if the transfer was successful

  • Adds Phase to the end of phaseQueuePrepend, or at phaseQueuePrependSpliceIndex

    Parameters

    Returns void

  • This method should be overridden by your own Scenes.

    This method is called once per game step while the scene is running.

    Returns void

  • Displays the current luck value.

    Parameters

    • duration: number

      The time for this label to fade in, if it is not already visible.

    Returns void

  • Parameters

    • Optionalplayer: boolean
    • Optionalinstant: boolean

    Returns Promise<void>

  • Parameters

    • forceVisible: boolean = true

    Returns void

  • Parameters

    • party: default[]
    • Optionalinstant: boolean

    Returns Promise<void>