pokemaster2 package¶
Subpackages¶
Submodules¶
pokemaster2.cli module¶
Console script for pokemaster2.
pokemaster2.pokemon module¶
Base Pokemon.
- class pokemaster2.pokemon.BasePokemon(national_id: int, species: str, types: Sequence[str], item_held: str, exp: int, level: int, base_stats: pokemaster2.pokemon.Stats, iv: pokemaster2.pokemon.Stats, current_stats: pokemaster2.pokemon.Stats, stats: pokemaster2.pokemon.Stats, ev: pokemaster2.pokemon.Stats, pid: str, gender: str, nature: str, ability: str)[source]¶
Bases:
objectThe underlying structure of a Pokémon.
No fancy initializations, no consistency checks, just a very basic Pokémon model. Anything is possible with this BasePokemon. This class also contains common and basic behaviors of Pokémon, such as leveling-up, learning/forgetting moves, evolving into another Pokémon, etc.
This class is never meant to be instantiated directly.
- ability: str¶
- base_stats: pokemaster2.pokemon.Stats¶
- current_stats: pokemaster2.pokemon.Stats¶
- exp: int¶
- gender: str¶
- item_held: str¶
- level: int¶
- national_id: int¶
- nature: str¶
- pid: str¶
- species: str¶
- stats: pokemaster2.pokemon.Stats¶
- types: Sequence[str]¶
- class pokemaster2.pokemon.Stats(hp: int, atk: int, def_: int, spatk: int, spdef: int, spd: int)[source]¶
Bases:
objectGeneric stats, can be used for Pokemon stats/IV/EV.
- atk: int¶
- classmethod create_iv(gene: int) pokemaster2.pokemon.S[source]¶
Create IV stats from a Pokémon’s gene.
- Parameters
gene – An int generated by the PRNG.
- Returns
A Stats instance.
- def_: int¶
- hp: int¶
- classmethod nature_modifiers(nature: str) pokemaster2.pokemon.S[source]¶
Generate nature modifier Stats.
- spatk: int¶
- spd: int¶
- spdef: int¶
pokemaster2.prng module¶
Provides the pseudo-random number generator used in various places.
- class pokemaster2.prng.PRNG(seed: int = 0, gen: int = 3)[source]¶
Bases:
objectA linear congruential random number generator.
- Usage:
>>> prng = PRNG() >>> prng() 0 >>> prng() 59774
References
https://bulbapedia.bulbagarden.net/wiki/Pseudorandom_number_generation_in_Pokémon https://www.smogon.com/ingame/rng/pid_iv_creation#pokemon_random_number_generator
- generate_pid_and_iv(method: int = 2) Tuple[int, int][source]¶
Generate the PID and IVs using the internal generator.
The generated 32-bit IVs is different from how it is actually stored.
Method 1: [PID] [PID] [IVs] [IVs] Method 2: [PID] [PID] [xxxx] [IVs] [IVs] Method 4: [PID] [PID] [IVs] [xxxx] [IVs]
Methods 2 and 4 are only used in Pokemon Ruby, Sapphire, Emerald, Fire Red and Leaf Green (RSEFRLG) to produce wild Pokemon.
All the Pokemon you catch in these games that are not wild Pokemon are created using Method 1.
The criterion for choosing whether to use Method 1, 2, or 4 in the creation of wild Pokemon in RSEFRLG seems to be arbitrary.
Checkout [this link](https://www.smogon.com/ingame/rng/pid_iv_creation#rng_pokemon_generation) # noqa: E501 for more information on Method 1, 2, and 4.
- Parameters
method – 1, 2, or 4.
- Raises
ValueError – if the method is not in (1, 2, 4).
- Returns
a tuple of two integers, in the order of ‘PID’ and ‘IVs’.
- random() float[source]¶
Generate a random number from the uniform distribution [0, 1).
- Returns
A random number between 0 and 1.
- seed¶
Module contents¶
Top-level package for pokemaster2.