# Wally defeating Ralts oversight

In Pokémon Ruby, Sapphire and Emerald, it is possible, although extremely unlikely (with a probability of approximately 1/199495), that Wally's Zigzagoon would defeat the Ralts that he is supposed to catch in the demonstration near the beginning of the game.

When this happens, Zigzagoon will gain experience, and the battle will end as if it were a normal wild encounter, skipping the scripted section where Wally uses a Poké Ball in his bag and catches Ralts. However, the game is not otherwise affected (e.g. after exiting to the overworld, Wally will still declare "I did it... It's my... My Pokémon!", and in later trainer battles with Wally he will still use a Ralts or a Gardevoir).

## Probability

Critical hits are disabled for this battle, so this event could only happen with extreme stats and damage rolls. Namely:

- Zigzagoon needs to have 11 or 12 Attack. (Having 12 Attack does not help it to KO a 7 Defense Ralts, or to KO a 6 Defense Ralts without maximum damage rolls.)
- This means that it needs to have:
- Either an Attack-raising nature, and an Attack IV of 12 or higher, which happens with probability (4/25) * (20/32);
- Or a nature that does not affect the Attack, and an Attack IV of 26 or higher, which happens with probability (17/25) * (6/32).

- This means that it needs to have:

- Therefore the total probability for Zigzagoon to have 11 or 12 Attack is (4/25) * (20/32) + (17/25) * (6/32) = 182/800.

- Ralts needs to have 17 HP and 6 Defense (both the minimum).
- This means that it needs to have a Defense-lowering nature (since there is no nature that affects the HP), as well as an HP IV of 3 or lower and a Defense IV of 9 or lower
^{[1]}. The probability for all three to happen is (4/25) * (4/32) * (10/32).

- This means that it needs to have a Defense-lowering nature (since there is no nature that affects the HP), as well as an HP IV of 3 or lower and a Defense IV of 9 or lower
- Given the above stats, Zigzagoon still needs to hit both Tackles for the maximum damage, 10 and 7 respectively; the second one with a -1 Attack modifier since Ralts always uses Growl on the first turn.
- Tackle has a 95% accuracy in Generation III. Furthermore, the probability of getting the maximum damage roll is only 1/16 for each hit
^{[2]}.

- Tackle has a 95% accuracy in Generation III. Furthermore, the probability of getting the maximum damage roll is only 1/16 for each hit

The probability for all of the above to happen is thus (182/800) * (4/25) * (4/32) * (10/32) * 95% * (1/16) * 95% * (1/16) ≈ 1/199495.

It is possible that, when the developers set up this scenario, they tried to check for all the maximum and minimum values to ensure that this event is truly impossible, which is also why they made critical hits impossible. However, they forgot that Ralts could have a Defense-lowering nature, which is the only other "discrete" variable in the equation.

## In speedruns

When this event happens naturally, it would save time in a speedrun, since watching Wally use the Poké Ball takes a fair amount of time. In TASes, it is now standard to make this happen with luck manipulation^{[3]}.

In an RTA, however, given the low probability and small amount of time save, it is obviously not worth it to spend time resetting for this event. It is theoretically also possible to design an RTA luck manipulation for it, but even just hard resetting for the manipulation would lose more time than it would save, again making it infeasible.

## YouTube video

| |

YouTube video by ChickasaurusGL |

## Credits

- FractalFusion, GoddessMaria (original TAS projects), details
- ChickasaurusGL (encoding)

## References

- ↑ Some sources (e.g. Chances of Wally killing a shiny Ralts) states that the Ralts needs a Defense IV of 5 or lower. This would be the case if the stat value is not rounded down before applying the nature multiplier. However, according to the stat formula, the stat value is rounded down both before and applying the nature multiplier, which makes an IV of 9 still low enough. The decompiled source code of Emerald agrees with the latter formula: Since the variable
`n`

is of type`s32`

(an alias for`int32_t`

), any intermediate results stored in it is necessarily rounded down to an integer (but since the operands are all integers, the results for divisions are actually rounded down already). - ↑ Similarly, some sources state that the probabilities are 5/16 and 7/16 respectively. This is likely another rounding problem: If the damage is rounded down both before and after the random multiplier (which ranges between 85% and 100% in increments of 1%), then there must be a gap between the maximum damage roll (i.e. 100% damage) and 99% damage. The numbers used in this page is calculated with the Pokémon Showdown Damage Calculator.
- ↑ The first TASVideos submission using this oversight to save time