Pokemon generation 1 wrapper¶
- class pyboy.plugins.game_wrapper_pokemon_gen1.GameWrapperPokemonGen1(*args, **kwargs)[source]¶
Bases:
PyBoyGameWrapperThis class wraps Pokemon Red/Blue, and provides basic access for AIs.
If you call
printon an instance of this object, it will show an overview of everything this object provides.Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.start_game() >>> pyboy.game_wrapper.add_pokemon("PIKACHU", level=5) >>> pyboy.game_wrapper.start_wild_battle("RATTATA", level=3)
- start_game(timer_div=None)[source]¶
Call this function right after initializing PyBoy. This navigates through the intro and menu to start the game at the first playable state.
The title-screen state is saved, and using
reset_game, you can get back to this point instantly.Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.start_game()
- property party¶
Return the current party as a list of dictionaries.
- set_party(party)[source]¶
Replace the party with up to six complete Gen I party records.
Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> from pyboy.plugins.game_wrapper_pokemon_gen1_constants import POKEMON_SPECIES >>> pyboy.game_wrapper.set_party([ ... {"species": POKEMON_SPECIES["PIDGEY"], "level": 5, "hp": 20, "max_hp": 20, "attack": 10, "defense": 10, "speed": 10, "special": 10}, ... {"species": POKEMON_SPECIES["MEWTWO"], "level": 5, "hp": 20, "max_hp": 20, "attack": 10, "defense": 10, "speed": 10, "special": 10}, ... ])
- add_pokemon(species, level=2, moves=None, **kwargs)[source]¶
Add a battle-ready Pokemon using a species ID from pokered’s constants.
Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.add_pokemon("PIKACHU", level=5) >>> pyboy.game_wrapper.party[0]["species"] 84
- remove_pokemon(index)[source]¶
Remove a Pokemon from the party by its zero-based index.
Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.add_pokemon("PIKACHU", level=5) >>> pyboy.game_wrapper.remove_pokemon(0)
- property money¶
Return the player’s money, from 0 through 999999.
- set_money(amount)[source]¶
Set the player’s money.
Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.set_money(999999)
- property inventory¶
Return the bag contents as a list of item and quantity dictionaries.
- set_inventory(inventory, force=False)[source]¶
Replace the bag contents with item and quantity pairs.
Items may be pokered IDs or names from
ITEMS. Quantities range from 1 to 99.Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.set_inventory({"POTION": 20, "MASTER_BALL": 1})
- set_item(item, quantity, force=False)[source]¶
Set one bag item’s quantity, removing it when
quantityis zero.
- start_wild_battle(species, level, force=False)[source]¶
Schedule a wild battle against a species at the given level.
Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.start_game() >>> pyboy.game_wrapper.add_pokemon("PIKACHU", level=5) >>> pyboy.game_wrapper.start_wild_battle("PIKACHU", level=5) >>> pyboy.tick(1) True
- start_trainer_battle(trainer_class, trainer_set=1, force=False)[source]¶
Schedule a trainer battle by class and party-set IDs.
Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.start_game() >>> pyboy.game_wrapper.add_pokemon("PIKACHU", level=5) >>> pyboy.game_wrapper.start_trainer_battle("PROF_OAK", trainer_set=1) >>> pyboy.tick(1) True
- warp(destination)[source]¶
Schedule a script warp to a map identified by name or ID.
The map transition is performed by pokered on the next emulator tick.
Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.warp("viridian_pokecenter") >>> pyboy.tick(1) True
- set_event_flag(event)[source]¶
Set a story event flag by name or numeric pokered event ID.
Gym victory event flags are separate from the badges owned by the player. Use
set_badge()to grant a badge.Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.set_event_flag("got_pokedex")
- reset_event_flag(event)[source]¶
Reset a story event flag by name or numeric pokered event ID.
Example:
>>> pyboy = PyBoy(pokemon_blue_rom) >>> pyboy.game_wrapper.reset_event_flag("got_pokedex")