Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation about Magikarp length calculation and bugfix about "Magikarp lengths can be miscalculated" #1100

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/bugs_and_glitches.md
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,7 @@ CopyPokemonName_Buffer1_Buffer3:
cp d
ret c
- ret nc
+ ret nz
ld a, c
cp e
ret
Expand Down
5 changes: 3 additions & 2 deletions engine/events/magikarp.asm
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,13 @@ CalcMagikarpLength:

; This function is poorly commented.

; In short, it generates a value between 190 and 1786 using
; In short, it generates a value between 190 and 1755 using
; a Magikarp's DVs and its trainer ID. This value is further
; filtered in LoadEnemyMon to make longer Magikarp even rarer.
; Due to the bug at .BCLessThanDE, the max possible value is 1625.
Idain marked this conversation as resolved.
Show resolved Hide resolved

; The value is generated from a lookup table.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
; The value is generated from a lookup table.
; The length is generated from a lookup table.

; The index is determined by the dv xored with the player's trainer id.
; The index is determined by the dv xored with the player's trainer ID.

; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id)

Expand Down