recomment CheckShininess and CheckContestMon

This commit is contained in:
yenatch 2013-09-04 04:33:01 -04:00
parent 5888db3493
commit b417d08f2e

View File

@ -15094,57 +15094,82 @@ Function8a60: ; 8a60
; 8a68 ; 8a68
CheckShininess: ; 0x8a68 CheckShininess: ; 8a68
; given a pointer to Attack/Defense DV in bc, determine if monster is shiny. ; Check if a mon is shiny by DVs at bc.
; if shiny, set carry. ; Return carry if shiny.
ld l,c
ld h,b ld l, c
ld a,[hl] ld h, b
and a,%00100000 ; is attack DV xx1x?
jr z,.NotShiny ; Attack
ld a,[hli] ld a, [hl]
and a,%1111 and %0010 << 4
cp $A ; is defense DV 1010? jr z, .NotShiny
jr nz,.NotShiny
ld a,[hl] ; Defense
and a,%11110000 ld a, [hli]
cp $A0 ; is speed DV 1010? and %1111
jr nz,.NotShiny cp %1010
ld a,[hl] jr nz, .NotShiny
and a,%1111
cp $A ; is special DV 1010? ; Speed
jr nz,.NotShiny ld a, [hl]
and %1111 << 4
cp %1010 << 4
jr nz, .NotShiny
; Special
ld a, [hl]
and %1111
cp %1010
jr nz, .NotShiny
.Shiny
scf scf
ret ret
.NotShiny .NotShiny
and a ; clear carry flag and a
ret ret
; 8a88 ; 8a88
CheckContestMon: ; 8a88 CheckContestMon: ; 8a88
; Check a mon's DVs at hl in the bug catching contest.
; Return shiny if its DVs are good enough to place in the contest.
; Attack
ld a, [hl] ld a, [hl]
cp $a0 cp 10 << 4
jr c, .asm_8aa2 jr c, .Bad
; Defense
ld a, [hli] ld a, [hli]
and $f and $f
cp $a cp 10
jr c, .asm_8aa2 jr c, .Bad
; Speed
ld a, [hl] ld a, [hl]
cp $a0 cp 10 << 4
jr c, .asm_8aa2 jr c, .Bad
; Special
ld a, [hl] ld a, [hl]
and $f and $f
cp $a cp 10
jr c, .asm_8aa2 jr c, .Bad
.Good
scf scf
ret ret
.asm_8aa2 .Bad
and a and a
ret ret
; 8aa4 ; 8aa4
Function8aa4: ; 8aa4 Function8aa4: ; 8aa4
push de push de
push bc push bc