/** * Dex * Pokemon Showdown - http://pokemonshowdown.com/ * * Handles getting data about pokemon, items, etc. Also contains some useful * helper functions for using dex data. * * By default, nothing is loaded until you call Dex.mod(mod) or * Dex.forFormat(format). * * You may choose to preload some things: * - Dex.includeMods() ~10ms * This will preload `Dex.dexes`, giving you a list of possible mods. * - Dex.includeFormats() ~30ms * As above, but will also preload `Dex.formats.all()`. * - Dex.includeData() ~500ms * As above, but will also preload all of Dex.data for Gen 8, so * functions like `Dex.species.get`, etc will be instantly usable. * - Dex.includeModData() ~1500ms * As above, but will also preload `Dex.dexes[...].data` for all mods. * * Note that preloading is never necessary. All the data will be * automatically preloaded when needed, preloading will just spend time * now so you don't need to spend time later. * * @license MIT */ import * as Data from './dex-data'; import { Condition, DexConditions } from './dex-conditions'; import { DataMove, DexMoves } from './dex-moves'; import { Item, DexItems } from './dex-items'; import { Ability, DexAbilities } from './dex-abilities'; import { Species, DexSpecies } from './dex-species'; import { Format, DexFormats } from './dex-formats'; import { Utils } from '../lib'; type DataType = 'Abilities' | 'Rulesets' | 'FormatsData' | 'Items' | 'Learnsets' | 'Moves' | 'Natures' | 'Pokedex' | 'Scripts' | 'Conditions' | 'TypeChart'; interface DexTable { [key: string]: T; } interface DexTableData { Abilities: DexTable; Aliases: { [id: string]: string; }; Rulesets: DexTable; FormatsData: DexTable; Items: DexTable; Learnsets: DexTable; Moves: DexTable; Natures: DexTable; Pokedex: DexTable; Scripts: DexTable; Conditions: DexTable; TypeChart: DexTable; } interface TextTableData { Abilities: DexTable; Items: DexTable; Moves: DexTable; Pokedex: DexTable; Default: DexTable; } export declare const toID: typeof Data.toID; export declare class ModdedDex { readonly Data: typeof Data; readonly Condition: typeof Condition; readonly Ability: typeof Ability; readonly Item: typeof Item; readonly Move: typeof DataMove; readonly Species: typeof Species; readonly Format: typeof Format; readonly ModdedDex: typeof ModdedDex; readonly name = "[ModdedDex]"; readonly isBase: boolean; readonly currentMod: string; readonly dataDir: string; readonly toID: typeof Data.toID; gen: number; parentMod: string; modsLoaded: boolean; dataCache: DexTableData | null; textCache: TextTableData | null; deepClone: typeof Utils.deepClone; readonly formats: DexFormats; readonly abilities: DexAbilities; readonly items: DexItems; readonly moves: DexMoves; readonly species: DexSpecies; readonly conditions: DexConditions; readonly natures: Data.DexNatures; readonly types: Data.DexTypes; readonly stats: Data.DexStats; constructor(mod?: string); get data(): DexTableData; get dexes(): { [mod: string]: ModdedDex; }; mod(mod: string | undefined): ModdedDex; forGen(gen: number): ModdedDex; forFormat(format: Format | string): ModdedDex; modData(dataType: DataType, id: string): any; effectToString(): string; /** * Sanitizes a username or Pokemon nickname * * Returns the passed name, sanitized for safe use as a name in the PS * protocol. * * Such a string must uphold these guarantees: * - must not contain any ASCII whitespace character other than a space * - must not start or end with a space character * - must not contain any of: | , [ ] * - must not be the empty string * - must not contain Unicode RTL control characters * * If no such string can be found, returns the empty string. Calling * functions are expected to check for that condition and deal with it * accordingly. * * getName also enforces that there are not multiple consecutive space * characters in the name, although this is not strictly necessary for * safety. */ getName(name: any): string; /** * Returns false if the target is immune; true otherwise. * Also checks immunity to some statuses. */ getImmunity(source: { type: string; } | string, target: { getTypes: () => string[]; } | { types: string[]; } | string[] | string): boolean; getEffectiveness(source: { type: string; } | string, target: { getTypes: () => string[]; } | { types: string[]; } | string[] | string): number; getDescs(table: keyof TextTableData, id: ID, dataEntry: AnyObject): { desc: any; shortDesc: any; } | null; /** * Ensure we're working on a copy of a move (and make a copy if we aren't) * * Remember: "ensure" - by default, it won't make a copy of a copy: * moveCopy === Dex.getActiveMove(moveCopy) * * If you really want to, use: * moveCopyCopy = Dex.getActiveMove(moveCopy.id) */ getActiveMove(move: Move | string): ActiveMove; getHiddenPower(ivs: AnyObject): { type: string; power: number; }; /** * Truncate a number into an unsigned 32-bit integer, for * compatibility with the cartridge games' math systems. */ trunc(num: number, bits?: number): number; dataSearch(target: string, searchIn?: ('Pokedex' | 'Moves' | 'Abilities' | 'Items' | 'Natures')[] | null, isInexact?: boolean): AnyObject[] | null; loadDataFile(basePath: string, dataType: DataType | 'Aliases'): AnyObject; loadTextFile(name: string, exportName: string): DexTable; includeMods(): this; includeModData(): this; includeData(): this; loadTextData(): TextTableData; loadData(): DexTableData; includeFormats(): this; } export declare const Dex: ModdedDex; export declare namespace Dex { type Species = import('./dex-species').Species; type Item = import('./dex-items').Item; type Move = import('./dex-moves').Move; type Ability = import('./dex-abilities').Ability; type HitEffect = import('./dex-moves').HitEffect; type SecondaryEffect = import('./dex-moves').SecondaryEffect; type RuleTable = import('./dex-formats').RuleTable; } export default Dex;