2016-03-27 16:47:28 +00: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-02 21:46:40 +00:00
|
|
|
ld a, BANK(Buffer2)
|
2016-03-27 16:47:28 +00:00
|
|
|
ld [rSVBK], a
|
|
|
|
|
|
|
|
ld a, [Buffer2]
|
|
|
|
inc a
|
|
|
|
ld [Buffer2], a
|
|
|
|
|
|
|
|
; Wobble up to 3 times.
|
|
|
|
cp 3 + 1
|
|
|
|
jr z, .finished
|
|
|
|
|
|
|
|
ld a, [wWildMon]
|
|
|
|
and a
|
|
|
|
ld c, 0 ; next
|
|
|
|
jr nz, .done
|
|
|
|
|
2018-01-26 02:34:42 +00:00
|
|
|
ld hl, WobbleProbabilities
|
2016-03-27 16:47:28 +00:00
|
|
|
ld a, [Buffer1]
|
|
|
|
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
|
|
|
|
|
2018-01-26 02:34:42 +00:00
|
|
|
INCLUDE "data/battle/wobble_probabilities.asm"
|