summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChatot4444 <94812895+Chatot4444@users.noreply.github.com>2021-12-31 11:35:11 -0500
committerChatot4444 <94812895+Chatot4444@users.noreply.github.com>2021-12-31 11:35:11 -0500
commit903136875efebfd6f62c388f839b3c2b91a8ff7c (patch)
tree94421276fe31124ae0eb82a514da13a39f9062fd
parent2bd98dab1fb7f2e01339212b0a1eb24d9f13a605 (diff)
Updated Fix the 1 in 255 miss bug (markdown)
-rw-r--r--Fix-the-1-in-255-miss-bug.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/Fix-the-1-in-255-miss-bug.md b/Fix-the-1-in-255-miss-bug.md
index af77774..409e783 100644
--- a/Fix-the-1-in-255-miss-bug.md
+++ b/Fix-the-1-in-255-miss-bug.md
@@ -30,7 +30,7 @@ Here's where we insert the proper code.
+ ; The following snippet is taken from Pokemon Crystal, it fixes the above bug.
+ ld a, b
+ cp $FF ; Is the value $FF?
-+ jr z, .Hit ; If so, we need not calculate, just so we can fix this bug.
++ ret z ; If so, we need not calculate, just so we can fix this bug.
call BattleRandom
cp b
@@ -45,6 +45,6 @@ For anyone with GB Z80 experience, feel free to skip this part, but for anyone u
`ld a, b` loads the contents of register b into register a. This is done because b holds the move accuracy of the Pokémon currently using the move.
`cp $FF` just compares a to $FF, technically by subtracting $FF from a.
-`jr z, .Hit` jumps ahead to the label `.Hit` IF the Zero flag is set. Due to how cp works, this will be set if the compared value and a are equal. In other words... branch to .Hit if equal. Therefore, if move accuracy is $FF, therefore 100%, then it doesn't bother calculating if the move will miss: after all, the move's accuracy IS 100%. This occurs after other move accuracy calculations, so those will come into effect as well.
+`ret z` returns from this subroutine IF the Zero flag is set. Due to how cp works, this will be set if the compared value and a are equal. In other words... return if equal. Therefore, if move accuracy is $FF, therefore 100%, then it doesn't bother calculating if the move will miss: after all, the move's accuracy IS 100%. This occurs after other move accuracy calculations, so those will come into effect as well.
Enjoy! \ No newline at end of file