An automatically generated extraction of a subset of Pokémon Showdown's "Random Battle" generation
logic for use with @pkmn/sim
.
$ npm install @pkmn/randoms
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');
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.
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.