# Can PokéTransporter make a Pokémon shiny?

Warning! This is going to get technical!

The method of determining whether a Pokémon is shiny in Generation III-V was the following:

1. Use the bitwise XOR operation on the 16-bit Trainer ID and 16-bit Secret ID, this results in a combined 16-bit OT-ID.
2. Use the bitwise XOR opeartion on the High Bytepart and Low part of the 32-bit Pokémon ID, this results in a combined 16-bit P-ID.
3. Use the bitwise XOR operation on the OT-ID and the P-ID, this results in a 16-bit Shiny Value.
4. If the Shiny Value is lower than 8, the Pokémon is shiny. In other words, if the 13 most significant bits are all 0, the Pokémon is shiny.

This results in a chance of 1:8192 (2^13) of a Pokémon being shiny, assuming TID, SID and PID were uniformly random.

Since Generation VI, this process has been massively simplified:

1. Use the bitwise XOR operation on the OT's 12-bit TSV (Trainer Shiny value) and the Pokémon's 12-bit ESV (Egg Shiny Value).
2. If the result is 0 (TSV and ESV are the same), the Pokémon is shiny.

This results in a chance of 1:4096 (2^12) of a Pokémon being shiny, assuming TSV and ESV were uniformly random.

Recent research has shown that the TSV is calculated as TID XOR SID >> 4, that is, the 12 most significant bits of the bitwise XOR operation applied to the OT's TID and SID. The ESV is calculated in a similar fashion based on the Pokèmon's PID. Using this information, the above Gen VI shiny check algorithm can be reformulated as such:

1. Use the bitwise XOR operation on the 16-bit Trainer ID and 16-bit Secret ID, this results in a combined 16-bit OT-ID.
2. Use the bitwise XOR opeartion on the High Byte and Low Byte of the 32-bit Pokémon ID, this results in a combined 16-bit P-ID.
3. Use the bitwise XOR operation on the OT-ID and the P-ID, this results in a 16-bit Shiny Value.
4. If the Shiny Value is lower than 16, the Pokémon is shiny. In other words, if the 12 most significant bits are all 0, the Pokémon is shiny.

By now, you probably guessed where this is going.

Let's say I have a Pokémon on a Gen V game whose Shiny Value in step 3 is between 8 and 15. This means that the first 12 bits are all 0 and the 13th bit is 1, resulting in a non-shiny Pokémon. If I use PokéTransporter to transfer this Pokémon to Pokémon Bank and thus Gen VI, the shiny check will notice that the first 12 bits of the Shiny Value are 0 (or rather, it will calculate TSV and ESV and notice they're the same) and conclude that the Pokémon is shiny! Unless of course PokéTransporter checks for this case and changes the PID in case it occurs.

Can anyone confirm or disprove this behaviour?

The implications are very interesting, by the way. Depending on when and how exactly this check happens in relation to the legality check, this loophole could possibly be used to circumvent the "no shiny" rule on Reshiram and Zekrom in Gen V as well as on event Pokémon, who are usually unavailable as shinies.

• This is a very interesting question... I'm looking into it the best I can at the moment. – LLF Jul 17 '14 at 13:57
• @LLF the "easiest" way to check would probably be to rng a pokemon with a fitting pid... Unfortunately i don't have the means to do so right now. – scenia Jul 17 '14 at 14:01
• Same here. So I'm researching the best I can, and ife can't find it, hopefully someone can get the means to check. – LLF Jul 17 '14 at 14:03
• Though its not definitive,I did find some talk about this here: bulbapedia.bulbagarden.net/wiki/Talk:Shiny_Pok%C3%A9mon – LLF Jul 17 '14 at 14:19
• Once I can get home, and be able to calculate a pokemons cid, I hope to be able to answer this. But finding the pid and sid can be a bit of a pain, if its even possible, it looks like. – LLF Jul 17 '14 at 21:40

Alright, I managed to find an answer after all. Here's what happened:

I used light math and a well-known tool that helps with RNG abuse to craft myself 2 Pokémon on Gen V games with the following characteristics:

1. PID 7914C235 Shiny Value 6 -> shiny
2. PID 1B096AC5 Shiny Value 13 -> non-shiny in Gen V, theoretically shiny in Gen VI

I then transferred both Pokémon via PokéTransporter and checked their PID again. The result:

1. PID 7914C235 Shiny Value 6 -> shiny
2. PID 9B096AC5 Shiny Value 32781 (=13+2^15) -> non-shiny

This leads to the conclusion that PokéTransporter checks for this case. If and only if it occurs, it changes the Pokémon's PID, probably by inverting the most significant bit (adding or subtracting 2^31 depending on whether or not the PID is above or below that value originally). I could test and confirm how it's changed by RNG'ing a Pokémon with a PID of 80000000 or more with a Shiny Value between 8 and 15, but this would bring little new and relevant information.

So, the gist of it is this: PokéTransporter checks the PID and compares it against the TID/SID. If the resulting Shiny Value is between 8 and 15 and would thus make a non-shiny Pokémon become shiny, it inverts the PID's MSB to force the Pokémon to be non-shiny.

Since the PID is no longer used for the various purposes it served up until Generation V, this change doesn't affect anything but shininess. It also affects legality in that a Pokemon that was not created in Generation VI+ may not have a PID/TID/SID combination that would result in a Shiny Value between 8 and 15. If it does, it was hacked into Gen VI+ without setting the Pentagon flag (or similar flags usedin later games) to make it look like a Gen V Pokemon by someone who didn't know this and messed up the PID.

• Great answer- I hadn't found on in my couple hundred that matched. =/ This is about what I thought happened, though. – LLF Jul 20 '14 at 16:01
• What implications does flipping the MSB of the personality value have on other things, if any? Spinda's spots, for example? – Niet the Dark Absol Jul 23 '14 at 13:34
• None as far as I can tell. I presume they chose the MSB because it's not used for anything else besides legality checks. Spinda's spots are determined by some, but not all bits of the PID, and I believe the MSB is not one of them. Same thing goes for Unown shape. – scenia Jul 23 '14 at 13:43
• @NiettheDarkAbsol I looked that up and turns out Spinda's left face spot would change its height by 8 pixels (up or down depends on whether ot not it was above or below the y coordinate 26.5). Nature might also change depending on whether or not they changed the system. – scenia Mar 10 '15 at 10:30
• @NiettheDarkAbsol came back to this question for random reasons. I realized what I wrote back then isn't actually true, which I know now. In Generation VI, the PID's sole purposes are legality and shininess, everything else including Spinda's spots, Unown's letter and nature are now determined by different (additional) values. In fact, some uses of the PID have been gradually removed from generation to generation, see Bulbapedia. – scenia Feb 24 '17 at 14:29