Skip to content

Instantly share code, notes, and snippets.

@kanzure
Last active December 10, 2015 05:58
Show Gist options
  • Save kanzure/4391659 to your computer and use it in GitHub Desktop.
Save kanzure/4391659 to your computer and use it in GitHub Desktop.
base stats dumper for pokecrystal
# http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_base_stats_data_structure_in_Generation_II
from crystal import load_rom
from pokemon_constants import pokemon_constants
rom = load_rom()
basestats = 0x51424
len_mon = 0x20
spacing = "\t"
fields = [
"pokedex number",
"base hp",
"base attack",
"base defense",
"base speed",
"base sp. attack",
"base sp. defense",
"type 1",
"type 2",
"catch rate",
"base exp. yield",
"wild held item 1",
"wild held item 2",
"gender ratio",
"unknown",
"egg cycles",
"unknown",
"dimensions of frontpic",
"blank",
"blank",
"blank",
"blank",
"growth rate",
"egg groups",
"tmhm1",
"tmhm2",
"tmhm3",
"tmhm4",
"tmhm5",
"tmhm6",
"tmhm7",
"tmhm8",
]
def get_base_stats(id):
address = basestats + (id * len_mon)
output = pokemon_constants[id + 1] + "BaseStats: ; " + hex(address) + "\n"
for byte in range(len_mon):
stat = ord(rom[address+byte])
output += spacing + "db " + hex(stat)[2:] + " ; " + fields[byte] + "\n"
return output
output = get_base_stats(0)
print output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment