Catch rate glitches (Generation II): Difference between revisions

From Glitch City Wiki
Jump to navigation Jump to search
Content added Content deleted
>Sherkel
No edit summary
>Bbbbbbbbba
(Explanation and easier fix)
Line 1: Line 1:
In {{GSC}}, if the opposing Pokémon's catch rate is not affected if it is burned, poisoned, or paralyzed, despite those conditions increasing catch rate in other generations and the code seeming to attempt to factor them in. Sleep and freeze still affect the catch rate as intended.
In {{GSC}}, a wild Pokémon's catch rate is not affected if it is burned, poisoned, or paralyzed, despite those conditions increasing catch rate in other generations and the code seeming to attempt to factor them in. Sleep and freeze still affect the catch rate as intended.


==Explanation==
==Explanation==
Line 9: Line 9:
ld c, 10
ld c, 10
jr nz, .done
jr nz, .done
; ld a, [wEnemyMonStatus] ; bugfix
and a
and a
ld c, 5
ld c, 5
Line 15: Line 16:
.done
.done


What the code does is set a value increasing catch rate (referred to as "a" in Bulbapedia's explanation, linked below) to 10 if the opponent is asleep or frozen, and do nothing otherwise. The next few lines are presumably intended to set the value to 5 if there is a different status condition present; however, the "jr nz" preceding it prevents this from being able to occur, as WildPokemonStatus will not be 0.
What the code does is set a value increasing catch rate (referred to as "a" in Bulbapedia's explanation, linked below) to 10 if the opponent is asleep or frozen, and do nothing otherwise. The next few lines are presumably intended to set the value to 5 if there is a different status condition present; however, since the value of register <code>a</code> is already <code>WildPokemonStatus & (SLP|FRZ)</code>, the second <code>jr nz, .done</code> is never taken, and the value is set to 0 anyway.


Inserting the commented line would fix this glitch.
One possible fix would be modifying the code to the following:

ld b, a
ld a, [WildPokemonStatus]
and a
ld c, 0
jr z, .done
and SLP|FRZ
ld c, 10
jr nz, .done
ld c, 5
.done

This would instead set c to 5 if the opponent was inflicted by a status condition but not asleep of frozen before jumping to ".done", rather than doing so prematurely.


==See also==
==See also==

Revision as of 03:15, 28 February 2019

In Pokémon Gold, Silver and Crystal, a wild Pokémon's catch rate is not affected if it is burned, poisoned, or paralyzed, despite those conditions increasing catch rate in other generations and the code seeming to attempt to factor them in. Sleep and freeze still affect the catch rate as intended.

Explanation

The code for factoring status conditions into catch rate reads as follows:

       ld b, a
       ld a, [WildPokemonStatus]
       and SLP|FRZ
       ld c, 10
       jr nz, .done
       ; ld a, [wEnemyMonStatus] ; bugfix
       and a
       ld c, 5
       jr nz, .done
       ld c, 0
       .done

What the code does is set a value increasing catch rate (referred to as "a" in Bulbapedia's explanation, linked below) to 10 if the opponent is asleep or frozen, and do nothing otherwise. The next few lines are presumably intended to set the value to 5 if there is a different status condition present; however, since the value of register a is already WildPokemonStatus & (SLP|FRZ), the second jr nz, .done is never taken, and the value is set to 0 anyway.

Inserting the commented line would fix this glitch.

See also

Attriution

  • IIMarckus for discovery and the corrected code, in addition to everyone who helped with pokegold and pokecrystal.