AbstractOptionalabilityIndex: numberOptionalformIndex: numberOptionalgender: GenderOptionalshiny: booleanOptionalvariant: VariantOptionalivs: number[]Optionalnature: NatureOptionaldataSource: Pokemon | PokemonDataThe alpha value of the Game Object.
This is a global value, impacting the entire Game Object, not just a region of it. The value is clamped to the range [0, 1]. Setting alpha to 0 also clears the render flag, preventing the Game Object from being drawn until the alpha is raised above 0 again.
The angle of this Game Object as expressed in degrees.
Phaser uses a right-hand clockwise rotation system, where 0 is right, 90 is down, 180/-180 is left and -90 is up.
If you prefer to work in radians, see the rotation property instead.
Data that resets only on battle end (hit count, harvest berries, etc.) Kept between waves.
ProtectedbattleSets the Blend Mode being used by this Game Object.
This can be a const, such as Phaser.BlendModes.SCREEN, or an integer, such as 4 (for Overlay)
Under WebGL only the following Blend Modes are available:
Canvas has more available depending on browser support.
You can also create your own custom Blend Modes in WebGL.
Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these reasons try to be careful about the construction of your Scene and the frequency with which blend modes are used.
If this Game Object is enabled for Arcade or Matter Physics then this property will contain a reference to a Physics Body.
A bitmask that controls if this Game Object is drawn by a Camera or not.
Not usually set directly, instead call Camera.ignore, however you can
set this property directly using the Camera.id property:
A Data Manager.
It allows you to store, query and get key/value paired information specific to this Game Object.
null by default. Automatically created if you use getData or setData or setDataEnabled.
The depth of this Game Object within the Scene. Ensure this value is only ever set to a number data-type.
The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order of Game Objects, without actually moving their position in the display list.
The default depth is zero. A Game Object with a higher depth value will always render in front of one with a lower value.
Setting the depth will queue a depth sort event within the Scene.
The displayed height of this Game Object.
This value takes into account the scale factor.
Setting this value will adjust the Game Object's scale property.
Holds a reference to the Display List that contains this Game Object.
This is set automatically when this Game Object is added to a Scene or Layer.
You should treat this property as being read-only.
ReadonlydisplayInternal value to allow Containers to be used for input and physics. Do not change this value. It has no effect other than to break things.
ReadonlydisplayInternal value to allow Containers to be used for input and physics. Do not change this value. It has no effect other than to break things.
The displayed width of this Game Object.
This value takes into account the scale factor.
Setting this value will adjust the Game Object's scale property.
Does this Container exclusively manage its children?
The default is true which means a child added to this Container cannot
belong in another Container, which includes the Scene display list.
If you disable this then this Container will no longer exclusively manage its children. This allows you to create all kinds of interesting graphical effects, such as replicating Game Objects without reparenting them all over the Scene. However, doing so will prevent children from receiving any kind of input event or have their physics bodies work by default, as they're no longer a single entity on the display list, but are being replicated where-ever this Container is.
The position of this Pokémon on the field
The Camera used for filters. You can use this to alter the perspective of filters. It is not necessary to use this camera for ordinary rendering.
This is only available if you use the enableFilters method.
ReadonlyfiltersThe filter lists for this Game Object.
This is an object with internal and external properties.
Each list is a Phaser.GameObjects.Components.FilterList object.
This is only available if you use the enableFilters method.
Whether filterCamera should update every frame
to focus on the Game Object.
Disable this if you want to manually control the camera.
Whether the filters should focus on the context, rather than attempt to focus on the Game Object. This is enabled automatically when enabling filters on objects which don't have well-defined bounds.
This effectively sets the internal filters to render the same way as the external filters.
This is only used if filtersAutoFocus is enabled.
The "context" is the framebuffer to which the Game Object is rendered. This is usually the main framebuffer, but might be another framebuffer. It can even be several different framebuffers if the Game Object is rendered multiple times.
Whether the Filters component should always draw to a framebuffer, even if there are no active filters.
ReadonlyfirstReturns the first Game Object within the Container, or null if it is empty.
You can move the cursor by calling Container.next and Container.previous.
The Pokémon's current friendship value, ranging from 0 to 255.
If this Pokémon is a fusion, the species it is fused with; null if not a fusion
ReadonlyhasA property indicating that a Game Object has this component.
The native (un-scaled) height of this Game Object.
Changing this value will not change the size that the Game Object is rendered in-game.
For that you need to either set the scale of the Game Object (setScale) or use
the displayHeight property.
This pokemon's Personality value/PID, used to determine various parameters of this Pokemon. Represented as a random 32-bit unsigned integer. TODO: Stop treating this like a unique ID and stop treating 0 as no pokemon
This Game Object will ignore all calls made to its destroy method if this flag is set to true.
This includes calls that may come from a Group, Container or the Scene itself.
While it allows you to persist a Game Object across Scenes, please understand you are entirely
responsible for managing references to and from this Game Object.
If this Game Object is enabled for input then this property will contain an InteractiveObject instance.
Not usually set directly. Instead call GameObject.setInteractive().
ReadonlyisWhether this Game Object has been destroyed. Check this property to avoid bugs caused by calling methods on a destroyed Game Object, e.g. in a Tween or Timer.
This is a read-only property that is automatically set to true
when the Game Object is destroyed.
You should not set this property directly.
It is set before preDestroy is called or the DESTROY event is emitted.
Whether this Pokémon is currently Terastallized
ReadonlylastReturns the last Game Object within the Container, or null if it is empty.
You can move the cursor by calling Container.next and Container.previous.
ReadonlylengthThe number of Game Objects inside this Container.
An array holding the children of this Container.
Internal Transform Matrix used for local space conversion.
The Mask this Game Object is using during render, or null if no mask has been set.
The maximum size of the base filter texture. Filters may use a larger texture after the base texture is rendered. The maximum texture size is at least 4096 in WebGL, based on the hardware. You may set this lower to save memory or prevent resizing.
Containers can have an optional maximum size. If set to anything above 0 it will constrict the addition of new Game Objects into the Container, capping off the maximum limit the Container can grow in size to.
The ID of the biome this Pokémon was met in
The level at which this Pokémon was met
The wave index at which this Pokémon was met/encountered
OptionalmysteryUsed by Mystery Encounters to execute pokemon-specific logic (such as stat boosts) at start of battle
The name of this Game Object. Empty by default and never populated by Phaser, this is left for developers to use.
ReadonlynextReturns the next Game Object within the Container, or null if it is empty.
You can move the cursor by calling Container.next and Container.previous.
OptionalnicknameThe Pokemon's current nickname, or undefined if it currently lacks one.
If omitted, references to this should refer to the default name for this Pokemon's species.
ReadonlyoriginInternal value to allow Containers to be used for input and physics. Do not change this value. It has no effect other than to break things.
ReadonlyoriginInternal value to allow Containers to be used for input and physics. Do not change this value. It has no effect other than to break things.
The parent Container of this Game Object, if it has one.
An internal cursor position used for iterating through the Container's children
via methods such as first, next, previous and last.
ReadonlypreviousReturns the previous Game Object within the Container, or null if it is empty.
You can move the cursor by calling Container.next and Container.previous.
Stat stages queued by berry eating to be run in a single phase
Whether any filters should be rendered on this Game Object.
This is true by default, even if there are no filters yet.
Disable this to skip filter rendering.
Use willRenderFilters() to see if there are any active filters.
The flags that are compared against RENDER_MASK to determine if this Game Object will render or not.
The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively.
If those components are not used by your custom class then you can use this bitmask as you wish.
The angle of this Game Object in radians.
Phaser uses a right-hand clockwise rotation system, where 0 is right, PI/2 is down, +-PI is left and -PI/2 is up.
If you prefer to work in degrees, see the angle property instead.
This is a special setter that allows you to set both the horizontal and vertical scale of this Game Object
to the same value, at the same time. When reading this value the result returned is (scaleX + scaleY) / 2.
Use of this property implies you wish the horizontal and vertical scales to be equal to each other. If this
isn't the case, use the scaleX or scaleY properties instead.
The horizontal scale of this Game Object.
The vertical scale of this Game Object.
A reference to the Scene to which this Game Object belongs.
Game Objects can only belong to one Scene.
You should consider this property as being read-only. You cannot move a Game Object to another Scene by simply changing it.
The horizontal scroll factor of this Container.
The scroll factor controls the influence of the movement of a Camera upon this Container.
When a camera scrolls it will change the location at which this Container is rendered on-screen. It does not change the Containers actual position values.
For a Container, setting this value will only update the Container itself, not its children.
If you wish to change the scrollFactor of the children as well, use the setScrollFactor method.
A value of 1 means it will move exactly in sync with a camera. A value of 0 means it will not move at all, even if the camera moves. Other values control the degree to which the camera movement is mapped to this Container.
Please be aware that scroll factor values other than 1 are not taken in to consideration when calculating physics collisions. Bodies always collide based on their world position, but changing the scroll factor is a visual adjustment to where the textures are rendered, which can offset them from physics bodies if not accounted for in your code.
The vertical scroll factor of this Container.
The scroll factor controls the influence of the movement of a Camera upon this Container.
When a camera scrolls it will change the location at which this Container is rendered on-screen. It does not change the Containers actual position values.
For a Container, setting this value will only update the Container itself, not its children.
If you wish to change the scrollFactor of the children as well, use the setScrollFactor method.
A value of 1 means it will move exactly in sync with a camera. A value of 0 means it will not move at all, even if the camera moves. Other values control the degree to which the camera movement is mapped to this Container.
Please be aware that scroll factor values other than 1 are not taken in to consideration when calculating physics collisions. Bodies always collide based on their world position, but changing the scroll factor is a visual adjustment to where the textures are rendered, which can offset them from physics bodies if not accounted for in your code.
PrivateshinyThe current state of this Game Object.
Phaser itself will never modify this value, although plugins may do so.
Use this property to track the state of a Game Object during its lifetime. For example, it could change from a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons. If you need to store complex data about your Game Object, look at using the Data Component instead.
This Pokemon's current non-volatile status condition,
or null if none exist.
The set of Types that have been boosted by this Pokémon's Stellar Terastallization.
Data that resets on switch or battle end (stat stages, battler tags, etc.)
Indicates whether this Pokémon has left or is about to leave the field
The Tab Index of the Game Object. Reserved for future use by plugins and the Input Manager.
The type this Pokémon turns into when Terastallized
Per-turn data like hit count & flinch tracking
A textual representation of this Game Object, i.e. sprite.
Used internally by Phaser but is available for your own custom classes to populate.
The set of all TMs that have been used on this Pokémon
The current vertex rounding mode of this Game Object. This is used by the WebGL Renderer to determine how to round the vertex positions. It can have several values:
off - No rounding is applied.safe - Rounding is applied if the object is 'safe'.safeAuto - Rounding is applied if the object is 'safe' and the camera has roundPixels enabled.full - Rounding is always applied.fullAuto - Rounding is always applied if the camera has roundPixels enabled.A 'safe' object is one that is not rotated or scaled by any transform matrix while rendering. The effective transform is a simple translation. In such cases, rounding will affect all vertices the same way.
Using full rounding can cause vertices to wobble, because they might not be aligned to the pixel grid. Full rounding gives a janky look like PS1 games.
You can use other values if you want to create your own custom rounding modes.
The visible state of the Game Object.
An invisible Game Object will skip rendering, but will still process update logic.
The w position of this Game Object.
Wave data correponding to moves/ability information revealed
The native (un-scaled) width of this Game Object.
Changing this value will not change the size that the Game Object is rendered in-game.
For that you need to either set the scale of the Game Object (setScale) or use
the displayWidth property.
The x position of this Game Object.
The y position of this Game Object.
The z position of this Game Object.
Note: The z position does not control the rendering order of 2D Game Objects. Use Phaser.GameObjects.Components.Depth#depth instead.
Static ReadonlyRENDER_The bitmask that GameObject.renderFlags is compared against to determine if the Game Object will render or not.
The amount of EXP the Pokemon has earned within its current level
Adds the given Game Object, or array of Game Objects, to this Container.
Each Game Object must be unique within the Container.
If you try to add a Layer, it will throw an error.
This Container instance.
Adds the given Game Object, or array of Game Objects, to this Container at the specified position.
Existing Game Objects in the Container are shifted up.
Each Game Object must be unique within the Container.
This Container instance.
This callback is invoked when this Game Object is added to a Scene.
Can be overridden by custom Game Objects, but be aware of some Game Objects that will use this, such as Sprites, to add themselves into the Update List.
You can also listen for the ADDED_TO_SCENE event from this Game Object.
Add a listener for a given event.
The event name.
The listener function.
Optionalcontext: any
The context to invoke the listener with. Default this.
this.
Adds a render step function to this Game Object's WebGL render pipeline.
The first render step in _renderSteps is run first.
It should call the next render step in the list.
This allows render steps to control the rendering flow.
The render step function to add.
Optionalindex: number
The index in the render list to add the step to. Omit to add to the end.
This Game Object instance.
Add a new BattlerTag of the specified tagType
The type of tag to add
The number of turns the tag should last; default 0
OptionalsourceMove: MoveId
The id of the move that causing the tag to be added, if caused by a move
OptionalsourceId: number
The id of the pokemon causing the tag to be added, if caused by a Pokémon
Whether the tag was successfully added
Adds this Game Object to the given Display List.
If no Display List is specified, it will default to the Display List owned by the Scene to which this Game Object belongs.
A Game Object can only exist on one Display List at any given time, but may move freely between them.
If this Game Object is already on another Display List when this method is called, it will first be removed from it, before being added to the new list.
You can query which list it is on by looking at the Phaser.GameObjects.GameObject#displayList property.
If a Game Object isn't on any display list, it will not be rendered. If you just wish to temporarily
disable it from rendering, consider using the setVisible method, instead.
OptionaldisplayList: DisplayList | Layer
The Display List to add to. Defaults to the Scene Display List.
This Game Object.
Adds this Game Object to the Update List belonging to the Scene.
When a Game Object is added to the Update List it will have its preUpdate method called
every game frame. This method is passed two parameters: time and delta.
If you wish to run your own logic within preUpdate then you should always call
super.preUpdate(time, delta) within it, or it may fail to process required operations,
such as Sprite animations.undefined
This Game Object.
Break the illusion of this pokemon, if it has an active illusion.
Whether an illusion was broken.
Brings the given Game Object to the top of this Container. This will cause it to render on-top of any other objects in the Container.
The Game Object to bring to the top of the Container.
This Container instance.
Check whether a battler tag can be added to this Pokémon
The tag to check
Check whether this Pokémon can apply its current ability
Whether to check the passive (true) or non-passive (false) ability; default false
Whether the ability can be applied
This should rarely be
directly called, as hasAbility and hasAbilityWithAttr already call this.
Check if a status effect can be applied to this Pokemon.
The StatusEffect whose applicability is being checked
Whether to suppress in-battle messages for status checks; default false
Whether to allow overriding the Pokemon's current status with a different one; default false
The Pokemon applying the status effect to the target,
or null if the status is applied from a non-Pokemon source (hazards, etc.); default null
Whether to ignore field effects (weather, terrain, etc.) preventing status application;
default false
Whether effect can be applied to this Pokemon.
Change this Pokémon's form to the specified form, loading the required assets and updating its stats and info display.
The form to change to
A Promise that resolves once the form change has completed.
Helper function to check if the player already owns the starter data of this Pokémon's current ability
The owned abilityAttr of this Pokemon's root form
true if the player already has it, false otherwise
PrivatecheckSub-method of getAttackTypeEffectiveness that handles nullifying type immunities.
The Pokemon using the move
Whether the type immunity was bypassed
Clears the alpha value associated with this Game Object.
Immediately sets the alpha back to 1 (fully opaque).undefined
This Game Object instance.
Remove the fusion species from this Pokémon
Clears the mask that this Game Object was using.
This only works in the Canvas Renderer. In WebGL, use a Mask filter instead (see Phaser.GameObjects.Components.FilterList#addMask).
OptionaldestroyMask: boolean
Destroy the mask before clearing it? Default false.
This Game Object instance.
Perform the action of clearing a Pokemon's status
Whether to also clear this Pokémon's confusion
Whether to reload this pokemon's assets
This is a helper to resetStatus, which should be called directly instead of this method
Copies an object's coordinates to this Game Object's position.
An object with numeric 'x', 'y', 'z', or 'w' properties. Undefined values are not copied.
This Game Object instance.
Returns the total number of Game Objects in this Container that have a property matching the given value.
For example: count('visible', true) would count all the elements that have their visible property set.
You can optionally limit the operation to the startIndex - endIndex range.
The property to check.
The value to check.
OptionalstartIndex: number
An optional start index to search from. Default 0.
OptionalendIndex: number
An optional end index to search up to (but not included) Default Container.length.
The total number of Game Objects in this Container with a property matching the given value.
Creates and returns a Geometry Mask. This mask can be used by any Game Object, including this one.
To create the mask you need to pass in a reference to a Graphics Game Object.
If you do not provide a graphics object, and this Game Object is an instance of a Graphics object, then it will use itself to create the mask.
This means you can call this method to create a Geometry Mask from any Graphics Game Object.
This only works in the Canvas Renderer. In WebGL, use a Mask filter instead (see Phaser.GameObjects.Components.FilterList#addMask).
This Geometry Mask that was created.
Play this Pokémon's cry sound
OptionalsoundConfig: SoundConfig
Optional sound configuration to apply to the cry
OptionalsceneOverride: BattleScene
Optional scene to use instead of the global scene
Helper function for the Move phase that queues the status cure message, resets it, and updates the info display.
The effect to cure. If this does not match the current status, nothing happens.
If provided, will override the default message displayed when removing status. Used for moves that thaw the user out
Submethod called by damageAndUpdate to apply damage to this Pokemon and adjust its HP.
The damage to deal
(Default false) Whether to ignore boss segments
(Default false) Whether to allow the damage to bypass an Endure/Sturdy effect
(Default false) Whether to ignore adding a FaintPhase if this damage causes a faint
The actual damage dealt
Given the damage, adds a new DamagePhase and update HP values, etc.
The damage to inflict on this Pokémon
OptionalignoreFaintPhase?: booleanWhether to ignore adding a FaintPhase if this damage causes a faint; default false
OptionalignoreSegments?: booleanWhether to ignore boss segments
OptionalisCritical?: booleanWhether the attack was a critical hit
Optionalresult?: DamageResultAn enum if it's super effective, not very effective, etc; default HitResult.EFFECTIVE
Optionalsource?: PokemonThe Pokémon inflicting the damage, or undefined if not caused by a Pokémon
Amount of damage actually done
Checks for Indirect hits to account for Endure/Reviver Seed applying correctly
Phaser.GameObjects.Container#destroy
In addition to the base destroy behavior, this also destroys the Pokemon's
battleInfo and substitute sprite (as applicable).
If this Pokemon has a Substitute on the field, removes its sprite from the field.
If this Game Object has previously been enabled for input, this will disable it.
An object that is disabled for input stops processing or being considered for
input events, but can be turned back on again at any time by simply calling
setInteractive() with no arguments provided.
If want to completely remove interaction from this Game Object then use removeInteractive instead.
OptionalresetCursor: boolean
Should the currently active Input cursor, if any, be reset to the default cursor? Default false.
This GameObject.
Set this Pokemon's non-volatile status condition to the specified effect.
Clears this pokemon's pendingStatus in its turnData.
⚠️ This method does not check for feasibility; that is the responsibility of the caller.
Set this Pokemon's non-volatile status condition to the specified effect.
OptionalsleepTurnsRemaining: number
(Optional) The number of turns to inflict sleep for (the actual number of sleep turns is 1 less than the input value).
If not specified, defaults to 1/3 chance of 1 turn of sleep, 2/3 chance of 2 turns of sleep.
Clears this pokemon's pendingStatus in its Pokemon#turnData.
⚠️ This method does not check for feasibility; that is the responsibility of the caller.
Set this Pokemon's non-volatile status condition to the specified effect.
The StatusEffect to set
OptionalsleepTurnsRemaining: number
(Optional) The number of turns to inflict sleep for (the actual number of sleep turns is 1 less than the input value).
If not specified, defaults to 1/3 chance of 1 turn of sleep, 2/3 chance of 2 turns of sleep.
Has no effect if the status effect being inflicted is not sleep.
Clears this pokemon's pendingStatus in its Pokemon#turnData.
⚠️ This method does not check for feasibility; that is the responsibility of the caller.
Passes all Game Objects in this Container to the given callback.
A copy of the Container is made before passing each entry to your callback. This protects against the callback itself modifying the Container.
If you know for sure that the callback will not change the size of this Container
then you can use the more performant Container.iterate method instead.
The function to call.
Optionalcontext: object
Value to use as this when executing callback.
Additional arguments that will be passed to the callback, after the child.
This Container instance.
Calls each of the listeners registered for a given event.
The event name.
Additional arguments that will be passed to the event handler.
true if the event had listeners, else false.
Enable this Game Object to have filters.
You need to call this method if you want to use the filterCamera
and filters properties. It sets up the necessary data structures.
You may disable filter rendering with the renderFilters property.
This is a WebGL only feature. It will return early if not available.undefined
undefined
Return an array listing the events for which the emitter has registered listeners.undefined
undefined
Returns true if the given Game Object is a direct child of this Container.
This check does not scan nested Containers.
The Game Object to check for within this Container.
True if the Game Object is an immediate child of this Container, otherwise false.
Play this Pokémon's faint cry, pausing its animation until the cry is finished.
A function to be called once the cry has finished playing
Gracefully handle errors loading a variant sprite. Log if it fails and attempt to fall back on non-experimental sprites before giving up.
The cache key for the variant color sprite
The sprite path that failed to load
Whether the attempted sprite was experimental
The filename of the sprite
Any additional params to log
Perform miscellaneous setup for when the Pokemon is summoned, like generating the substitute sprite
OptionalresetSummonData: boolean
Whether to additionally reset the Pokemon's summon data (default: false)
Find and remove all BattlerTags matching the given function and
invoke their onRemove methods.
A function dictating which tags to remove
Removes all matching tags; to remove only the first matching tag, use
removeTag instead.
Find the first BattlerTag matching the specified predicate
The predicate to match against
The first matching tag, or undefined if none match
Find the first BattlerTag matching the specified predicate
The predicate to match against
The first matching tag, or undefined if none match
Return the list of BattlerTags that satisfy the given predicate
The predicate to match against
The filtered list of tags
Return the list of BattlerTags that satisfy the given predicate
The predicate to match against
The filtered list of tags
Focus the filter camera.
This sets the size and position of the filter camera to match the GameObject.
This is called automatically on render if filtersAutoFocus is enabled.
This will focus on the GameObject's raw dimensions if available. If the GameObject has no dimensions, this will focus on the context: the camera belonging to the DrawingContext used to render the GameObject. Context focus occurs during rendering, as the context is not known until then.undefined
undefined
Focus the filter camera on a specific camera.
This is used internally when filtersFocusContext is enabled.
The camera to focus on.
undefined
Manually override the focus of the filter camera.
This allows you to set the size and position of the filter camera manually.
It deactivates filtersAutoFocus when called.
The camera will set scroll to place the game object at the
given position within a rectangle of the given width and height.
For example, calling focusFiltersOverride(400, 200, 800, 600)
will focus the camera to place the object's center
100 pixels above the center of the camera (which is at 400x300).
Optionalx: number
The x-coordinate of the focus point, relative to the filter size. Default is the center.
Optionaly: number
The y-coordinate of the focus point, relative to the filter size. Default is the center.
Optionalwidth: number
The width of the focus area. Default is the filter width.
Optionalheight: number
The height of the focus area. Default is the filter height.
undefined
PrivatefusionPlay this Pokémon's fusion faint cry, which is a mixture of the faint cries for both of its species
A function to be called once the cry has finished playing
PrivategenerateGenerate abilityIndex based on species and hidden ability if not pre-defined.
Generate a semi-random moveset for this Pokémon
(default false) Sets moveset gen to use rival signature pool (FORCED_RIVAL_SIGNATURE_MOVES)
Generate a fusion species and add it to this Pokémon
OptionalforStarter: boolean
Whether this fusion is being generated for a starter Pokémon; default false
Sets the Pokemon's name. Only called when loading a Pokemon so this function needs to be called when initializing hardcoded Pokemon or else it will not display the form index name properly.
PrivategenerateRandomly generate and set this Pokémon's nature
OptionalnaturePool: Nature[]
An optional array of Natures to choose from. If not provided, all natures will be considered.
ProtectedgenerateGet this Pokemon's non-passive Ability, factoring in fusions, overrides and ability-changing effects.
Should rarely be called directly in favor of hasAbility or hasAbilityWithAttr,
both of which check both ability slots and account for suppression.
Whether to ignore any overrides caused by Transform; default false
The non-passive Ability of this Pokemon.
hasAbility and hasAbilityWithAttr are the intended ways to check abilities in most cases
Gets a list of all instances of a given ability attribute among abilities this pokemon has. Accounts for all the various effects which can affect whether an ability will be present or in effect, and both passive and non-passive.
AbAttr The ability attribute to check for.
Whether to check if the ability is currently active; Default true
Whether to ignore ability changing effects; Default false
An array of all the ability attributes on this ability.
Return the ability priorities of the pokemon's ability and, if enabled, its passive ability
A tuple containing the ability priorities of the pokemon
Calculates the accuracy multiplier of the user against a target.
This method considers various factors such as the user's accuracy level, the target's evasion level, abilities, and modifiers to compute the final accuracy multiplier.
The calculated accuracy multiplier.
Returns all Game Objects in this Container.
You can optionally specify a matching criteria using the property and value arguments.
For example: getAll('body') would return only Game Objects that have a body property.
You can also specify a value to compare the property to:
getAll('visible', true) would return only Game Objects that have their visible property set to true.
Optionally you can specify a start and end index. For example if this Container had 100 Game Objects,
and you set startIndex to 0 and endIndex to 50, it would return matches from only
the first 50 Game Objects.
Optionalproperty: string
The property to test on each Game Object in the Container.
Optionalvalue: any
If property is set then the property must strictly equal this value to be included in the results.
OptionalstartIndex: number
An optional start index to search from. Default 0.
OptionalendIndex: number
An optional end index to search up to (but not included) Default Container.length.
An array of matching Game Objects from this Container.
Returns the Game Object at the given position in this Container.
The position to get the Game Object from.
The Game Object at the specified index, or null if none found.
Calculates the damage of an attack made by another Pokemon against this Pokemon
Type for the parameters of Pokemon.getAttackDamage
Optionaleffectiveness?: numberIf defined, used in place of calculated effectiveness values
OptionalignoreAbility?: booleanIf true, ignores this Pokemon's defensive ability effects
OptionalignoreAllyAbility?: booleanIf true, ignores the ally Pokemon's ability effects
OptionalignoreSourceAbility?: booleanIf true, ignores the attacking Pokemon's ability effects
OptionalignoreSourceAllyAbility?: booleanIf true, ignores the ability effects of the attacking pokemon's ally
OptionalisCritical?: booleanIf true, calculates damage for a critical hit
The move used in the attack
Optionalsimulated?: booleanIf true, suppresses changes to game state during the calculation
The attacking Pokemon
Calculate the type effectiveness multiplier of a Move used against this Pokemon.
The PokemonType of the move being used
Parameters used to modify the type effectiveness
The computed type effectiveness multiplier.
Calculates the base damage of the given move against this Pokemon when attacked by the given source.
Used during damage calculation and for Shell Side Arm's forecasting effect.
Type for the parameters of Pokemon.getBaseDamage
OptionalignoreAbility?: booleanIf true, ignores this Pokemon's defensive ability effects
OptionalignoreAllyAbility?: booleanIf true, ignores the ally Pokemon's ability effects
OptionalignoreSourceAbility?: booleanIf true, ignores the attacking Pokemon's ability effects
OptionalignoreSourceAllyAbility?: booleanIf true, ignores the ability effects of the attacking pokemon's ally
OptionalisCritical?: booleanIf true, calculates damage for a critical hit
The move used in the attack
The move's MoveCategory after variable-category effects are applied
Optionalsimulated?: booleanIf true, suppresses changes to game state during the calculation
The attacking Pokemon
The move's base damage against this Pokemon when used by the source Pokemon.
PrivategetHelper to getTypes that handles computing a Pokemon's normal typing.
Return the base pokemon's variant. Equivalent to getVariant if this pokemon is not a fusion.
Whether to consider an active illusion; default false
The shiny variant of this Pokemon's base species.
AbstractgetOptionalback: booleanOptionalignoreOverride: booleanOptionalback: booleanOptionalignoreOverride: booleanOptionalback: booleanOptionalignoreOverride: booleanGets the bounds of this Container. It works by iterating all children of the Container, getting their respective bounds, and then working out a min-max rectangle from that. It does not factor in if the children render or not, all are included.
Some children are unable to return their bounds, such as Graphics objects, in which case they are skipped.
Depending on the quantity of children in this Container it could be a really expensive call, so cache it and only poll it as needed.
The values are stored and returned in a Rectangle object.
Optionaloutput: Rectangle
A Geom.Rectangle object to store the values in. If not provided a new Rectangle will be created.
The values stored in the output object.
Returns the world transform matrix as used for Bounds checks.
The returned matrix is temporary and shouldn't be stored.undefined
The world transform matrix.
Searches for the first instance of a child with its name property matching the given argument.
Should more than one child have the same name only the first is returned.
The name to search for.
The first child with a matching name, or null if none were found.
Retrieves the value for the given key in this Game Objects Data Manager, or undefined if it doesn't exist.
You can also access values via the values object. For example, if you had a key called gold you can do either:
sprite.getData('gold');
Or access the value directly:
sprite.data.values.gold;
You can also pass in an array of keys, in which case an array of values will be returned:
sprite.getData([ 'gold', 'armor', 'health' ]);
This approach is useful for destructuring arrays in ES6.
The key of the value to retrieve, or an array of keys.
The value belonging to the given key, or an array of values, the order of which will match the input array.
Returns a reference to the underlying display list array that contains this Game Object, which will be either the Scene's Display List or the internal list belonging to its parent Container, if it has one.
If this Game Object is not on a display list or in a container, it will return null.
You should be very careful with this method, and understand that it returns a direct reference to the internal array used by the Display List. Mutating this array directly can cause all kinds of subtle and difficult to debug issues in your game.undefined
The internal Display List array of Game Objects, or null.
Calculates and retrieves the final value of a stat considering any held items, move effects, opponent abilities, and whether there was a critical hit.
The desired stat to check
Parameters for Pokemon#getEffectiveStat
OptionalforDefend?: booleanWhether the stat is being calculated as though the move is being used against this Pokémon.
OptionalignoreAbility?: booleanWhether to ignore the user's ability during the calculation
OptionalignoreAllyAbility?: booleanWhether to ignore the ability of the opponent's ally
For example, the effects of the ally's Flower Gift ability
OptionalignoreHeldItems?: booleanWhether to ignore this pokemon's held items
OptionalignoreOppAbility?: booleanWhether to ignore the opponent's ability during the calculation
OptionalisCritical?: booleanWhether the move being used will land as a critical hit
Optionalmove?: MoveThe move being used in the interaction
Optionalopponent?: PokemonThe other pokemon in the interaction
Optionalsimulated?: booleanWhether to suppress changes to game state
The final in-battle value for the given stat.
A list of this Pokemon's possible egg moves
Get the first evolution this Pokémon meets the conditions to evolve into
The evolution this pokemon can currently evolve into, or null if it cannot evolve
AbstractgetGets the first Game Object in this Container.
You can also specify a property and value to search for, in which case it will return the first Game Object in this Container with a matching property and / or value.
For example: getFirst('visible', true) would return the first Game Object that had its visible property set.
You can limit the search to the startIndex - endIndex range.
The property to test on each Game Object in the Container.
The value to test the property against. Must pass a strict (===) comparison check.
OptionalstartIndex: number
An optional start index to search from. Default 0.
OptionalendIndex: number
An optional end index to search up to (but not included) Default Container.length.
The first matching Game Object, or null if none was found.
Optionalback: booleanOptionalignoreOverride: booleanOptionalback: booleanOptionalignoreOverride: booleanOptionalback: booleanOptionalignoreOverride: booleanOptionalignoreOverride: booleanReturn the SpeciesForm of this Pokemon's fusion counterpart.
Whether to ignore species overrides caused by Transform; default false
Whether to consider the species of this Pokemon's illusion; default false
The PokemonSpeciesForm of this Pokemon's fusion counterpart.
OptionalignoreOverride: booleanGet the shiny variant of this Pokémon's fusion species
Whether to consider an active illusion
The shiny variant of this pokemon's fusion species.
Return the ratio of this Pokémon's current HP to its maximum HP
Whether to return the exact HP ratio (e.g. 0.54321), or one rounded to the nearest %; default false
The current HP ratio
OptionalignoreOverride: booleanReturns the index of the given Game Object in this Container.
The Game Object to search for in this Container.
The index of the Game Object in this Container, or -1 if not found.
Returns an array containing the display list index of either this Game Object, or if it has one, its parent Container. It then iterates up through all of the parent containers until it hits the root of the display list (which is index 0 in the returned array).
Used internally by the InputPlugin but also useful if you wish to find out the display depth of this Game Object and all of its ancestors.undefined
An array of display list position indexes.
Returns the amount of hp currently missing from this Pokemon (max - current)
Return the most recently executed TurnMove this Pokemon has used that is:
MoveId.NONEuseMode < MoveUseMode.INDIRECT)Whether to additionally ignore MoveId.STRUGGLE; default false
Whether to ignore moves with a use type of MoveUseMode.FOLLOW_UP
(e.g. ones called by Copycat/Mirror Move); default true.
The last move this Pokemon has used satisfying the aforementioned conditions,
or undefined if no applicable moves have been used since switching in.
Return a list of the most recent move entries in this Pokemon's move history.
The retrieved values are sorted in order from NEWEST to OLDEST.
The maximum number of move entries to retrieve.
If negative, retrieves the Pokemon's entire move history (equivalent to reversing the output of getMoveHistory).
Default is 1.
An array of TurnMoves, as specified above.
Get all possible learnable level moves for the Pokemon,
excluding any moves already known.
Available egg moves are only included if the Pokemon was
in the starting party of the run and if Fresh Start is not active.
A tuple of the Level (or null for non level moves), MoveId and their corresponding LearnableMoveSource, as described above.
Get all level up moves in a given range for a particular pokemon.
(Default this.level) Don't include moves below this level
A list of moves and the levels they can be learned at, along with the source of the move
Takes the given x and y coordinates and converts them into local space for this
Game Object, taking into account parent and local transforms, and the Display Origin.
The returned Vector2 contains the translated point in its properties.
A Camera needs to be provided in order to handle modified scroll factors. If no
camera is specified, it will use the main camera from the Scene to which this
Game Object belongs.
The translated point.
Gets the local transform matrix for this Game Object.
OptionaltempMatrix: TransformMatrix
The matrix to populate with the values from this Game Object.
The populated Transform Matrix.
Return this pokemon's overall luck value, based on its shininess (1 pt per variant lvl).
The luck value of this Pokemon.
Compute the given Pokémon's matchup score against this Pokémon
The Pokemon to compare this Pokémon against
A score value based on how favorable this Pokémon is when fighting the given Pokémon
Calculates the category of a move when used by this pokemon after category-changing move effects are applied.
The given move's final category
Calculate the effectiveness of the move against this Pokémon, including modifiers from move and ability attributes
The attacking Pokémon.
The move being used by the attacking Pokémon.
Whether to ignore abilities that might affect type effectiveness or immunity; default false
(Default true) Whether to apply abilities via simulated calls.
⚠️ Should only ever be false during MoveEffectPhase
Optionalcancelled: BooleanHolder<boolean>
Stores whether the move was cancelled by a non-type-based immunity.
Whether to consider an active illusion
The type damage multiplier, indicating the effectiveness of the move
Return all the PokemonMoves that make up this Pokemon's moveset.
Whether to ignore any overrides caused by Transform; default false
An array of PokemonMove, as described above.
Calculates the type of a move when used by this Pokemon after type-changing move and ability attributes have applied.
The PokemonType of the move after attributes are applied
Return the type of a move, considering abilities, when used by this Pokémon for the purposes of spawning items.
The move being used
An array of PokemonTypes that the move is considered to be for item spawning purposes.
This method should not be used if the move has the VariableMoveTypeAttr attribute.
Return this Pokemon's name.
Whether to consider an active illusion; default false
This Pokemon's name.
getNameToRender - gets this Pokemon's display name.
Return the name that will be displayed when this Pokemon is sent out into battle.
(Default true) Whether to consider this Pokemon's illusion if present
The name to render for this Pokemon.
Returns the pokemon that oppose this one and are active in non-speed order
whether to also check if the pokemon is currently on the field (defaults to true)
Gets the sum total rotation of all of this Game Object's parent Containers.
The returned value is in radians and will be zero if this Game Object has no parent container.undefined
The sum total rotation, in radians, of all parent containers of this Game Object.
Gets the passive ability of the pokemon.
The passive Ability of the pokemon
This should rarely be called, most of the time
hasAbility or hasAbilityWithAttr are better used
as those check both the passive and non-passive abilities and account for ability suppression.
Get the number of persistent treasure items this Pokemon has
The number of persistent treasure items this Pokémon has
Return this Pokemon's PokeballType.
Whether to consider this Pokemon's illusion if present; default false
The PokeballType that will be shown when this Pokemon is sent out into battle.
Returns a random Game Object from this Container.
OptionalstartIndex: number
An optional start index. Default 0.
Optionallength: number
An optional length, the total number of elements (from the startIndex) to choose from.
A random child from the Container, or null if the Container is empty.
PrivategetGet the MoveRestrictionBattlerTag that is restricting this Pokemon's move usage, if one exists.
The ID of the move to check
The first tag on this Pokemon that restricts the move, or undefined if the move is not restricted.
Does not consider target-based restrictions from Heal Block, which is done by getTargetRestrictingTag.
Return this Pokemon's SpeciesForm.
Whether to ignore any overrides caused by Transform; default false
and overrides useIllusion.
Whether to consider this Pokemon's illusion if present; default false.
This Pokemon's PokemonSpeciesForm.
OptionalignoreOverride: booleanOptionalignoreOverride: booleanRetrieves the corresponding PermanentStat of the Pokemon.
The numeric value of the desired Stat.
Calculate the stat stage multiplier of the user against an opponent
The EffectiveStat to calculate
Optionalopponent: Pokemon
The Pokemon being targeted
Optionalmove: Move
The Move being used
determines whether the effects of the opponent's abilities (i.e. Unaware) should be ignored; default false
determines whether a critical hit has occurred or not; default false
determines whether effects are applied without altering game state; default true
determines whether this Pokemon's held items should be ignored during the stat calculation; default false
the stat stage multiplier to be used for effective stat calculation
Returns the Pokemon's offset from its current field position in the event that
it has a Substitute doll in effect. The offset is returned in [ x, y ] format.
Return the BattlerTag preventing this Pokemon from using a move against the given target.
The first BattlerTag preventing this Pokemon from using moveId against target (if one exists).
This Pokemon's current Tera type, accounting for species-based restrictions
PrivategetHelper function to calculateStabMultiplier that handles computing boosts from a Pokemon being Terastallized.
This Pokemon's Tera Type
The type of the Move being used
Whether the move type matches this Pokemon's base type
The additional STAB bonus this Pokemon receives from terastallization.
Evaluate and return this Pokemon's typing.
(Default true) Whether to use this Pokemon's Tera type if Terastallized
A non-empty array of PokemonTypes corresponding to this Pokemon's typing (real or perceived).
PrivategetReturn this Pokemon's shiny variant. If a fusion, returns the maximum of the two variants. Only meaningful if this pokemon is actually shiny.
Whether to consider an active illusion; default false
The shiny variant of this Pokemon.
Gets the weight of the Pokemon with subtractive modifiers (Autotomize) happening first and then multiplicative modifiers happening after (Heavy Metal and Light Metal)
the kg of the Pokemon (minimum of 0.1)
Gets the world position of this Game Object, factoring in any parent Containers.
Optionalpoint: Vector2
A Vector2, or point-like object, to store the result in.
OptionaltempMatrix: TransformMatrix
A temporary matrix to hold the Game Object's values.
OptionalparentMatrix: TransformMatrix
A temporary matrix to hold parent values.
The world position of this Game Object.
Gets the world transform matrix for this Game Object, factoring in any parent Containers.
OptionaltempMatrix: TransformMatrix
The matrix to populate with the values from this Game Object.
OptionalparentMatrix: TransformMatrix
A temporary matrix to hold parent values during the calculations.
The populated Transform Matrix.
Check whether a pokemon has the specified ability in effect, either as a normal or passive ability. Accounts for all the various effects which can disable or modify abilities.
Whether this Pokemon has the given ability
Check whether this pokemon has an ability with the specified attribute in effect, either as a normal or passive ability. Accounts for all the various effects which can disable or modify abilities.
The AbAttr | attribute to check for
Whether to check if the ability is currently active; default true
Whether to ignore any overrides caused by Transform; default false
Whether this Pokemon has an ability with the given AbAttr.
Checks if a pokemon has a passive either from:
true if the Pokemon has a passive
Get whether the given move is currently disabled for this Pokémon by a move restriction tag.
The ID of the move to check
true if the move is disabled for this Pokemon, otherwise false
PrivatehasCheck whether or not this Pokémon's root form has the same ability
The ability index to check
Whether the Pokemon's root form has the same ability
AbstracthasRestore a specific amount of HP to this Pokémon
The amount of HP to restore
The true amount of HP restored; may be less than amount if amount would overheal
Hide this Pokémon's info panel
Increase a value for the given key within this Game Object's Data Manager. If the key doesn't already exist in the Data Manager then it is created with a value of 0 before being increased.
If the Game Object has not been enabled for data (via setDataEnabled) then it will be enabled
before setting the value.
If the key doesn't already exist in the Data Manager then it is created.
When the value is first set, a setdata event is emitted from this Game Object.
The key to change the value for.
Optionalamount: number
The amount to increase the given key by. Pass a negative value to decrease the key. Default 1.
This GameObject.
AbstractinitChecks if this Pokemon is allowed in battle (ie: not fainted, and allowed under any active challenges).
Whether to also check if the pokemon is currently on the field; default false
Whether this pokemon is considered "active", as described above.
Returns false if there is no active BattleScene or the pokemon is disallowed.
Check if this pokemon is both not fainted and allowed to be used based on currently active challenges.
Whether this Pokemon is allowed to partake in battle.
Check if this pokemon is allowed based on any active challenges.
Usually should not be called directly in favor of consulting ().
Whether this Pokemon is allowed under the current challenge conditions.
Get whether this Pokémon's base species is shiny
Whether to consider an active illusion; default false
Whether the pokemon is shiny
AbstractisCheck whether this Pokemon is doubly shiny (both normal and fusion are shiny).
Whether to consider an active illusion; default false
Whether this pokemon's base and fusion counterparts are both shiny.
AbstractisChecks if a pokemon is fainted (ie: its hp <= 0).
Usually should not be called directly in favor of calling ().
Whether to also check that the pokemon's status is StatusEffect.FAINT; default false
Whether this Pokemon is fainted, as described above.
PrivateisPrivateisReturn whether this Pokemon is currently fused with anything.
Whether to consider an active illusion; default false
Whether this Pokemon is currently fused with another species.
Get whether this Pokémon's fusion species is shiny
Whether to consider an active illusion; default true
Whether this Pokémon's fusion species is shiny, or false if there is no fusion
Return whether this Pokemon is currently on the ground.
(Default false) Whether to ignore the target's semi-invulnerable state when determining groundedness
(Default false) Whether to use this Pokemon's illusion for typing-related calculations
Whether this Pokemon is currently grounded, as described above.
To be considered grounded, a Pokemon must either:
forcibly grounded from an effect like Smack Down or Ingrainharsh gravityMagnet Rise or
TelekinesisSemi-invulnerable with ignoreSemiInvulnerable set to falseFlying-typeUngrounded from an unsuppressed Levitate/Eelevate ability(Default this.getFormKey()) The form key to check
Whether this Pokémon is in a Dynamax or Gigantamax form
(Default this.getFormKey()) The form key to check
Whether this Pokémon is in a Mega or Primal form
Determine whether the given move is selectable by this Pokemon.
The MoveId to check
A tuple containing whether the move can be selected and the text to display if it cannot
Returns whether or not the Pokemon's position on the field is offset because the Pokemon has a Substitute active.
Check if this Pokemon's typing includes the specified type.
The PokemonType to check
(Default true) Whether to use this Pokemon's tera type if Terastallized
Whether this Pokemon is of the specified type.
Check the specified pokemon is considered to be the opposite gender as this pokemon
The Pokémon to compare against
Whether the pokemon are considered to be opposite genders
AbstractisCheck if this Pokémon is protected by Safeguard
The Pokémon responsible for the interaction that needs to check against Safeguard
Whether this Pokémon is protected by Safeguard
Getter function that returns whether this Pokemon is currently transformed into another one
(such as by the effects of MoveId.TRANSFORM or AbilityId.IMPOSTER.
Whether this Pokemon is currently transformed.
Determines whether this Pokemon is prevented from running or switching due to effects from moves and/or abilities.
If defined, ability trigger messages (e.g. from Shadow Tag) are forwarded through this array.
If true, applies abilities via simulated calls.
true if the pokemon is trapped
Passes all Game Objects in this Container to the given callback.
Only use this method when you absolutely know that the Container will not be modified during the iteration, i.e. by removing or adding to its contents.
The function to call.
Optionalcontext: object
Value to use as this when executing callback.
Additional arguments that will be passed to the callback, after the child.
This Container instance.
Lapse the first BattlerTag matching tagType
The BattlerTagType to search for
The lapse type to use for the lapse method; defaults to BattlerTagLapseType.CUSTOM
Whether a tag matching the given type was found
Tick down all BattlerTags that lapse on the provided
lapseType, removing any whose durations fall below 0.
The type of lapse to process
Causes a Pokemon to leave the field (such as in preparation for a switch out/escape).
Whether effects should be cleared, or passed to the next pokemon (e.g. due to Baton Pass)
Indicates if this should also play the animation to hide the Pokemon's info container
Return the number of listeners listening to a given event.
The event name.
The number of listeners.
Return the listeners registered for a given event.
The event name.
The registered listeners.
Load all assets needed for this Pokemon's use in battle
Whether to ignore overrides caused by Transform; default true
Whether to consider this pokemon's active illusion; default false
A promise that resolves once all the corresponding assets have been loaded.
Reduces one of this Pokemon's held item stacks by 1, removing it if applicable. Does nothing if this Pokemon is somehow not the owner of the held item.
The item stack to be reduced.
Whether to trigger in-battle effects (such as Unburden) after losing the item. Default: true
Should be false for all item loss occurring outside of battle (MEs, etc.).
Whether the item was removed successfully.
Moves a Game Object above another one within this Container. If the Game Object is already above the other, it isn't moved.
These 2 Game Objects must already be children of this Container.
This Container instance.
Moves a Game Object below another one within this Container. If the Game Object is already below the other, it isn't moved.
These 2 Game Objects must already be children of this Container.
This Container instance.
Moves the given Game Object down one place in this Container, unless it's already at the bottom.
The Game Object to be moved in the Container.
This Container instance.
Moves a Game Object to a new position within this Container.
The Game Object must already be a child of this Container.
The Game Object is removed from its old position and inserted into the new one. Therefore the Container size does not change. Other children will change position accordingly.
The Game Object to move.
The new position of the Game Object in this Container.
This Container instance.
Moves the given Game Object up one place in this Container, unless it's already at the top.
The Game Object to be moved in the Container.
This Container instance.
Remove the listeners of a given event.
The event name.
Optionalfn: Function
Only remove the listeners that match this function.
Optionalcontext: any
Only remove the listeners that have this context.
Optionalonce: boolean
Only remove one-time listeners.
this.
Add a listener for a given event.
The event name.
The listener function.
Optionalcontext: any
The context to invoke the listener with. Default this.
this.
Add a one-time listener for a given event. The listener is automatically removed the first time the event is emitted, so it will never be called more than once.
The event name.
The listener function.
Optionalcontext: any
The context to invoke the listener with. Default this.
this.
ProtectedonInternal handler, called when a child is destroyed.
Takes a Point-like object, such as a Vector2, or object with public x and y properties, and transforms it into the space of this Container, then returns it in the output object.
The Source Point to be transformed.
Optionaloutput: Vector2Like
A destination object to store the transformed point in. If none given a Vector2 will be created and returned.
The transformed point.
Attempt to process variant sprite color caches.
the cache key for the variant color sprite
Whether experimental sprites should be used if present
the filename of the sprite
ProtectedpreInternal destroy handler, called as part of the destroy process.
Display an immunity message for a failed status application.
Whether to suppress message and return early
The reason for the status application failure;
can be "overlap" (already has same status), "other" (generic fail message)
or a TerrainType for terrain-based blockages.
Default "other"
Generate a random number using the current battle's seed, or the global seed if globalScene.currentBattle is falsy
How large of a range of random numbers to choose from.
(Default 0) The minimum integer to pick
A random integer between min and min + range - 1
Generate a random number within the specified range
The minimum integer to generate
The maximum integer to generate
A random integer between min and max (inclusive)
Record a berry being eaten for ability and move triggers. Only tracks things that proc every time a berry is eaten.
The type of berry being eaten.
Whether to track the berry for harvest; default true.
Removes the given Game Object, or array of Game Objects, from this Container.
The Game Objects must already be children of this Container.
You can also optionally call destroy on each Game Object that is removed from the Container.
This Container instance.
Removes all Game Objects from this Container.
You can also optionally call destroy on each Game Object that is removed from the Container.
OptionaldestroyChild: boolean
Optionally call destroy on each Game Object successfully removed from this Container. Default false.
This Container instance.
Remove all listeners, or those of the specified event.
Optionalevent: string | symbol
The event name.
this.
Removes the Game Object at the given position in this Container.
You can also optionally call destroy on the Game Object, if one is found.
The index of the Game Object to be removed.
OptionaldestroyChild: boolean
Optionally call destroy on the Game Object if successfully removed from this Container. Default false.
This Container instance.
Removes the Game Objects between the given positions in this Container.
You can also optionally call destroy on each Game Object that is removed from the Container.
OptionalstartIndex: number
An optional start index to search from. Default 0.
OptionalendIndex: number
An optional end index to search up to (but not included) Default Container.length.
OptionaldestroyChild: boolean
Optionally call destroy on each Game Object successfully removed from this Container. Default false.
This Container instance.
This callback is invoked when this Game Object is removed from a Scene.
Can be overridden by custom Game Objects, but be aware of some Game Objects that will use this, such as Sprites, to remove themselves from the Update List.
You can also listen for the REMOVED_FROM_SCENE event from this Game Object.
Removes this Game Object from the Display List it is currently on.
A Game Object can only exist on one Display List at any given time, but may be freely removed and added back at a later stage.
You can query which list it is on by looking at the Phaser.GameObjects.GameObject#displayList property.
If a Game Object isn't on any Display List, it will not be rendered. If you just wish to temporarily
disable it from rendering, consider using the setVisible method, instead.undefined
This Game Object.
Removes this Game Object from the Scene's Update List.
When a Game Object is on the Update List, it will have its preUpdate method called
every game frame. Calling this method will remove it from the list, preventing this.
Removing a Game Object from the Update List will stop most internal functions working. For example, removing a Sprite from the Update List will prevent it from being able to run animations.undefined
This Game Object.
If this Game Object has previously been enabled for input, this will queue it for removal, causing it to no longer be interactive. The removal happens on the next game step, it is not immediate.
The Interactive Object that was assigned to this Game Object will be destroyed, removed from the Input Manager and cleared from this Game Object.
If you wish to re-enable this Game Object at a later date you will need to
re-create its InteractiveObject by calling setInteractive again.
If you wish to only temporarily stop an object from receiving input then use
disableInteractive instead, as that toggles the interactive state, where-as
this erases it completely.
If you wish to resize a hit area, don't remove and then set it as being
interactive. Instead, access the hitarea object directly and resize the shape
being used. I.e.: sprite.input.hitArea.setSize(width, height) (assuming the
shape is a Rectangle, which it is by default.)
OptionalresetCursor: boolean
Should the currently active Input cursor, if any, be reset to the default cursor? Default false.
This GameObject.
Remove the listeners of a given event.
The event name.
Optionalfn: Function
Only remove the listeners that match this function.
Optionalcontext: any
Only remove the listeners that have this context.
Optionalonce: boolean
Only remove one-time listeners.
this.
Remove the first tag matching tagType and invoke its
onRemove method.
The tag type to search for and remove
Only removes the first matching tag, if multiple are present; to remove all
matching tags, use findAndRemoveTags instead.
Remove all tags that were applied by a Pokémon with the given sourceId,
invoking their onRemove methods.
Render this object using filters.
This function's scope is not guaranteed, so it doesn't refer to this.
The WebGL Renderer instance to render with.
The Game Object being rendered.
The current drawing context.
OptionalparentMatrix: TransformMatrix
The parent matrix of the Game Object, if it has one.
OptionalrenderStep: number
The index of this function in the Game Object's list of render processes. Used to support multiple rendering functions. Default 0.
undefined
Run a step in the render process. This is called automatically by the Render module.
In most cases, it just runs the renderWebGL function.
When _renderSteps has more than one entry,
such as when Filters are enabled for this object,
it allows those processes to defer renderWebGL
and otherwise manage the flow of rendering.
The WebGL Renderer instance to render with.
The Game Object being rendered.
The current drawing context.
OptionalparentMatrix: TransformMatrix
The parent matrix of the Game Object, if it has one.
OptionalrenderStep: number
Which step of the rendering process should be run? Default 0.
OptionaldisplayList: GameObject[]
The display list which is currently being rendered. If not provided, it will be created with the Game Object.
OptionaldisplayListIndex: number
The index of the Game Object within the display list. Default 0.
Replaces a Game Object in this Container with the new Game Object. The new Game Object cannot already be a child of this Container.
This Container instance.
Reset this Pokémon's per-battle battleData
as well as any transient waveData for the current wave.
Resets the pokemon's field sprite properties, including position, alpha, and scale
Reset this Pokémon's status
Whether revive should be cured; default true
Whether to also cure confusion; default false
Whether to reload the assets or not; default false
Whether to reset the status in a phase or immediately; default true
Reset this Pokemon's PokemonSummonData and update sprites/UI as necessary.
BattlerTags are stored in PokemonSummonData, and will also all be cleared.
Reset this Pokémon's Terastallization state
End this Pokémon's Terastallization if it is (or is about to be) in a Mega, Primal, Gigantamax, or Eternamax form, as these forms are incompatible with Terastallization.
OptionalformKey: string
The form key to check; default this Pokémon's current form key. Pass the incoming form's key to end Terastallization before the form change is applied.
Clear this Pokémon's transient turn data
Reset this Pokémon's PokemonWaveData.
Mark the Pokémon's ability as revealed.
Reverses the order of all Game Objects in this Container.undefined
This Container instance.
Sends the given Game Object to the bottom of this Container. This will cause it to render below any other objects in the Container.
The Game Object to send to the bottom of the Container.
This Container instance.
Move this Game Object so that it appears above the given Game Object.
This means it will render immediately after the other object in the display list.
Both objects must belong to the same display list, or parent container.
This method does not change this Game Objects depth value, it simply alters its list position.
The Game Object that this Game Object will be moved to be above.
This Game Object instance.
Sets the active property of this Game Object and returns this Game Object for further chaining.
A Game Object with its active property set to true will be updated by the Scenes UpdateList.
True if this Game Object should be set as active, false if not.
This GameObject.
Sets the property to the given value on all Game Objects in this Container.
Optionally you can specify a start and end index. For example if this Container had 100 Game Objects,
and you set startIndex to 0 and endIndex to 50, it would return matches from only
the first 50 Game Objects.
The property that must exist on the Game Object.
The value to set the property to.
OptionalstartIndex: number
An optional start index to search from. Default 0.
OptionalendIndex: number
An optional end index to search up to (but not included) Default Container.length.
This Container instance.
Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque.
Optionalvalue: number
The alpha value applied across the whole Game Object. Default 1.
This Game Object instance.
Sets the angle of this Game Object.
Optionaldegrees: number
The rotation of this Game Object, in degrees. Default 0.
This Game Object instance.
Move this Game Object so that it appears below the given Game Object.
This means it will render immediately under the other object in the display list.
Both objects must belong to the same display list, or parent container.
This method does not change this Game Objects depth value, it simply alters its list position.
The Game Object that this Game Object will be moved to be below.
This Game Object instance.
Sets the Blend Mode being used by this Game Object.
This can be a const, such as Phaser.BlendModes.SCREEN, or an integer, such as 4 (for Overlay)
Under WebGL only the following Blend Modes are available:
Canvas has more available depending on browser support.
You can also create your own custom Blend Modes in WebGL.
Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these reasons try to be careful about the construction of your Scene and the frequency with which blend modes are used.
The BlendMode value. Either a string, a CONST or a number.
This Game Object instance.
Allows you to store a key value pair within this Game Objects Data Manager.
If the Game Object has not been enabled for data (via setDataEnabled) then it will be enabled
before setting the value.
If the key doesn't already exist in the Data Manager then it is created.
sprite.setData('name', 'Red Gem Stone');
You can also pass in an object of key value pairs as the first argument:
sprite.setData({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 });
To get a value back again you can call getData:
sprite.getData('gold');
Or you can access the value directly via the values property, where it works like any other variable:
sprite.data.values.gold += 50;
When the value is first set, a setdata event is emitted from this Game Object.
If the key already exists, a changedata event is emitted instead, along an event named after the key.
For example, if you updated an existing key called PlayerLives then it would emit the event changedata-PlayerLives.
These events will be emitted regardless if you use this method to set the value, or the direct values setter.
Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings.
This means the keys gold and Gold are treated as two unique values within the Data Manager.
The key to set the value for. Or an object of key value pairs. If an object the data argument is ignored.
Optionalvalue: any
The value to set for the given key. If an object is provided as the key this argument is ignored.
This GameObject.
Adds a Data Manager component to this Game Object.undefined
This GameObject.
Sets the depth of this Game Object. If the value argument is not provided, the depth defaults to 0.
The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order of Game Objects, without actually moving their position in the display list.
A Game Object with a higher depth value will always render in front of one with a lower value.
Setting the depth will queue a depth sort event within the Scene.
The depth of this Game Object. Ensure this value is only ever a number data-type.
This Game Object instance.
Sets the display size of this Game Object.
Calling this will adjust the scaleX and scaleY properties so that the Game Object
is rendered at the specified pixel dimensions. It is the equivalent of setting the scale
manually, but expressed in pixels rather than as a multiplier.
The width of this Game Object.
The height of this Game Object.
This Game Object instance.
Does this Container exclusively manage its children?
The default is true which means a child added to this Container cannot
belong in another Container, which includes the Scene display list.
If you disable this then this Container will no longer exclusively manage its children. This allows you to create all kinds of interesting graphical effects, such as replicating Game Objects without reparenting them all over the Scene. However, doing so will prevent children from receiving any kind of input event or have their physics bodies work by default, as they're no longer a single entity on the display list, but are being replicated where-ever this Container is.
Optionalvalue: boolean
The exclusive state of this Container. Default true.
This Container.
Set the field position of this Pokémon
The new field position
Optionalduration: number
How long the transition should take, in milliseconds; if 0 or undefined, the position is changed instantly
Sets whether the filter camera should automatically re-focus on the Game Object every frame.
Sets the filtersAutoFocus property.
Whether filters should be updated every frame.
undefined
Set whether the filters should focus on the context.
Sets the filtersFocusContext property.
Whether the filters should focus on the context.
undefined
Set whether the filters should always draw to a framebuffer.
Sets the filtersForceComposite property.
Whether the object should always draw to a framebuffer, even if there are no active filters.
undefined
Set the base size of the filter camera. This is the size of the texture that internal filters will be drawn to. External filters are drawn to the size of the context (usually the game canvas).
This is typically the size of the GameObject.
It is set automatically when the Game Object is rendered
and filtersAutoFocus is enabled.
Turn off auto focus to set it manually.
Technically, larger framebuffers may be used to provide padding. This is the size of the final framebuffer used for "internal" rendering.
Base width of the filter texture.
Base height of the filter texture.
undefined
ProtectedsetSet this pokemon's illusion to the data of the given pokemon.
When setting the illusion of a wild pokemon, a PokemonSpecies is generally passed.
When setting the illusion of a pokemon in this way, the fields required by illusion data
but missing from PokemonSpecies are set as follows
pokeball and nickname are both inherited from this pokemonshiny will always be set if this pokemon OR its fusion is shinyvariant will always be 0undefined or 0 as appropriatePass this Game Object to the Input Manager to enable it for Input.
Input works by using hit areas, these are nearly always geometric shapes, such as rectangles or circles, that act as the hit area for the Game Object. However, you can provide your own hit area shape and callback, should you wish to handle some more advanced input detection.
If no arguments are provided it will try and create a rectangle hit area based on the texture frame the Game Object is using. If this isn't a texture-bound object, such as a Graphics or BitmapText object, this will fail, and you'll need to provide a specific shape for it to use.
You can also provide an Input Configuration Object as the only argument to this method.
OptionalhitArea: any
Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not given it will try to create a Rectangle based on the texture frame.
Optionalcallback: HitAreaCallback
The callback that determines if the pointer is within the Hit Area shape or not. If you provide a shape you must also provide a callback.
OptionaldropZone: boolean
Should this Game Object be treated as a drop zone target? Default false.
This GameObject.
Sets the mask that this Game Object will use to render with.
The mask must have been previously created and must be a GeometryMask. This only works in the Canvas Renderer. In WebGL, use a Mask filter instead (see Phaser.GameObjects.Components.FilterList#addMask).
If a mask is already set on this Game Object it will be immediately replaced.
Masks are positioned in global space and are not relative to the Game Object to which they are applied. The reason for this is that multiple Game Objects can all share the same mask.
Masks have no impact on physics or input detection. They are purely a rendering component that allows you to limit what is visible during the render pass.
The mask this Game Object will use when rendering.
This Game Object instance.
Create a new PokemonMove and set it to the specified move index in this Pokémon's moveset.
The index of the move to set
The ID of the move to set
Sets the name property of this Game Object and returns this Game Object for further chaining.
The name property is not populated by Phaser and is presented for your own use.
The name to be given to this Game Object.
This GameObject.
Sets the position of this Game Object.
Optionalx: number
The x position of this Game Object. Default 0.
Optionaly: number
The y position of this Game Object. If not set it will use the x value. Default x.
Optionalz: number
The z position of this Game Object. Default 0.
Optionalw: number
The w position of this Game Object. Default 0.
This Game Object instance.
Sets the position of this Game Object to be a random position within the confines of the given area.
If no area is specified a random position between 0 x 0 and the game width x height is used instead.
The position does not factor in the size of this Game Object, meaning that only the origin is guaranteed to be within the area.
Optionalx: number
The x position of the top-left of the random area. Default 0.
Optionaly: number
The y position of the top-left of the random area. Default 0.
Optionalwidth: number
The width of the random area.
Optionalheight: number
The height of the random area.
This Game Object instance.
Set whether the filters should be rendered.
Sets the renderFilters property.
Whether the filters should be rendered.
undefined
Sets the rotation of this Game Object.
Optionalradians: number
The rotation of this Game Object, in radians. Default 0.
This Game Object instance.
Sets the scale of this Game Object.
Optionalx: number
The horizontal scale of this Game Object. Default 1.
Optionaly: number
The vertical scale of this Game Object. If not set it will use the x value. Default x.
This Game Object instance.
Sets the scroll factor of this Container and optionally all of its children.
The scroll factor controls the influence of the movement of a Camera upon this Game Object.
When a camera scrolls it will change the location at which this Game Object is rendered on-screen. It does not change the Game Objects actual position values.
A value of 1 means it will move exactly in sync with a camera. A value of 0 means it will not move at all, even if the camera moves. Other values control the degree to which the camera movement is mapped to this Game Object.
Please be aware that scroll factor values other than 1 are not taken in to consideration when calculating physics collisions. Bodies always collide based on their world position, but changing the scroll factor is a visual adjustment to where the textures are rendered, which can offset them from physics bodies if not accounted for in your code.
The horizontal scroll factor of this Game Object.
Optionaly: number
The vertical scroll factor of this Game Object. If not set it will use the x value. Default x.
OptionalupdateChildren: boolean
Apply this scrollFactor to all Container children as well? Default false.
This Game Object instance.
Sets the internal size of this Game Object, as used for frame or physics body creation.
This will not change the size that the Game Object is rendered in-game.
For that you need to either set the scale of the Game Object (setScale) or call the
setDisplaySize method, which is the same thing as changing the scale but allows you
to do so by giving pixel values.
If you have enabled this Game Object for input, changing the size will not change the
size of the hit area. To do this you should adjust the input.hitArea object directly.
The width of this Game Object.
The height of this Game Object.
This Game Object instance.
Sets the current state of this Game Object.
Phaser itself will never modify the State of a Game Object, although plugins may do so.
For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'. The state value should typically be an integer (ideally mapped to a constant in your game code), but could also be a string. It is recommended to keep it light and simple. If you need to store complex data about your Game Object, look at using the Data Component instead.
The state of the Game Object.
This GameObject.
Set this Pokémon's temporary ability, activating it if it normally activates on summon.
The ID of the temporary ability to set
(Default false) Whether to set the passive ability instead of the non-passive one
Sets this Game Object to the back of the display list, or the back of its parent container.
Being at the back means it will render below everything else.
This method does not change this Game Objects depth value, it simply alters its list position.undefined
This Game Object instance.
Sets this Game Object to be at the top of the display list, or the top of its parent container.
Being at the top means it will render on top of everything else.
This method does not change this Game Objects depth value, it simply alters its list position.undefined
This Game Object instance.
Sets the vertex round mode of this Game Object. This is used by the WebGL Renderer to determine how to round the vertex positions.
The vertex round mode to set. Can be 'off', 'safe', 'safeAuto', 'full' or 'fullAuto'.
This GameObject.
Sets the visibility of this Game Object.
An invisible Game Object will skip rendering, but will still process update logic.
The visible state of the Game Object.
This Game Object instance.
Sets the w position of this Game Object.
Optionalvalue: number
The w position of this Game Object. Default 0.
This Game Object instance.
Sets the x position of this Game Object.
Optionalvalue: number
The x position of this Game Object. Default 0.
This Game Object instance.
Sets the y position of this Game Object.
Optionalvalue: number
The y position of this Game Object. Default 0.
This Game Object instance.
Sets the z position of this Game Object.
Note: The z position does not control the rendering order of 2D Game Objects. Use Phaser.GameObjects.Components.Depth#setDepth instead.
Optionalvalue: number
The z position of this Game Object. Default 0.
This Game Object instance.
Show this Pokémon's info panel
Shuffles all Game Objects in this Container using the Fisher-Yates implementation.undefined
This Container instance.
Removes all listeners from this EventEmitter. This method is called automatically by the Scene Systems when the parent Scene shuts down, ensuring that all event bindings are cleared and no stale references remain.
Sort the contents of this Container so the items are in order based on the given property.
For example: sort('alpha') would sort the elements based on the value of their alpha property.
The property to lexically sort by.
Optionalhandler: Function
Provide your own custom handler function. Will receive 2 children which it should compare and return a negative, zero, or positive number.
This Container instance.
Play the shiny sparkle animation and effects, if applicable
Suppresses an ability and calls its onlose attributes
Swaps the position of two Game Objects in this Container. Both Game Objects must belong to this Container.
This Container instance.
Optionalalpha: numberOptionalduration: numberOptionalease: stringToggle a boolean value for the given key within this Game Object's Data Manager. If the key doesn't already exist in the Data Manager then it is created with a value of false before being toggled to true.
If the Game Object has not been enabled for data (via setDataEnabled) then it will be enabled
before setting the value.
If the key doesn't already exist in the Data Manager then it is created.
When the value is first set, a setdata event is emitted from this Game Object.
The key to toggle the value for.
This GameObject.
Returns a JSON representation of the Game Object.undefined
A JSON representation of the Game Object.
Transfer stat changes and volatile status effects from another Pokemon to this one.
The Pokemon whose stats/Tags are to be passed on from
(i.e. the one having switched out)
Attempt to populate this Pokemon's moveset based on those from a Starter
The StarterMoveset to use; will override corresponding slots
of this Pokemon's moveset
Whether to ignore validating the passed-in moveset; default false
Used by Mystery Encounters to override a Pokemon's ability to be its hidden ability
The denominator for the HA chance (1 / haThreshold)
Attempt to select the move at the move index.
The index of the move to select
OptionalignorePp: boolean
Whether to ignore PP when checking if the move is usable (defaults to false)
A tuple containing a boolean indicating if the move can be selected, and a string with the reason if it cannot be selected
Attempt to set the Pokémon's shininess based on the trainer's trainer ID and secret ID. Endless Pokemon in the end biome are unable to be set to shiny
OptionalthresholdOverride: number
number that is divided by 2^16 (65536) to get the shiny chance, overrides shinyThreshold if set (bypassing shiny rate modifiers such as Shiny Charm)
true if the Pokemon has been set as a shiny, false otherwise
The exact mechanic is that it calculates E as the XOR of the player's trainer ID and secret ID.
F is calculated as the XOR of the first 16 bits of the Pokemon's ID with the last 16 bits.
The XOR of E and F are then compared to the shinyThreshold (or thresholdOverride if set) to see whether or not to generate a shiny.
The base shiny odds are BASE_SHINY_CHANCE / 65536
Tries to set a Pokémon's shininess based on seed
OptionalthresholdOverride: number
number that is divided by 2^16 (65536) to get the shiny chance, overrides shinyThreshold if set (bypassing shiny rate modifiers such as Shiny Charm)
OptionalapplyModifiersToOverride: boolean
If thresholdOverride is set and this is true, will apply Shiny Charm and event modifiers to thresholdOverride
OptionalmaxThreshold: number
The maximum threshold allowed after applying modifiers
Whether this Pokémon was set to shiny
For manual use only, usually to roll a Pokemon's shiny chance a second time. If it rolls shiny, or if it's already shiny, also sets a random variant and give the Pokemon the associated luck.
The base shiny odds are BASE_SHINY_CHANCE / 65536
Attempt to set this Pokemon's status to the specified condition.
Enqueues a new ObtainStatusEffectPhase to trigger animations, etc.
The StatusEffect to set
OptionalsourcePokemon: Pokemon
The Pokemon applying the status effect to the target,
or null if the status is applied from a non-Pokemon source (hazards, etc.); default null
OptionalsleepTurnsRemaining: number
The number of turns to set StatusEffect.SLEEP for;
defaults to a random number between 2 and 4 and is unused for non-Sleep statuses
The text to show for the source of the status effect, if any; default null
OptionaloverrideStatus: boolean
Whether to allow overriding the Pokemon's current status with a different one; default false
Whether to suppress in-battle messages for status checks; default true
OptionaloverrideMessage: string
String containing text to be displayed upon status setting; defaults to normal key for status and is used exclusively for Rest
Whether the status effect phase was successfully created.
doSetStatus - alternate function that sets status immediately (albeit without condition checks).
Optionalease: stringOverride this method in your own custom Game Objects to perform per-frame update logic.
This method is called by the Scene's Update List on every game frame, if the Game Object
is on that list. It is not called automatically — the Game Object must be added to the
Update List via addToUpdateList or by having a preUpdate method.
This base implementation is intentionally empty, allowing Game Objects to be used in an Object Pool without requiring any update logic.
Any arguments that are passed to the update method.
OptionalignoreOverride: booleanOptionalinstant: booleanCompares the renderMask with the renderFlags to see if this Game Object will render or not. Also checks the Game Object against the given Cameras exclusion list.
The Camera to check against this Game Object.
True if the Game Object should be rendered, otherwise false.
Whether this Game Object will render filters.
This is true if it has active filters,
and if the renderFilters property is also true.undefined
Whether the Game Object will render filters.
Checks if this Game Object should round its vertices,
based on the given Camera and the vertexRoundMode of this Game Object.
This is used by the WebGL Renderer to determine how to round the vertex positions.
You can override this method in your own custom Game Object classes to provide custom logic for vertex rounding.
The Camera to check against this Game Object.
If true, the object is only translated, not scaled or rotated.
True if the Game Object should be rounded, otherwise false.
The active state of this Game Object. A Game Object with an active state of
trueis processed by the Scenes UpdateList, if added to it. An active object is one which is having its logic and internal systems updated.