Substitute bugs in Pokemon Red, Blue and Yellow
Substitute is the move with the most bugs in Gen 1. Explosion that leaves its user standing, a Substitute that kills you, and a wall that sleep powder walks right through.
The short answer. Substitute in Pokemon Red, Blue and Yellow has several bugs. Explosion and Selfdestruct do not faint their user when they break a Substitute. A Substitute made with exactly a quarter of your HP left leaves you at 0 HP, and you faint. A Substitute can survive at 0 HP. And sleep moves, Thunder Wave, Stun Spore, Glare and Leech Seed go straight through it, while draining moves still heal by hitting it.
- Breaking a Substitute wipes the attacker's move effect, so no faint for Explosion, no recoil for Double-Edge or Take Down, no heal for Mega Drain and no recharge for Hyper Beam.
- It costs a quarter of max HP (rounded down) and fails only below that, not at it.
- A confused Pokemon behind its own Substitute that hurts itself damages the other side's Substitute instead.
- Tested in the game's own code in an emulator, in Red and Yellow. How I checked it.
The bugs
| What happens | What the game does |
|---|---|
| Explosion or Selfdestruct breaks a Substitute | The user does not faint |
| Substitute with exactly 1/4 of max HP left | It works, the user is left at 0 HP and faints |
| Damage exactly equal to the Substitute's HP | It survives at 0 HP |
| Sleep Powder, Spore, Hypnosis, Sing, Lovely Kiss | Go through |
| Thunder Wave, Stun Spore, Glare | Go through |
| Leech Seed, Disable, Mimic, Transform | Go through |
| Psybeam's and Confusion's 10% confusion | Goes through (when the hit does not break it) |
| Absorb, Mega Drain, Leech Life, Dream Eater | Hit it and heal the user (no heal if it breaks) |
| Recoil moves and Hyper Beam that break it | No recoil, no recharge |
| A confused user behind its own Substitute hurts itself | The damage hits the other side's Substitute |
Make a Substitute, then hit it
Pick a Pokemon (level 100, the battler's stats) and its HP, and see what SubstituteEffect_ does with it; then hit the Substitute and see what AttackSubstitute does.
What goes through a Substitute
There is no single "is there a Substitute?" gate. Each effect checks for itself with CheckTargetSubstitute, and only five do: PoisonEffect, FreezeBurnParalyzeEffect (the burn, freeze and paralysis side effects of damaging moves), StatModifierDownEffect, FlinchSideEffect and ConfusionEffect (Confuse Ray and Supersonic). Everything else never asks:
In my test, a Jolteon behind a Substitute was not touched by Toxic, then was seeded by Leech Seed and paralyzed by Stun Spore through it. An Alakazam behind a Substitute was put to sleep by Spore.
When it breaks: the effect disappears
AttackSubstitute (engine/battle/core.asm) subtracts the damage from the Substitute's HP. Damage over 255 always breaks it; otherwise it breaks only when the subtraction goes below zero. When it breaks, the routine clears the Substitute flag, prints "SUBSTITUTE broke!", and then:
; AttackSubstitute, pret pokered engine/battle/core.asm ld hl, wPlayerMoveEffect ; (wEnemyMoveEffect on the other side's turn) ... .nullifyEffect xor a ld [hl], a ; zero the effect of the attacker's move
Explosion's effect is what makes the user faint, so it never happens. The same zero cancels Double-Edge's recoil, a draining move's heal and Hyper Beam's recharge. In my test a Golem used Explosion on a Jolteon's Substitute three turns in a row and never fainted; the fourth Explosion, with no Substitute left, knocked Jolteon out. A Mega Drain that only dented a Substitute healed its user by 17; the Leech Life that broke it healed nothing.
Hitting the wrong Substitute
When a confused Pokemon hurts itself, or Jump Kick or Hi Jump Kick crashes, the damage is applied to the user, but AttackSubstitute picks whose Substitute to hit from whose turn it is. So a user behind its own Substitute damages the other side's Substitute instead (pret's comment: "If the user has a Substitute up and would take damage because of that, damage will be applied to the other player's Substitute"). In my test a confused Alakazam behind a Substitute hurt itself twice, and both times Gengar's Substitute lost HP: 80, then 43, then 6.
Which games
- Red, Blue and Yellow: everything above; I ran it in Red and in Yellow.
- The Japanese Red and Green: one difference. In pret's disassembly of Green,
MoveHitTestchecks for a Substitute first and makes Absorb, Mega Drain, Leech Life and Dream Eater miss it. The English version moved the Swift check in front, and the drain check now compares the wrong value, so it never triggers (pret: "The fix for Swift broke this code"). I read this; I did not run the Japanese games.
How I checked it
- Read:
SubstituteEffect_(move_effects/substitute.asm),AttackSubstitute,CheckTargetSubstituteand its callers,MoveHitTestandHandleSelfConfusionDamagein pret's pokered and pokeyellow, andMoveHitTestin pokegreen. - Run in the game: Red and Yellow under the PyBoy emulator with the battler's battle oracle: Explosion into a Substitute three times; Mega Drain, Spore and Leech Life against one; Toxic, Leech Seed and Stun Spore against one; a Chansey with exactly 175 of its 703 HP making one and fainting; and the confused Alakazam's self-hits. The battler's engine matched the game on every byte, message and battle state.
- The calculator uses the same steps as the two routines, which a test compares with the battler's engine for every max HP, HP and damage it offers.
- Not tested: the Japanese versions and anything on a real Game Boy.
Questions
Does Explosion faint the user if it breaks a Substitute in Gen 1?
No. In Pokemon Red, Blue and Yellow, when a Substitute breaks, the game writes 0 over the attacker's move effect, so Explosion's and Selfdestruct's effect (the user fainting) never runs. If the Substitute survives the hit, or the move misses, the user faints as usual.
Does Substitute block sleep and paralysis in Gen 1?
No. Only poison moves, the moves that lower stats, Confuse Ray and Supersonic, and side effects of damaging moves check for a Substitute. Sleep moves, Thunder Wave, Stun Spore, Glare, Leech Seed, Disable, Mimic and Transform all reach the Pokemon behind it.
Can Substitute knock out its own user in Gen 1?
Yes. It costs a quarter of max HP, and it only fails when that would take HP below zero. With exactly a quarter left, the Pokemon makes the Substitute, drops to 0 HP and faints.
Can a Substitute have 0 HP?
Yes. A Substitute breaks only when the damage is more than its HP (or more than 255). Damage exactly equal to its HP leaves it standing at 0, and it takes one more hit of any size to break.
Do draining moves work on a Substitute in Gen 1?
In the English Red, Blue and Yellow, yes: Absorb, Mega Drain, Leech Life and Dream Eater hit it and heal the user by half the damage, unless the hit breaks it. The check meant to stop that never works, because fixing Swift moved it after a routine that overwrites the value it tests. In the Japanese Red and Green the check works, and those moves miss a Substitute.
Was this tested on a real Game Boy?
No. I read the routines in pret's disassembly and ran the game's own code in the PyBoy emulator, in Red and in Yellow, with the battler's battle oracle. The battler's engine matched the game in every case on this page.