ref: b8603ecb924de7f324bc1d7100c7268e746712fd
parent: dfa9adcaeb79f83087985192e1fb7052a1fe7143
parent: ec77075a471b55042340c232fe242bdc07cbf80b
author: yenatch <[email protected]>
date: Fri Oct 25 12:04:31 EDT 2013
Merge commit 'ec77075a' into merge-mrwint Conflicts: main.asm
--- a/main.asm
+++ b/main.asm
@@ -86879,32 +86879,45 @@
; 97d31
Function97d31: ; 97d31
+; Pick a random mon out of ContestMons.
+
.asm_97d31
call Random
cp 100 << 1
jr nc, .asm_97d31
srl a
- ld hl, Table97d87
+
+ ld hl, ContestMons
ld de, 4
-.asm_97d40
+.CheckMon
sub [hl]
- jr c, .asm_97d46
+ jr c, .GotMon
add hl, de
- jr .asm_97d40
+ jr .CheckMon
-.asm_97d46
+.GotMon
inc hl
+
+; Species
ld a, [hli]
ld [$d22e], a
+
+; Min level
ld a, [hli]
ld d, a
+
+; Max level
ld a, [hl]
+
sub d
- jr nz, .asm_97d54
+ jr nz, .RandomLevel
+
+; If min and max are the same.
ld a, d
- jr .asm_97d5f
+ jr .GotLevel
-.asm_97d54
+.RandomLevel
+; Get a random level between the min and max.
ld c, a
inc c
call Random
@@ -86912,8 +86925,9 @@
call SimpleDivide
add d
-.asm_97d5f
+.GotLevel
ld [CurPartyLevel], a
+
xor a
ret
; 97d64
@@ -86937,18 +86951,19 @@
ret
; 97d87
-Table97d87: ; 97d87
- db 20, $0a, $07, $12
- db 20, $0d, $07, $12
- db 10, $0b, $09, $12
- db 10, $0e, $09, $12
- db 5, $0c, $0c, $0f
- db 5, $0f, $0c, $0f
- db 10, $30, $0a, $10
- db 10, $2e, $0a, $11
- db 5, $7b, $0d, $0e
- db 5, $7f, $0d, $0e
- db -1, $31, $1e, $28
+ContestMons: ; 97d87
+ ; %, species, min, max
+ db 20, CATERPIE, 7, 18
+ db 20, WEEDLE, 7, 18
+ db 10, METAPOD, 9, 18
+ db 10, KAKUNA, 9, 18
+ db 5, BUTTERFREE, 12, 15
+ db 5, BEEDRILL, 12, 15
+ db 10, VENONAT, 10, 16
+ db 10, PARAS, 10, 17
+ db 5, SCYTHER, 13, 14
+ db 5, PINSIR, 13, 14
+ db -1, VENOMOTH, 30, 40
; 97db3
Function97db3: ; 97db3