TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/smogon/pokemon-showdown-client/llms.txt
Use this file to discover all available pages before exploring further.
Dex object is the primary data-access layer for the Pokémon Showdown client engine. It exposes lazily-loaded lookup tables for moves, items, abilities, and species — each normalised through toID so lookups are case- and punctuation-insensitive. When a battle uses a non-standard format (an older generation or a custom mod), Dex.mod() returns a ModdedDex instance that shadows the global data tables with generation-specific overrides. All type declarations live in battle-dex-data.ts and are re-exported through the Dex namespace so consumers only need a single import.
battle-dex.ts is MIT-licensed and has no Node.js runtime dependencies. It runs identically in the browser, in NW.js, and in standalone replay-viewer contexts.toID(text)
Converts any value into a lowercase alphanumeric ID by stripping all non-[a-z0-9] characters. If the value has an .id or .userid property it is unwrapped first. Non-string, non-number inputs return the empty string cast to ID.
Dex Namespace — Type Exports
The declare namespace Dex block in battle-dex.ts re-exports all data types from battle-dex-data.ts under the Dex. prefix. Import them as types only.
Primitive Types
Branded lowercase alphanumeric string. Produced exclusively by
toID(). The brand prevents accidentally using un-normalised strings where an ID is expected.Stats that can be boosted or lowered in battle, including the accuracy/evasion axes.
All 19 Pokémon types plus the catch-all
'???'.Non-volatile status condition IDs.
Pokémon gender: Male, Female, or None (genderless).
All 25 nature names:
'Adamant' | 'Bashful' | 'Bold' | 'Brave' | 'Calm' | 'Careful' | 'Docile' | 'Gentle' | 'Hardy' | 'Hasty' | 'Impish' | 'Jolly' | 'Lax' | 'Lonely' | 'Mild' | 'Modest' | 'Naive' | 'Naughty' | 'Quiet' | 'Quirky' | 'Rash' | 'Relaxed' | 'Sassy' | 'Serious' | 'Timid'.Move damage category.
Composite Types
A record of all six base stats, all required.
Type-effectiveness category used in the type chart. Numeric constants are also available as
Dex.REGULAR, Dex.WEAK, Dex.RESIST, and Dex.IMMUNE on the singleton.| Value | Constant | Meaning |
|---|---|---|
0 | REGULAR | 1× neutral |
1 | WEAK | 2× or 4× super-effective |
2 | RESIST | 0.5× or 0.25× not-very-effective |
3 | IMMUNE | 0× immune |
Alias for
Teams.PokemonSet; see the Teams API for the full field listing.Effect Object Types
Base interface shared by all effect classes.
A generic effect that is none of the four specialised types (e.g. weather, terrain, the move Splash when referenced via
|-activate|). exists is always false — pure effects are constructed on the fly.plus/minus keys.Extends
Effect with type chart data.Dex Singleton
The exported Dex object is an instance of an anonymous class implementing ModdedDex. It targets Gen 9 by default (Dex.gen === 9, Dex.modid === 'gen9').
Lookup Namespaces
Each of the four lookup namespaces has a.get() method that accepts a name string, a pre-constructed object (passed through unchanged), null, or undefined. Results are cached in the global window.BattleMoves/Items/Abilities/Species table.
Dex.moves.get(nameOrMove)
Dex.moves.get(nameOrMove)
Returns a
Move object. Resolves aliases from BattleAliases. Handles hiddenpower*, return*, and frustration* as special base-power variants.Dex.items.get(nameOrItem)
Dex.items.get(nameOrItem)
Returns an
Item object. Unknown items have exists === false.Dex.abilities.get(nameOrAbility)
Dex.abilities.get(nameOrAbility)
Returns an
Ability object. Resolves aliases. Unknown abilities have exists === false.Dex.species.get(nameOrSpecies)
Dex.species.get(nameOrSpecies)
Returns a
Species object. Resolves aliases and normalises forme names.Generation and Format Methods
Dex.mod(modid)
Dex.mod(modid)
Returns a
ModdedDex that applies generation-specific data overrides on top of the Gen 9 base tables. Instances are cached in Dex.moddedDexes.Dex.forGen(gen)
Dex.forGen(gen)
Convenience wrapper: calls
Dex.mod('gen' + gen). Returns the main Dex if gen is falsy.Dex.forFormat(format)
Dex.forFormat(format)
Returns the appropriate
ModdedDex for a format string, handling special cases like Let’s Go (gen7letsgo), BDSP (gen8bdsp), and Champions Cup (champions).Dex.getEffect(name)
Dex.getEffect(name)
Resolves any effect reference — move, item, or ability — from a prefixed string like
"item:Choice Band" or "move:Moonblast". Falls back to a PureEffect for weather/terrain/other references.ModdedDex Class
ModdedDex provides the same .moves, .items, .abilities, and .species namespaces as the main Dex, but overlays generation-specific data from window.BattleTeambuilderTable.
battle-dex-data.ts Data Tables
BattleNatures
A record mapping every NatureName to a Nature object. Neutral natures have an empty object {}.
BattleStatNames / BattleStatIDs
Short display names for each stat ID.
Maps various display spellings to a canonical
StatName. Accepts 'HP', 'hp', 'Atk', 'atk', 'Def', 'def', 'SpA', 'SAtk', 'SpAtk', 'spa', 'spc', 'Spc', 'SpD', 'SDef', 'SpDef', 'spd', 'Spe', 'Spd', 'spe'.BattlePokemonIconIndexes / BattlePokemonIconIndexesLeft
Sprite sheet index overrides for alternate formes that do not follow the default National Dex numbering. Keys are ID strings (e.g. 'rotomfan', 'pikachubelle'), values are pixel-row indices into the sprite sheet.
BattlePokemonIconIndexesLeft contains the left-facing (opponent’s) sprite indices for formes that have a separate left-facing sprite distinct from the front-facing default.
