-
Notifications
You must be signed in to change notification settings - Fork 833
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
base: master
Are you sure you want to change the base?
Changes from all commits
6508421
08358d8
497eb87
12e5c90
6f430d4
8a4d9ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -108,36 +108,18 @@ CalcMagikarpLength: | |||||||||||||||||||
; de: wEnemyMonDVs | ||||||||||||||||||||
; bc: wPlayerID | ||||||||||||||||||||
|
||||||||||||||||||||
; This function is poorly commented. | ||||||||||||||||||||
|
||||||||||||||||||||
; In short, it generates a value between 190 and 1786 using | ||||||||||||||||||||
; a Magikarp's DVs and its trainer ID. This value is further | ||||||||||||||||||||
; filtered in LoadEnemyMon to make longer Magikarp even rarer. | ||||||||||||||||||||
; 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. | ||||||||||||||||||||
Comment on lines
+111
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The comment about being further filtered in |
||||||||||||||||||||
|
||||||||||||||||||||
; The value is generated from a lookup table. | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
; The index is determined by the dv xored with the player's trainer id. | ||||||||||||||||||||
|
||||||||||||||||||||
; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id) | ||||||||||||||||||||
; The index is determined by the DV xored with the player's trainer ID | ||||||||||||||||||||
; and then stored in bc. | ||||||||||||||||||||
Comment on lines
+116
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The player's Trainer ID is only used when called from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case it can feel misleading if we don't also clarify it uses the Player's ID when fighting against a wild Magikarp. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's completely reasonable. Perhaps something like this would be better
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It sounds better. |
||||||||||||||||||||
|
||||||||||||||||||||
; if bc < 10: [wMagikarpLength] = c + 190 | ||||||||||||||||||||
; if bc ≥ $ff00: [wMagikarpLength] = c + 1370 | ||||||||||||||||||||
; if bc < 10: [wMagikarpLength] = bc + 190 | ||||||||||||||||||||
; if bc ≥ 65510: [wMagikarpLength] = bc - 65510 + 1600 | ||||||||||||||||||||
; else: [wMagikarpLength] = z * 100 + (bc - x) / y | ||||||||||||||||||||
|
||||||||||||||||||||
; X, Y, and Z depend on the value of b as follows: | ||||||||||||||||||||
|
||||||||||||||||||||
; if b = 0: x = 310, y = 2, z = 3 | ||||||||||||||||||||
; if b = 1: x = 710, y = 4, z = 4 | ||||||||||||||||||||
; if b = 2-9: x = 2710, y = 20, z = 5 | ||||||||||||||||||||
; if b = 10-29: x = 7710, y = 50, z = 6 | ||||||||||||||||||||
; if b = 30-68: x = 17710, y = 100, z = 7 | ||||||||||||||||||||
; if b = 69-126: x = 32710, y = 150, z = 8 | ||||||||||||||||||||
; if b = 127-185: x = 47710, y = 150, z = 9 | ||||||||||||||||||||
; if b = 186-224: x = 57710, y = 100, z = 10 | ||||||||||||||||||||
; if b = 225-243: x = 62710, y = 50, z = 11 | ||||||||||||||||||||
; if b = 244-251: x = 64710, y = 20, z = 12 | ||||||||||||||||||||
; if b = 252-253: x = 65210, y = 5, z = 13 | ||||||||||||||||||||
; if b = 254: x = 65410, y = 2, z = 14 | ||||||||||||||||||||
|
||||||||||||||||||||
; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id) | ||||||||||||||||||||
|
||||||||||||||||||||
; id | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are only the inputs when called from
LoadEnemyMon
in engine/battle/core.asm. When called fromCheckMagikarpLength
, the inputs areMON_DVS
andMON_ID
. (This distinction is important, asMON_ID
is the Original Trainer's ID, not the player's.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I'll address your suggestions when I get my laptop back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be
MON_OT_ID
now.