More comments and labels for ball catch rates.

This commit is contained in:
IIMarckus
2014-10-24 00:18:48 -06:00
parent 81e2a3f0cf
commit b4df25a1e1
2 changed files with 107 additions and 98 deletions

View File

@@ -245,7 +245,7 @@ ParkBall: ; e8a2
jp z, .asm_e99c jp z, .asm_e99c
ld a, [CurItem] ld a, [CurItem]
ld c, a ld c, a
ld hl, Table_0xec0a ld hl, BallMultiplierFunctionTable
.asm_e8f2 .asm_e8f2
ld a, [hli] ld a, [hli]
@@ -329,19 +329,23 @@ ParkBall: ; e8a2
ld a, [$ffb6] ld a, [$ffb6]
and a and a
jr nz, .asm_e960 jr nz, .statuscheck
ld a, 1 ld a, 1
.asm_e960 .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.
ld b, a ld b, a
ld a, [EnemyMonStatus] ld a, [EnemyMonStatus]
and 1 << FRZ | SLP and 1 << FRZ | SLP
ld c, 10 ld c, 10
jr nz, .asm_e971 jr nz, .addstatus
and a and a
ld c, 5 ld c, 5
jr nz, .asm_e971 jr nz, .addstatus
ld c, 0 ld c, 0
.asm_e971 .addstatus
ld a, b ld a, b
add c add c
jr nc, .asm_e977 jr nc, .asm_e977
@@ -725,34 +729,30 @@ ParkBall: ; e8a2
; ec0a ; ec0a
Table_0xec0a: ; ec0a BallMultiplierFunctionTable:
; Note: SAFARI_BALL does not exist. ; table of routines that increase or decrease the catch rate based on
dbw ULTRA_BALL, UltraBallChance ; which ball is used in a certain situation.
dbw GREAT_BALL, GreatBallChance dbw ULTRA_BALL, UltraBallMultiplier
dbw SAFARI_BALL, SafariBallChance dbw GREAT_BALL, GreatBallMultiplier
dbw HEAVY_BALL, HeavyBallChance dbw 8, GreatBallMultiplier ; Safari Ball, leftover from RBY
dbw LEVEL_BALL, LevelBallChance dbw HEAVY_BALL, HeavyBallMultiplier
dbw LURE_BALL, LureBallChance dbw LEVEL_BALL, LevelBallMultiplier
dbw FAST_BALL, FastBallChance dbw LURE_BALL, LureBallMultiplier
dbw MOON_BALL, MoonBallChance dbw FAST_BALL, FastBallMultiplier
dbw LOVE_BALL, LoveBallChance dbw MOON_BALL, MoonBallMultiplier
dbw PARK_BALL, ParkBallChance dbw LOVE_BALL, LoveBallMultiplier
dbw PARK_BALL, GreatBallMultiplier
db $ff db $ff
; ec29
UltraBallMultiplier:
UltraBallChance: ; ec29 ; multiply catch rate by 2
; x2
sla b sla b
ret nc ret nc
ld b, $ff ld b, $ff
ret ret
; ec2f
GreatBallChance: ; ec2f GreatBallMultiplier:
ParkBallChance: ; multiply catch rate by 1.5
SafariBallChance:
; x1.5
ld a, b ld a, b
srl a srl a
add b add b
@@ -760,10 +760,8 @@ SafariBallChance:
ret nc ret nc
ld b, $ff ld b, $ff
ret ret
; ec38
GetPokedexEntryBank:
GetPokedexEntryBank: ; ec38
push hl push hl
push de push de
ld a, [EnemyMonSpecies] ld a, [EnemyMonSpecies]
@@ -790,9 +788,13 @@ GLOBAL PokedexEntries4
db BANK(PokedexEntries2) db BANK(PokedexEntries2)
db BANK(PokedexEntries3) db BANK(PokedexEntries3)
db BANK(PokedexEntries4) db BANK(PokedexEntries4)
; ec50
HeavyBallChance: ; ec50 HeavyBallMultiplier:
; subtract 20 from catch rate if weight < 102.4 kg
; else add 0 to catch rate if weight < 204.8 kg
; else add 20 to catch rate if weight < 307.2 kg
; else add 30 to catch rate if weight < 409.6 kg
; else add 40 to catch rate (never happens)
ld a, [EnemyMonSpecies] ld a, [EnemyMonSpecies]
ld hl, PokedexDataPointerTable ld hl, PokedexDataPointerTable
dec a dec a
@@ -825,17 +827,18 @@ HeavyBallChance: ; ec50
srl b srl b
rr c rr c
endr endr
call .asm_ec99 call .subbc
srl b srl b
rr c rr c
call .asm_ec99 call .subbc
ld a, h ld a, h
pop bc pop bc
jr .asm_eca4 jr .compare
.asm_ec99 .subbc
; subtract bc from hl
push bc push bc
ld a, b ld a, b
cpl cpl
@@ -848,21 +851,21 @@ HeavyBallChance: ; ec50
pop bc pop bc
ret ret
.asm_eca4 .compare
ld c, a ld c, a
cp $4 cp 1024 >> 8 ; 102.4 kg
jr c, .asm_ecbc jr c, .lightmon
ld hl, .table_ecc4 ld hl, .WeightsTable
.asm_ecac .lookup
ld a, c ld a, c
cp [hl] cp [hl]
jr c, .asm_ecb4 jr c, .heavymon
inc hl inc hl
inc hl inc hl
jr .asm_ecac jr .lookup
.asm_ecb4 .heavymon
inc hl inc hl
ld a, b ld a, b
add [hl] add [hl]
@@ -871,7 +874,7 @@ HeavyBallChance: ; ec50
ld b, $ff ld b, $ff
ret ret
.asm_ecbc .lightmon
ld a, b ld a, b
sub 20 sub 20
ld b, a ld b, a
@@ -879,15 +882,15 @@ HeavyBallChance: ; ec50
ld b, $1 ld b, $1
ret ret
.table_ecc4 .WeightsTable
db 8, 0 ; weight factor, boost
db 12, 20 db 2048 >> 8, 0
db 16, 30 db 3072 >> 8, 20
db 255, 40 db 4096 >> 8, 30
; eccc db 65280 >> 8, 40
LureBallMultiplier:
LureBallChance: ; eccc ; multiply catch rate by 3 if this is a fishing rod battle
ld a, [BattleType] ld a, [BattleType]
cp BATTLETYPE_FISH cp BATTLETYPE_FISH
ret nz ret nz
@@ -903,10 +906,11 @@ LureBallChance: ; eccc
.done .done
ld b, a ld b, a
ret ret
; ecdd
MoonBallMultiplier:
MoonBallChance: ; ecdd ; This function is buggy.
; Intent: multiply catch rate by 4 if mon evolves with moon stone
; Reality: no boost
GLOBAL EvosAttacks GLOBAL EvosAttacks
GLOBAL EvosAttacksPointers GLOBAL EvosAttacksPointers
@@ -934,17 +938,13 @@ GLOBAL EvosAttacksPointers
inc hl inc hl
inc hl inc hl
; It appears that Moon Stone's ; Moon Stone's constant from Pokémon Red is used.
; constant from Pokémon Red is used. ; No Pokémon evolve with Burn Heal,
; so Moon Balls always have a catch rate of 1×.
; No Pokémon evolve with Burn Heal,
; so Moon Balls always have
; a catch rate of 1x.
push bc push bc
ld a, BANK(EvosAttacks) ld a, BANK(EvosAttacks)
call GetFarByte call GetFarByte
cp MOON_STONE_RED ; BURN_HEAL cp MOON_STONE_RED ; BURN_HEAL (in Red)
pop bc pop bc
ret nz ret nz
@@ -956,16 +956,20 @@ GLOBAL EvosAttacksPointers
ld b, $ff ld b, $ff
.done .done
ret ret
; ed12
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
LoveBallChance: ; ed12 ; does species match?
ld a, [TempEnemyMonSpecies] ld a, [TempEnemyMonSpecies]
ld c, a ld c, a
ld a, [TempBattleMonSpecies] ld a, [TempBattleMonSpecies]
cp c cp c
ret nz ret nz
; check player mon species
push bc push bc
ld a, [TempBattleMonSpecies] ld a, [TempBattleMonSpecies]
ld [CurPartySpecies], a ld [CurPartySpecies], a
@@ -974,52 +978,56 @@ LoveBallChance: ; ed12
ld a, [CurBattleMon] ld a, [CurBattleMon]
ld [CurPartyMon], a ld [CurPartyMon], a
callba GetGender callba GetGender
jr c, .asm_ed66 jr c, .done1 ; no effect on genderless
ld d, 0 ld d, 0 ; male
jr nz, .asm_ed39 jr nz, .playermale
inc d inc d ; female
.asm_ed39 .playermale
; check wild mon species
push de push de
ld a, [TempEnemyMonSpecies] ld a, [TempEnemyMonSpecies]
ld [CurPartySpecies], a ld [CurPartySpecies], a
ld a, WILDMON ld a, WILDMON
ld [MonType], a ld [MonType], a
callba GetGender callba GetGender
jr c, .asm_ed65 jr c, .done2 ; no effect on genderless
ld d, 0 ld d, 0 ; male
jr nz, .asm_ed52 jr nz, .wildmale
inc d inc d ; female
.asm_ed52 .wildmale
ld a, d ld a, d
pop de pop de
cp d cp d
pop bc pop bc
ret nz ret nz ; for the intended effect, this should be “ret z”
sla b sla b
jr c, .asm_ed62 jr c, .max
sla b sla b
jr c, .asm_ed62 jr c, .max
sla b sla b
ret nc ret nc
.asm_ed62 .max
ld b, $ff ld b, $ff
ret ret
.asm_ed65 .done2
pop de pop de
.asm_ed66 .done1
pop bc pop bc
ret ret
; ed68
FastBallMultiplier:
FastBallChance: ; ed68 ; 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, [TempEnemyMonSpecies] ld a, [TempEnemyMonSpecies]
ld c, a ld c, a
ld hl, FleeMons ld hl, FleeMons
@@ -1033,7 +1041,7 @@ FastBallChance: ; ed68
cp -1 cp -1
jr z, .next jr z, .next
cp c cp c
jr nz, .next jr nz, .next ; for the intended effect, this should be “jr nz, .loop”
sla b sla b
jr c, .max jr c, .max
@@ -1048,35 +1056,34 @@ FastBallChance: ; ed68
dec d dec d
jr nz, .loop jr nz, .loop
ret ret
; ed8c
LevelBallMultiplier:
LevelBallChance: ; ed8c ; multiply catch rate by 8 if player mon level / 4 > enemy mon level
; multiply catch rate by 4 if player mon level / 2 > enemy mon level
; multiply catch rate by 2 if player mon level > enemy mon level
ld a, [BattleMonLevel] ld a, [BattleMonLevel]
ld c, a ld c, a
ld a, [EnemyMonLevel] ld a, [EnemyMonLevel]
cp c cp c
ret nc ret nc ; if player is lower level, we're done here
sla b sla b
jr c, .max jr c, .max
srl c srl c
cp c cp c
ret nc ret nc ; if player/2 is lower level, we're done here
sla b sla b
jr c, .max jr c, .max
srl c srl c
cp c cp c
ret nc ret nc ; if player/4 is lower level, we're done here
sla b sla b
ret nc ret nc
.max .max
ld b, $ff ld b, $ff
ret ret
; edab
UnknownText_0xedab: ; 0xedab UnknownText_0xedab: ; 0xedab
; It dodged the thrown BALL! This #MON can't be caught! ; It dodged the thrown BALL! This #MON can't be caught!

View File

@@ -59442,11 +59442,13 @@ String_50bb5: ; 50bb5
GetGender: ; 50bdd GetGender: ; 50bdd
; Return the gender of a given monster in a. ; Return the gender of a given monster (CurPartyMon/CurOTMon/CurWildMon).
; When calling this function, a should be set to an appropriate MonType value.
; 1: male ; return values:
; 0: female ; a = 1: f = nc|nz; male
; c: genderless ; a = 0: f = nc|z; female
; f = c: genderless
; This is determined by comparing the Attack and Speed DVs ; This is determined by comparing the Attack and Speed DVs
; with the species' gender ratio. ; with the species' gender ratio.