Skip to content

Latest commit

 

History

History

randoms

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

@pkmn/randoms

Test Status License npm version

An automatically generated extraction of a subset of Pokémon Showdown's "Random Battle" generation logic for use with @pkmn/sim.

Installation

$ npm install @pkmn/randoms

Usage

To generate a random team, get a TeamGenerator for a supported format and call getTeam:

import {TeamGenerators} from '@pkmn/randoms';

const generator = TeamGenerators.getTeamGenerator('gen8randombattle');
const team = generator.getTeam();

@pkmn/randoms is commonly used with @pkmn/sim to set the TeamGenerator factory on its Teams so that Teams.generate will work:

import {Teams} from '@pkmn/sim';
import {TeamGenerators} from '@pkmn/randoms';

Teams.setGeneratorFactory(TeamGenerators);
const team = Teams.generate('gen1randombattle');

Browser

The recommended way of using @pkmn/randoms in a web browser is to configure your bundler (Webpack, Rollup, Parcel, etc) to minimize it and package it with the rest of your application.

License

Substantial amounts of the code in this package have been either derived or generated from portions of Pokémon Showdown code which are distributed under the MIT License.