2016-03-27 09:47:28 -07:00
|
|
|
GetPokeBallWobble: ; f971 (3:7971)
|
|
|
|
; Returns whether a Poke Ball will wobble in the catch animation.
|
|
|
|
; Whether a Pokemon is caught is determined beforehand.
|
|
|
|
|
|
|
|
push de
|
|
|
|
|
|
|
|
ld a, [rSVBK]
|
|
|
|
ld d, a
|
|
|
|
push de
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, BANK(wBuffer2)
|
2016-03-27 09:47:28 -07:00
|
|
|
ld [rSVBK], a
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer2]
|
2016-03-27 09:47:28 -07:00
|
|
|
inc a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBuffer2], a
|
2016-03-27 09:47:28 -07:00
|
|
|
|
|
|
|
; Wobble up to 3 times.
|
|
|
|
cp 3 + 1
|
|
|
|
jr z, .finished
|
|
|
|
|
|
|
|
ld a, [wWildMon]
|
|
|
|
and a
|
|
|
|
ld c, 0 ; next
|
|
|
|
jr nz, .done
|
|
|
|
|
|
|
|
ld hl, .WobbleProbabilities
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer1]
|
2016-03-27 09:47:28 -07:00
|
|
|
ld b, a
|
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr nc, .checkwobble
|
|
|
|
inc hl
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.checkwobble
|
|
|
|
ld b, [hl]
|
|
|
|
call Random
|
|
|
|
cp b
|
|
|
|
ld c, 0 ; next
|
|
|
|
jr c, .done
|
|
|
|
ld c, 2 ; escaped
|
|
|
|
jr .done
|
|
|
|
|
|
|
|
.finished
|
|
|
|
ld a, [wWildMon]
|
|
|
|
and a
|
|
|
|
ld c, 1 ; caught
|
|
|
|
jr nz, .done
|
|
|
|
ld c, 2 ; escaped
|
|
|
|
|
|
|
|
.done
|
|
|
|
pop de
|
|
|
|
ld e, a
|
|
|
|
ld a, d
|
|
|
|
ld [rSVBK], a
|
|
|
|
ld a, e
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
|
|
|
.WobbleProbabilities: ; f9ba
|
|
|
|
; catch rate, chance of wobbling / 255
|
|
|
|
; nLeft/255 = (nRight/255) ** 4
|
|
|
|
db 1, 63
|
|
|
|
db 2, 75
|
|
|
|
db 3, 84
|
|
|
|
db 4, 90
|
|
|
|
db 5, 95
|
|
|
|
db 7, 103
|
|
|
|
db 10, 113
|
|
|
|
db 15, 126
|
|
|
|
db 20, 134
|
|
|
|
db 30, 149
|
|
|
|
db 40, 160
|
|
|
|
db 50, 169
|
|
|
|
db 60, 177
|
|
|
|
db 80, 191
|
|
|
|
db 100, 201
|
|
|
|
db 120, 211
|
|
|
|
db 140, 220
|
|
|
|
db 160, 227
|
|
|
|
db 180, 234
|
|
|
|
db 200, 240
|
|
|
|
db 220, 246
|
|
|
|
db 240, 251
|
|
|
|
db 254, 253
|
|
|
|
db 255, 255
|