The 1 in 256 miss in Pokemon Red, Blue and Yellow
A move that never misses misses once in a while in Gen 1. Here is the roll that does it, the real odds of every accuracy in the game, and the two ways around it.
The short answer. In Pokemon Red, Blue and Yellow, a move with 100% accuracy hits only 255 times in 256: about 1 time in 256 (0.4%) it misses. The game's MoveHitTest routine rolls a random number from 0 to 255 and the move hits only if the roll is below its accuracy, and the highest accuracy the game can store is 255, so a roll of 255 always misses. Swift and X Accuracy skip the roll, and Gold, Silver and Crystal fixed it.
- Every accuracy is a little lower than it says. An 85% move hits 216 times in 256 (84.4%), a 70% move 178 times (69.5%).
- It is not only attacks. Thunder Wave, Toxic, Confuse Ray, Leech Seed, Growl and the sleep moves roll the same way.
- Nothing raises it past 255. Accuracy and evasion changes scale the number, but it is capped at 255, so 255 in 256 is the best any move that rolls can do.
- Tested in the game's own code in an emulator, Red and Yellow, with the roll set to 254 and 255 on purpose. How I checked it.
The roll
Every time a move checks whether it hits, the game takes one random byte, a number from 0 to 255, and compares it with the move's accuracy. A move hits when the roll is lower. Here are all 256 rolls the game can make for a move: the green ones hit, the red ones miss.
The routine is MoveHitTest (engine/battle/core.asm in pret's disassembly). After the checks for Dream Eater, Swift, Fly and Dig, Mist and X Accuracy, it ends like this:
; MoveHitTest, pret pokered engine/battle/core.asm call CalcHitChance ; scale the accuracy by accuracy and evasion ld a, [wPlayerMoveAccuracy] ld b, a ... call BattleRandom ; 0 to 255 cp b jr nc, .moveMissed ; a roll at or above the accuracy misses
pret's comment there: "note that this means that even the highest accuracy is still just a 255/256 chance, not 100%".
Every accuracy in the game, as the game sees it
The move list stores accuracy as one byte. pret writes the moves with their percent, and a macro turns it into the byte: the percent times 255 / 100, rounded down. Then the roll has to be below that byte, out of 256. So every move hits a little less often than its percent:
| Listed | Stored | Real chance | Moves |
|---|---|---|---|
| 100% | 255 | 99.6% | 104 of the 165 moves, from Pound to Struggle |
| 95% | 242 | 94.5% | Tackle, Cut, Fly, Jump Kick, Razor Leaf, String Shot |
| 90% | 229 | 89.5% | Hyper Beam, Blizzard, Rock Slide, Leech Seed, Hi Jump Kick, Super Fang and 5 more |
| 85% | 216 | 84.4% | Fire Blast, Toxic, Crabhammer, Wrap, Take Down, Screech and 9 more |
| 80% | 204 | 79.7% | Hydro Pump, Submission, Psywave, Kinesis, Fury Swipes |
| 75% | 191 | 74.6% | Sleep Powder, Stun Spore, Glare, Lovely Kiss, Bind, Mega Kick and 5 more |
| 70% | 178 | 69.5% | Thunder, Fire Spin, Smog, Flash |
| 65% | 165 | 64.5% | Rock Throw |
| 60% | 153 | 59.8% | Hypnosis |
| 55% | 140 | 54.7% | Sing, Supersonic, Disable, Poison Gas |
| 30% | 76 | 29.7% | Fissure, Horn Drill, Guillotine |
Same in Red, Blue and Yellow: the move list is the same in all three.
What never misses
- Swift.
MoveHitTestreturns before the roll for Swift's effect, so Swift never rolls, and it even hits a Pokemon that is underground with Dig or in the air with Fly. - Any move while X Accuracy is up. The item sets
USING_X_ACCURACY, andMoveHitTestreturns before the roll. (It still cannot reach a Pokemon underground or in the air, and Dream Eater still needs a sleeping target.) - Moves that never ask. Recover, Softboiled, Rest, Haze, Reflect, Light Screen, Focus Energy, Mist, Substitute, Transform, Conversion and Splash skip the hit test (
ResidualEffects1), and so do the moves that raise your own stats, Bide, and Whirlwind and Roar. Their listed accuracy is never used.
Everything else rolls, status moves included: Thunder Wave, Toxic, Poisonpowder, Confuse Ray, Supersonic, Leech Seed, Disable, Mimic, the sleep moves and the moves that lower the other side's stats. A 100% Thunder Wave fails 1 time in 256.
Accuracy and evasion
Before the roll, CalcHitChance multiplies the accuracy byte by your accuracy stage's ratio and then by the other side's evasion stage, read backwards (a +1 evasion uses the -1 ratio, 66 / 100). Each step rounds down and never goes below 1, and the result is capped at 255. Try the sliders above: one Double Team or Minimize on the other side takes a 100% move to 168 in 256, six take it to 63, and nothing takes it past 255.
The computer's extra miss
One more roll, this one only for the computer. Outside a link battle, when the other side uses a move that lowers a stat (Growl, Leer, Sand-Attack, String Shot and the rest), StatModifierDownEffect first rolls a random byte and the move fails if it is under 64: 64 in 256, a quarter of the time, before the move even gets to its own hit roll. In my test a trainer's Sand-Attack failed on a roll of 63 and went on to its hit roll on 64. Your own moves and link battles never get this extra roll.
Which games have it
- Red, Blue and Yellow: the same roll, and I ran it in Red and in Yellow.
- The Japanese Red, Green and Blue: Swift could miss. In pret's disassemblies of Green and Japanese Blue the Substitute check comes before the Swift check, so Swift is treated as a 100% move (with the 1 in 256 miss, and no hitting Fly or Dig) unless the target has a Substitute. pret's comment in the English version: "Swift never misses (this was fixed from the Japanese versions)". I read this; I did not run the Japanese games.
- Gold, Silver and Crystal: fixed. Their hit check,
BattleCommand_CheckHitin pret's Crystal disassembly, skips the roll when the accuracy after the stat changes is 255.
How I checked it
- Read:
MoveHitTest,CalcHitChanceand the move list (data/moves/moves.asm, with thepercentmacro in macros/data.asm) in pret's pokered and pokeyellow. - Run in the game: Red and Yellow under the PyBoy emulator, with the battler's battle oracle setting the random bytes. Body Slam missed on a roll of 255 and hit on 254. Thunder (stored as 178) hit on 177 and missed on 178. Swift took no roll at all. A trainer's Sand-Attack failed on the extra roll of 63 and went on at 64. The game and the battler's engine agreed on every byte and message.
- The numbers on this page come from the battler's engine (the move list) and from the same steps as
CalcHitChance, which a test compares with the engine for every accuracy byte and every stage. - Not tested: X Accuracy (read from the code only), the Japanese versions, and anything on a real Game Boy.
Questions
Why do 100% accurate moves miss in Gen 1?
Because the game rolls a random number from 0 to 255 and the move hits only if the roll is below its accuracy. The highest accuracy a move can have is 255, so a roll of 255 always misses: 1 time in 256, about 0.4%. The routine is MoveHitTest in Red, Blue and Yellow.
Does Swift ever miss in Pokemon Red and Blue?
Not in the English Red, Blue and Yellow: MoveHitTest returns before the roll for Swift's effect, so it even hits Pokemon that are underground or in the air. In the Japanese Red, Green and Blue the Substitute check comes first, so there Swift rolls like a 100% move and can miss, unless the target has a Substitute.
What is the real chance of an 85% move in Gen 1?
216 in 256, which is 84.4%. The game stores accuracy as a number from 0 to 255 (the percent times 255 / 100, rounded down), and a roll from 0 to 255 has to be below it. 90% is 229 (89.5%), 70% is 178 (69.5%) and 30% is 76 (29.7%).
Does X Accuracy stop the 1 in 256 miss?
Yes. X Accuracy sets a flag that makes MoveHitTest return before it rolls, so moves can no longer miss for that Pokemon (except to a target underground or in the air, and Dream Eater on a target that is awake). I read this in the game's code; the oracle battles did not use items.
Was the 1 in 256 miss fixed?
Yes, in Gold, Silver and Crystal. Their hit check (BattleCommand_CheckHit in pret's disassembly) skips the roll when the accuracy, after the stat changes, is 255, so 100% moves always hit there.
Was this tested on a real Game Boy?
No. I read MoveHitTest and CalcHitChance in pret's disassembly and ran the game's own code in the PyBoy emulator, with the random byte set on purpose: Body Slam missed on 255 and hit on 254, Thunder hit on 177 and missed on 178, and Swift took no roll. The battler's engine matched every one.