CheckPickup::
	ld d, 0
	ld a, [wPartyCount]
	jr .handleLoop

.loop
	pop af
	jr z, .printPickupMessages
	sla d
.handleLoop
	dec a
	ld [wCurPartyMon], a
	push af
	ld hl, wPartySpecies
	ld c, a
	ld b, 0
	add hl, bc
	ld a, [hl]
	cp EGG
	jr z, .loop
	ld [wCurSpecies], a
	ld a, MON_DVS
	call GetPartyParamLocation
	push de
	call CalcMonAbility
	pop de
	cp ABILITY_PICKUP
	jr nz, .loop
	call Random
	cp 10 percent
	jr nc, .loop
	ld a, MON_ITEM
	call GetPartyParamLocation
	ld a, [hl]
	and a
	jr nz, .loop
	set 0, d
	push hl
	call Random
	ld b, a
	ld c, 0
	ld hl, .Chances
	jr .getProbabilityHandleLoop
.getProbabilityLoop
	inc c
.getProbabilityHandleLoop
	ld a, [hli]
	cp b
	jr c, .getProbabilityLoop
	ld b, 0
	ld a, 10
	ld hl, .Items
	rst AddNTimes
	ld a, MON_LEVEL
	call GetPartyParam
	dec a
	ld c, 10
	call SimpleDivide
	ld c, b
	ld b, 0
	add hl, bc
	ld a, [hl]
	pop hl
	ld [hl], a
	jr .loop

.printPickupMessages
	ld a, d
.printPickupMessagesLoop
	srl a
	push af
	call c, .PrintPickupMessage
	ld hl, wCurPartyMon
	inc [hl]
	pop af
	jr nz, .printPickupMessagesLoop
	ret

.PrintPickupMessage:
	ld a, [wCurPartyMon]
	ld hl, wPartyMonNicknames
	call SkipNames
	ld d, h
	ld e, l
	call CopyName1
	ld a, MON_ITEM
	call GetPartyParam
	ld [wd265], a
	call GetItemName
	ld hl, MonPickedUpPickupItem
	jp StdBattleTextBox

.Chances:
	db 30 percent
	db 40 percent
	db 50 percent
	db 60 percent
	db 70 percent
	db 80 percent
	db 90 percent
	db 94 percent
	db 98 percent
	db 99 percent
	db $ff

.Items:
; Row corresponds to the random value
; Col corresponds to the level bracket
	db POTION, ANTIDOTE, SUPER_POTION, GREAT_BALL, REPEL, ESCAPE_ROPE, FULL_HEAL, HYPER_POTION, ULTRA_BALL, REVIVE ; 30%
	db ANTIDOTE, SUPER_POTION, GREAT_BALL, REPEL, ESCAPE_ROPE, FULL_HEAL, HYPER_POTION, ULTRA_BALL, REVIVE, RARE_CANDY ; 10%
	db SUPER_POTION, GREAT_BALL, REPEL, ESCAPE_ROPE, FULL_HEAL, HYPER_POTION, ULTRA_BALL, REVIVE, RARE_CANDY, SUN_STONE ; 10%
	db GREAT_BALL, REPEL, ESCAPE_ROPE, FULL_HEAL, HYPER_POTION, ULTRA_BALL, REVIVE, RARE_CANDY, SUN_STONE, MOON_STONE ; 10%
	db REPEL, ESCAPE_ROPE, FULL_HEAL, HYPER_POTION, ULTRA_BALL, REVIVE, RARE_CANDY, SUN_STONE, MOON_STONE, HEART_SCALE ; 10%
	db ESCAPE_ROPE, FULL_HEAL, HYPER_POTION, ULTRA_BALL, REVIVE, RARE_CANDY, SUN_STONE, MOON_STONE, HEART_SCALE, FULL_RESTORE ; 10%
	db FULL_HEAL, HYPER_POTION, ULTRA_BALL, REVIVE, RARE_CANDY, SUN_STONE, MOON_STONE, HEART_SCALE, FULL_RESTORE, MAX_REVIVE ; 10%
	db HYPER_POTION, ULTRA_BALL, REVIVE, RARE_CANDY, SUN_STONE, MOON_STONE, HEART_SCALE, FULL_RESTORE, MAX_REVIVE, PP_UP ; 4%
	db ULTRA_BALL, REVIVE, RARE_CANDY, SUN_STONE, MOON_STONE, HEART_SCALE, FULL_RESTORE, MAX_REVIVE, PP_UP, MAX_ELIXIR ; 4%
	db HYPER_POTION, NUGGET, KINGS_ROCK, FULL_RESTORE, ETHER, EVERSTONE, BERSERK_GENE, ELIXIR, BERSERK_GENE, LEFTOVERS ; 1%
	db NUGGET, KINGS_ROCK, FULL_RESTORE, ETHER, EVERSTONE, BERSERK_GENE, ELIXIR, BERSERK_GENE, LEFTOVERS, BERSERK_GENE ; 1%