** You will need to understand Part 1 of this tutorial before you can decompress the files used in any other parts**
The stats for the Pokémon follow a similar but slightly different format in each game. Most of the data is self-explanatory and it all works the same way as in Ruby and Sapphire.
The data starts with Bulbasaur as you might expect, there are empty entries between Celebi and Treeko just like in Ruby and Sapphire. The order is the same as the Ruby and Sapphire order with the Gen III Pokémon is a slightly different order to their national dex order. Chimecho is at the end in Colosseum and in XD there is an empty entry after Chimecho and then the entry after that is Bonsly. Bonsly's data isn't complete; for example it's missing the level up rate data (since it only appears as a bingo card in-game). If you fill in the rest of Bonsly's data then Bonsly will function like any other Pokémon in the game. Even more interestingly the entry after that has data for Munchlax. The string id for the name of that entry points to the string "Munchlax". However, even less data is filled in for this row. I've focused mainly on Colosseum so I haven't done many tests on XD but Munchlax doesn't have a pkx model (pkx_gonbe.fsys with Gonbe being its japanese name) which I think are the models used in battle. Its possible that filling in its data would allow it to be used but I haven't tried yet.
Take a look at my source code on Github and look for the "PokemonStats.swift" object.
The first stats (bulbasaur) are in common_rel.fdat at offset 0x12336C in colo and offset 0x29ECC in XD. The size of each pokemon's stats is 0x11C in colo and 0x124 in XD. The offsets are how many bytes from the first byte of the pokemon's entry the data for that stat is.
Each pokemon has a series of level up moves which are each 4 bytes long. The first byte is the level and the 3rd and 4th bytes are the move with the second byte being apparently unused. Each pokemon has enough space for about 20 level moves. (of course adding more will increase the file size.)
Also the TMs and HMs work differently from the GBA games. You find in colo/xd that a lot of data that was represented by a single bit in the GBA games now gets a whole byte. The TMs and HMs each pokemon can learn are assigned one byte each. If that byte is 1 the pokemon can learn the move, if it's 0 then it can't. The HMs come straight after the TMs.
Some of the XD data isn't filled in yet because I hadn't recorded the data I wasn't interested in.
N.B. In XD the shadow pokemon data in DeckData_DarkPokemon seems to have a byte for a separate catch rate. That would mean that the catch rates in the pokemon stats are probably overriden and only take effect for the pokespot pokemon. I haven't tested this but a lot of the values at that offset are the same as the catch rate of the original pokemon with only a few being slightly different but still matching typical catch rates.
Pokemon stats data table
|Stat||Size (bytes)||Colosseum Offset||XD Offset|
|Base Exp Reward||1||0x07||0x05|
|Base Sp. Attack||1||0x8B||0x95|
|Base Sp. Defense||1||0x8D||0x97|
|First Level-up Move||4||0xBA||0xC4|
|Name String ID||2||0x1A||0x1A|
|ID of Model Used||2||0x2E||??|
|ID of Cry Used||2||0x0E||??|
|ID of Mugshot Used||2||0x10E||??|
|Egg Group 1||1||0x6E||??|
|Egg Group 2||1||0x6F||??|
|Weight in Pounds x10||2||0x0C||??||(e.g. a value of 0x64 gives a weight of 10.0 pounds)|
|Wild Held Item 1||1||0x70||??|
|Wild Held Item 2||2||0x72||??|
|ID of Species Name||2||0x1E||??||(e.g. Suicune is the aurora Pokémon)|
EVs rewarded for defeat are at around 0x91 for Colosseum.
My advice for editing the stats without increasing the compressed file size is to remove all the level up moves for the Pokémon that aren't obtainable in the game as that data is never accessed. Each trainer has custom move sets for each Pokémon. You can also remove all wild held items, egg groups and all egg cycles, as well as level up rates and evolution data for unobtainable Pokémon. This is less important in Colosseum because you can erase all the battle mode trainers and that gives you enough space for just about anything you like. If you require battle mode or you're hacking XD (where the trainer data is in different files) then this can be useful.
Edited by evandixon
Adjust table column widths