Clean up bugs commented in the source code (#912)

Co-authored-by: Rangi <remy.oukaour+rangi42@gmail.com>
This commit is contained in:
vulcandth
2022-07-09 16:12:02 -05:00
committed by GitHub
parent bd27c0d8dc
commit ef9b9bb437
49 changed files with 267 additions and 324 deletions

View File

@@ -210,6 +210,7 @@ ItemEffects:
; NoEffect would be appropriate, with the table then being NUM_ITEMS long.
PokeBallEffect:
; BUG: The Dude's catching tutorial may crash if his Poké Ball can't be used (see docs/bugs_and_glitches.md)
ld a, [wBattleMode]
dec a
jp nz, UseBallInTrainerBattle
@@ -226,6 +227,7 @@ PokeBallEffect:
jp z, Ball_BoxIsFullMessage
.room_in_party
; BUG: Using a Park Ball in non-Contest battles has a corrupt animation (see docs/bugs_and_glitches.md)
xor a
ld [wWildMon], a
ld a, [wCurItem]
@@ -334,17 +336,12 @@ PokeBallEffect:
jr nz, .statuscheck
ld a, 1
.statuscheck
; This routine is buggy. It was intended that SLP and FRZ provide a higher
; catch rate than BRN/PSN/PAR, which in turn provide a higher catch rate than
; no status effect at all. But instead, it makes BRN/PSN/PAR provide no
; benefit.
; Uncomment the line below to fix this.
; BUG: BRN/PSN/PAR do not affect catch rate (see docs/bugs_and_glitches.md)
ld b, a
ld a, [wEnemyMonStatus]
and 1 << FRZ | SLP_MASK
ld c, 10
jr nz, .addstatus
; ld a, [wEnemyMonStatus]
and a
ld c, 5
jr nz, .addstatus
@@ -356,13 +353,10 @@ PokeBallEffect:
ld a, $ff
.max_1
; BUG: farcall overwrites a, and GetItemHeldEffect takes b anyway.
; This is probably the reason the HELD_CATCH_CHANCE effect is never used.
; Uncomment the line below to fix.
; BUG: HELD_CATCH_CHANCE has no effect (see docs/bugs_and_glitches.md)
ld d, a
push de
ld a, [wBattleMonItem]
; ld b, a
farcall GetItemHeldEffect
ld a, b
cp HELD_CATCH_CHANCE
@@ -446,9 +440,7 @@ PokeBallEffect:
push af
set SUBSTATUS_TRANSFORMED, [hl]
; This code is buggy. Any wild Pokémon that has Transformed will be
; caught as a Ditto, even if it was something else like Mew.
; To fix, do not set [wTempEnemyMonSpecies] to DITTO.
; BUG: Catching a Transformed Pokémon always catches a Ditto (see docs/bugs_and_glitches.md)
bit SUBSTATUS_TRANSFORMED, a
jr nz, .ditto
jr .not_ditto
@@ -761,13 +753,10 @@ ParkBallMultiplier:
ret
HeavyBall_GetDexEntryBank:
; This function is buggy.
; It gets the wrong bank for Kadabra (64), Tauros (128), and Sunflora (192).
; Uncomment the line below to fix this.
; BUG: Heavy Ball uses wrong weight value for three Pokémon (see docs/bugs_and_glitches.md)
push hl
push de
ld a, [wEnemyMonSpecies]
; dec a
rlca
rlca
maskbits NUM_DEX_ENTRY_BANKS
@@ -905,9 +894,6 @@ LureBallMultiplier:
ret
MoonBallMultiplier:
; This function is buggy.
; Intent: multiply catch rate by 4 if mon evolves with moon stone
; Reality: no boost
push bc
ld a, [wTempEnemyMonSpecies]
dec a
@@ -931,9 +917,7 @@ MoonBallMultiplier:
inc hl
inc hl
; Moon Stone's constant from Pokémon Red is used.
; No Pokémon evolve with Burn Heal,
; so Moon Balls always have a catch rate of 1×.
; BUG: Moon Ball does not boost catch rate (see docs/bugs_and_glitches.md)
push bc
ld a, BANK("Evolutions and Attacks")
call GetFarByte
@@ -951,9 +935,6 @@ MoonBallMultiplier:
ret
LoveBallMultiplier:
; This function is buggy.
; Intent: multiply catch rate by 8 if mons are of same species, different sex
; Reality: multiply catch rate by 8 if mons are of same species, same sex
; does species match?
ld a, [wTempEnemyMonSpecies]
@@ -974,9 +955,9 @@ LoveBallMultiplier:
jr c, .done1 ; no effect on genderless
ld d, 0 ; male
jr nz, .playermale
jr nz, .got_player_gender
inc d ; female
.playermale
.got_player_gender
; check wild mon species
push de
@@ -988,15 +969,16 @@ LoveBallMultiplier:
jr c, .done2 ; no effect on genderless
ld d, 0 ; male
jr nz, .wildmale
jr nz, .got_wild_gender
inc d ; female
.wildmale
.got_wild_gender
; BUG: Love Ball boosts catch rate for the wrong gender (see docs/bugs_and_glitches.md)
ld a, d
pop de
cp d
pop bc
ret nz ; for the intended effect, this should be "ret z"
ret nz
sla b
jr c, .max
@@ -1016,17 +998,13 @@ LoveBallMultiplier:
ret
FastBallMultiplier:
; This function is buggy.
; Intent: multiply catch rate by 4 if enemy mon is in one of the three
; FleeMons tables.
; Reality: multiply catch rate by 4 if enemy mon is one of the first three in
; the first FleeMons table.
ld a, [wTempEnemyMonSpecies]
ld c, a
ld hl, FleeMons
ld d, 3
.loop
; BUG: Fast Ball only boosts catch rate for three Pokémon (see docs/bugs_and_glitches.md)
ld a, BANK(FleeMons)
call GetFarByte
@@ -1034,7 +1012,7 @@ FastBallMultiplier:
cp -1
jr z, .next
cp c
jr nz, .next ; for the intended effect, this should be "jr nz, .loop"
jr nz, .next
sla b
jr c, .max