pokemon-rogue-battle
    Preparing search index...

    Class BattleScene

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

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

    Constructors

    Properties

    abilityBar: AbilityBar
    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: BattleStyle = BattleStyle.SWITCH

    Determines the selected battle style.

    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: CandyBar
    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: CharSprite
    children: DisplayList

    The Game Object Display List belonging to this Scene.

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

    commandCursorMemory: boolean = false
    currentBattle: Battle
    damageNumberHandler: DamageNumberHandler
    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.

    dexForDevs: boolean = false
    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
    events: EventEmitter

    A Scene specific Event Emitter.

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

    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
    experimentalSprites: boolean = false
    expGainsSpeed: ExpGainsSpeed = ExpGainsSpeed.DEFAULT
    expParty: ExpNotification = ExpNotification.DEFAULT
    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: FieldSpritePipeline
    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
    hideUsername: 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 | Trainer
    lastMysteryEncounter?: MysteryEncounter

    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: MusicPreference = MusicPreference.ALLGENS
    mysteryEncounterSaveData: MysteryEncounterSaveData = ...

    Session save data that pertains to Mystery Encounters

    offsetGym: boolean
    partyExpBar: PartyExpBar
    pbTray: PokeballTray
    pbTrayEnemy: PokeballTray
    phaseManager: PhaseManager

    Manager for the phases active in the battle scene

    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: PokemonInfoContainer
    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
    seed: string
    sessionPlayTime: null | number = null
    sessionSlotId: number
    seVolume: number = 1
    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: SpritePipeline
    sys: Systems

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

    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: Show hints for moves
    • false: No hints
    ui: UI
    uiContainer: Container
    uiInputs: UiInputs
    uiTheme: UiTheme = UiTheme.DEFAULT
    uiVolume: number = 1
    waveCycleOffset: number
    waveSeed: string
    windowType: number = 0

    Methods

    • 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 boolean

    • Parameters

      • pokemon: Pokemon
      • x: number
      • y: number
      • originX: number = 0.5
      • originY: number = 0.5
      • ignoreOverride: boolean = true
      • useIllusion: boolean = false

      Returns Container

    • Parameters

      • pokemon: Pokemon
      • 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

      • ...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

      • ...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

      • 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

      • ...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>

    • 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

    • 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

    • The loop point of any given battle, mystery encounter, or title track, read as seconds and milliseconds.

      Parameters

      • bgmName: string

      Returns number

    • Parameters

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

      Returns number

    • Returns an array of Pokemon on both sides of the battle - player first, then enemy. Does not actually check if the pokemon are on the field or not, and always has length 4 regardless of battle type.

      Parameters

      • activeOnly: boolean = false

        Whether to consider only active pokemon (as described by ()); default false. If true, will also remove all null values from the array.

      Returns Pokemon[]

      An array of Pokemon, as described above.

    • Parameters

      • ignoreLevelCap: boolean = false

      Returns number

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

      Parameters

      • isEnemy: boolean = false

        Whether to return the enemy modifier bar instead of the player bar; default false

      Returns ModifierBar

      The ModifierBar for the given side of the field

    • 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 MysteryEncounter

    • Return the Pokemon associated with a given ID.

      Parameters

      • pokemonId: undefined | number

        The ID whose Pokemon will be retrieved.

      Returns null | Pokemon

      The Pokemon associated with the given id. Returns null if the ID is undefined or not present in either party.

    • 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: Pokemon

        The (enemy) pokemon

      Returns void

    • Parameters

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

      Returns Sprite

    • Initialize the variant data. If experimental sprites are enabled, their entries are replaced via this method.

      Returns Promise<void>

    • 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
      • folder: string
      • OptionalfilenameRoot: string

      Returns void

    • Parameters

      • key: string
      • folder: string
      • Optionalfilename: string

      Returns void

    • Parameters

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

      Returns void

    • Parameters

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

      Returns void

    • Parameters

      • key: string
      • folder: string
      • size: number
      • Optionalfilename: string

      Returns void

    • Type Parameters

      • T extends GameObject

      Parameters

      • gameObject: T

      Returns void

    • Parameters

      • OptionalbgmName: string
      • OptionalfadeOut: boolean

      Returns void

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

      This calls Battle.randSeedInt(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)

    • Attempt to redirect a move in double battles from a fainted/removed Pokemon to its ally.

      Parameters

      • removedPokemon: Pokemon

        The Pokemon having been removed from the field.

      • allyPokemon: Pokemon

        The Pokemon allied with the removed Pokemon; will have moves redirected to it

      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

        true to remove an item owned by the enemy rather than the player; default 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>

    • Parameters

      • duration: number

      Returns Promise<void>

    • Parameters

      • duration: number

      Returns Promise<void>

    • Parameters

      Returns boolean

    • Attempt to discard one or more copies of a held item.

      Parameters

      Returns boolean

      Whether the item was successfully discarded. Removing fewer items than requested is still considered a success.

    • 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: Pokemon

        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 boolean

      true if the transfer was successful

    • 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

      • player: boolean = true
      • Optionalinstant: boolean

      Returns void

    • Parameters

      • forceVisible: boolean = true

      Returns void