Skip to content

Latest commit

 

History

History
107 lines (60 loc) · 3.66 KB

DEX.md

File metadata and controls

107 lines (60 loc) · 3.66 KB

Dex

Dex is a library for getting information about Pokémon, moves, items, abilities, natures, stats, etc.

By default, Dex gets information about the latest games (currently Pokémon Sword and Shield), but Dex.mod can be used to get information about other games.

const {Dex} = require('pokemon-showdown');

const tackle = Dex.moves.get('Tackle');

console.log(tackle.basePower); // prints 40

Nonstandard information

The Dex API gives access to a lot of nonstandard data (from other games, from CAP, unreleased things, etc). You often want to filter it out before using it.

For details, see sim/NONSTANDARD.md.

Nonstandard things will still have exists: true, but things we don't have information for at all (for instance, if you typo) will have exists: false.

isNonstandard will be null for normal things.

const {Dex} = require('pokemon-showdown');

const frobnicate = Dex.moves.get('frobnicate');
console.log(frobnicate.exists); // prints false
console.log(frobnicate.isNonstandard); // prints 'Custom'

const tomohawk = Dex.species.get('tomohawk');
console.log(tomohawk.exists); // prints true
console.log(tomohawk.isNonstandard); // prints 'CAP'

const pikachu = Dex.species.get('pikachu');
console.log(pikachu.exists); // prints true
console.log(pikachu.isNonstandard); // prints null

Dex.mod

Dex.mod(modName: string): ModdedDex

  • Dex by itself is an object for getting latest-generation information. To get information about another generation, replace Dex with Dex.mod(modName). For instance, to get information about Pokémon Yellow, replace Dex with Dex.mod('gen1').

    In the rest of this page, dex will refer to any instance of ModdedDex, either Dex or the return value of Dex.mod.

    const {Dex} = require('pokemon-showdown');
    
    const tackle = Dex.mod('gen1').moves.get('Tackle');
    
    console.log(tackle.basePower); // prints 35

Return values

Return values have not been stabilized yet. Use the TypeScript definitions if you'd like, but you should probably pin a specific dependency version.

dex: ModdedDex

Remember: dex refers to either Dex or Dex.mod(modID).

dex.moves.get(moveName: string): Move

dex.moves.all(): Move[]

dex.species.get(speciesName: string): Species

dex.species.all(): Species[]

dex.abilities.get(abilitysName: string): Ability

dex.abilities.all(): Ability[]

dex.items.get(itemName: string): Item

dex.items.all(): Item[]