what the glitch does is that it forces an encounter with a pokemon who's Hexidecimal address in the game's code is determined by the Special stat of the last pokemon your opponent used. the game also uses the Hex address of the last opponent's attack boosts. the way stat buffs and debuffs work in battle is that you can either increase or decrease a stat's level 6 times, which adds a multiplier to the base stat. for the purpose of hex editing, though... this means the pokemon you're generating with the trainer escape glitch is by default level 7, and can either be boosted 6 times to level 13 or it can be lowered to level 1. in Gen 1, you were never meant to get a level 1 pokemon, and level 1 pokes have a negative ammount of EXP, so... naturally, if you do a battle where your poke doesn't gain enough EXP to jump to a positive number, you underflow it's EXP value!
I'd also like to say that Wonder Trade has made completing the National Dex SO much easier. that, and ORAS hands out legendary pokemon like they're candy. it's actually REALLY easy. Friend Safari gives you a ton of stuff, hoardes, the pokeradar... I think it's actually possible through the event distrivutions they are doing for 2016 to complete the national dex with just X, Y, Omega Ruby, and Alpha Sapphire... of course, you can also pull pokemon from the following all the way up to SUn and Moon through a crazy ass daisy Chaining of hardware.
Pokemon Ruby
Pokemon Sapphire
Pokemon Collesium
Pokemon Collesium special pre-order bonus disc
Pokemon XD: Gale of Darkness
Pokemon Box: Ruby and Sapphire
Pokemon Fire Red
Pokemon Leaf Green
Pokemon Emerald
Pokemon Diamond
Pokemon Pearl
Pokemon Ranger
Pokemon Battle Revolution
Pokemon Heart Gold
Pokemon Soul Silver
Pokemon Platinum
Pokemon Ranch
Pokemon Black
Pokemon White
Pokemon Black 2
Pokemon White 2
Pokemon AR Dream Radar
Pokebank
Poketransporter
Pokemon X
Pokemon Y
Pokemon Omega Ruby
Pokemon Alpha Sapphire
This doesn't even include the MULTITUDE of ways to cheat along the way; your various Action Replays, R4's, custom firmware for 3DS that lets you generate pokemon via the 3DS Web Browser, and the insane multitude of other ways to get pokes.
Pokemon X and Y was the first time I legit completed the Pokedex because this is the first generation where they included a good reward for Pokedex completion. that, and Wonder Trade made it SO goddamned easy.
It weirds me out how much mine and Guiallme's tastes in JRPGs are so opposed. At least we can agree on Kirby?