Jump to content

Substitute drain move not missing glitch: Difference between revisions

The cleanup I promised.
>ISSOtm
(Created the page for the glitch.)
 
>Bbbbbbbbba
(The cleanup I promised.)
Line 1:
{{Misc R/B/Y}}
 
The '''Substitute drain move not missing''' is a minor battle glitch in English {{RBY}}, where HP draining moves don't miss against a Subsitutesubstitute, even though they should (and they do in {{RGB}} as well as in {{JY}}). It is considered a glitch in the English versions, because the disassembly shows that the games do contain the piece of code to make HP draining moves miss against a substitute, but it ceases to work due to the fix for the [[Swift miss glitch]].
 
Furthermore, this glitch makes it possible to "drain HP" from a substitute.
 
 
== How to perform ==
When a Pokémon ishas undera the effect of the attack Substitutesubstitute and the opposing Pokémon uses an HP-draining move (such asincluding Absorb, Mega Drain, orLeech Life, and Dream Eater), the move may hit.
 
Note that this glitch does not exist in any of the Japanese games.
Line 12 ⟶ 14:
== Involved code ==
Source : [https://github.com/pret/pokered/blob/77c3e22a4ecd3dc81918f00c548cef7c634f3419/engine/battle/core.asm#L5459 Pokéred], [https://github.com/pret/pokeyellow/blob/707ba908f780d42e1f26af85bef0bf0eb478b877/engine/battle/core.asm#L5624 Pokéyellow]
ld a, [de] ; [de] contains the effect of the move
ld a,[de]
cp a, SWIFT_EFFECT
ret z ; If the move is Swift, bypass the accuracy check altogether
ret z
call CheckTargetSubstitute ; * Does the opponent have a substitute?
jr z, .checkForDigOrFlyStatus ; * If not, skip the two checks below
cp a, DRAIN_HP_EFFECT
jp z, .moveMissed ; Draining moves should miss unconditionally against substitutes
jp z,.moveMissed
cp a, DREAM_EATER_EFFECT
jp z, .moveMissed ; Same for Dream Eater
.checkForDigOrFlyStatus
[de] contains the move effect, which makes the SWIFT_EFFECT check successful.
 
In the Japanese versions, the two lines marked with "*" are above <code>ld a, [de]</code> instead. As a result, they skip all ''three'' checks shown here, causing the [[Swift miss glitch]].
However, CheckTargetSubstitute overwrites a with either 0 or 1, so the following comparisons fail.
 
In the English versions, those lines are moved down, fixing the Swift miss glitch. However, the function CheckTargetSubstitute overwrites register <code>a</code> with either 0 or 1, so the two checks below will always fail, making drain moves able to hit substitutes.
 
 
== Video demonstration ==
{{youtube|Rrn4rtQXYQ0|ChickasaurusGL}}
 
 
== References ==
* [https://forums.glitchcity.info/index.php?topic=7522.msg200679#msg200679 IceFlame's analysis of the code involved] (see the [https://pastebin.com/nJzRK337 linked pastebin])
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.