Why can Ditto permanently forget how to use Struggle in Generation 1 when Transform is out of PP

pokemon-first-generation

The YouTube video "Can You Beat Pokemon Red/Blue With Only a Ditto?" by Pikasprey Yellow used a strategy where, for some Pokémon battles, they intentionally walked into the battle with 0 PP on their Ditto's Transform in order to use Struggle (which, given that it was a Normal type move in Generation 1, was more effective in some cases).

However, he found that around the time he made it to Fuschia City, the game refused to do this. Whenever he walked into a battle with 0 PP on Transform, he would simply be told that there is not enough PP, but it wouldn't go ahead and trigger Struggle. All he could do was just pass turns by using the Poké Flute until the opponent KO'd him.

The only cheating that Pikasprey Yellow used was to start the game with Ditto, rather than one of the typical starters. Did that somehow cause this behavior? Why can Ditto permanently forget how to use Struggle in Generation 1 when Transform is out of PP?

Best Answer

Credit to Crystal_ @ forums.glitchcity.info

Quoted from the source:


  • When FIGHT is selected, the game parses all four PP slots, and if they are all zero, uses Struggle. Normally, an empty move's PP slot is zero, but we will see that there can be an edge case...
  • The active Pokémon is copied to a region of memory (so the game can use this instead having to constantly modify party data). For things such as HP, status, and PP, the game needs to also update the party data.
  • There is one exception to this : when a Pokémon is under Transform, the party data must not be updated. For example, PP is not subtracted from the party data.
  • When Mirror Move (or Metronome) is used, the game will decrement the PP of Mirror Move twice (once when it's actually used, and once when the move it represents is used). Thus, the game increments the PP of Mirror Move once, to compensate.

All of these make sense -- it's how the game works. But here's the catch : the "PP increment" function doesn't check for the Transformed status !

Here's how to trigger the glitch :

  1. Have any Pokémon with Transform (typically Ditto, but also Mew, or a Pokémon with Metronome) face against a Pokémon knowing Mirror Move or Metronome
  2. Transform into the Pokémon with Mirror Move;
  3. Use the move;
  4. The game will decrement Mirror Move's PP (but it won't because Transform);
    • (If the move fails, nothing else happens);
  5. The game will increment Mirror Move's PP (thus, it will increment the PP in the corresponding slot);
  6. The game will decrement Mirror Move's PP (but it won't because Transform)

Thus, the game increments a move's PP in the Pokémon's data. If the move is present, then it will just have incremented it, no biggie.

If it's not, this creates a slot that is empty, but with non-zero PP ! Thus, the game fails to use Struggle.


Disable

Disable first checks if there is a slot with non-zero PP, and if this fails, misses. With a Struggle-less Pokémon, this will always succeed, because of the glitched slot. Then, Disable will attempt to pick a slot which must have a move AND non-zero PP. Assuming Transform has 0 PP, the game will never find such a slot (since the only slot with non-zero PP has no move). Bam, infinite loop, and softlock.