Teambuilder: Parse, manage and generate showdown teams

Base Teambuilder

This module defines the Teambuilder abstract class, which represents objects yielding Pokemon Showdown teams in the context of communicating with Pokemon Showdown.

class poke_env.teambuilder.teambuilder.Teambuilder

Bases: ABC

Teambuilder objects allow the generation of teams by Player instances.

They must implement the yield_team method, which must return a valid packed-formatted showdown team every time it is called.

This format is a custom format decribed in Pokemon’s showdown protocol documentation: https://github.com/smogon/pokemon-showdown/blob/master/PROTOCOL.md#team-format

This class also implements a helper function to convert teams from the classical showdown team text format into the packed-format.

static join_team(team: List[TeambuilderPokemon]) str

Converts a list of TeambuilderPokemon objects into the corresponding packed showdown team format.

Parameters:

team (list of TeambuilderPokemon) – The list of TeambuilderPokemon objects that form the team.

Returns:

The formatted team string.

Return type:

str

static parse_showdown_team(team: str) List[TeambuilderPokemon]

Converts a showdown-formatted team string into a list of TeambuilderPokemon objects.

This method can be used when using teams built in the showdown teambuilder.

Parameters:

team (str) – The showdown-format team to convert.

Returns:

The formatted team.

Return type:

list of TeambuilderPokemon

abstract yield_team() str

Returns a packed-format team.

Constant teambuilder

This module defines the ConstantTeambuilder class, which is a subclass of ShowdownTeamBuilder that yields a constant team.

class poke_env.teambuilder.constant_teambuilder.ConstantTeambuilder(team: str)

Bases: Teambuilder

yield_team() str

Returns a packed-format team.

Teambuilder pokemon

This module defines the TeambuilderPokemon class, which is used as an intermediate format to specify pokemon builds in teambuilders custom classes.

class poke_env.teambuilder.teambuilder_pokemon.TeambuilderPokemon(nickname: str | None = None, species: str | None = None, item: str | None = None, ability: str | None = None, moves: List[str] | None = None, nature: str | None = None, evs: List[int] | None = None, gender: str | None = None, ivs: List[int] | None = None, shiny: bool | None = None, level: int | None = None, happiness: int | None = None, hiddenpowertype: str | None = None, gmax: bool | None = None, tera_type: str | None = None)

Bases: object

HP_TO_IVS = {'bug': [31, 31, 31, 30, 31, 30], 'dark': [31, 31, 31, 31, 31, 31], 'dragon': [30, 31, 31, 31, 31, 31], 'electric': [31, 31, 31, 31, 30, 31], 'fighting': [31, 31, 30, 30, 30, 30], 'fire': [31, 30, 31, 30, 31, 30], 'flying': [31, 31, 31, 30, 30, 30], 'ghost': [31, 30, 31, 31, 31, 30], 'grass': [30, 31, 31, 31, 30, 31], 'ground': [31, 31, 31, 31, 30, 30], 'ice': [31, 30, 30, 31, 31, 31], 'poison': [31, 31, 30, 31, 30, 30], 'psychic': [30, 31, 31, 30, 31, 31], 'rock': [31, 31, 30, 30, 31, 30], 'steel': [31, 31, 31, 31, 31, 30], 'water': [31, 31, 31, 30, 30, 31]}
evs: List[int]
property formatted: str
property formatted_endstring: str
property formatted_evs: str
property formatted_ivs: str
property formatted_moves: str
ivs: List[int]
moves: List[str]