2016-06-12 00:24:04 +00:00
|
|
|
_GivePokemon:
|
2015-07-19 03:49:52 +00:00
|
|
|
; returns success in carry
|
|
|
|
; and whether the mon was added to the party in [wAddedToParty]
|
2014-05-22 22:13:20 +00:00
|
|
|
call EnableAutoTextBoxDrawing
|
|
|
|
xor a
|
2015-07-19 03:49:52 +00:00
|
|
|
ld [wAddedToParty], a
|
2015-07-03 19:37:53 +00:00
|
|
|
ld a, [wPartyCount]
|
2014-08-23 06:17:47 +00:00
|
|
|
cp PARTY_LENGTH
|
2015-07-19 03:49:52 +00:00
|
|
|
jr c, .addToParty
|
2015-08-31 02:38:41 +00:00
|
|
|
ld a, [wNumInBox]
|
2014-08-23 06:17:47 +00:00
|
|
|
cp MONS_PER_BOX
|
2015-07-19 03:49:52 +00:00
|
|
|
jr nc, .boxFull
|
|
|
|
; add to box
|
2014-05-22 22:13:20 +00:00
|
|
|
xor a
|
2015-08-31 02:38:41 +00:00
|
|
|
ld [wEnemyBattleStatus3], a
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [wcf91]
|
2014-06-14 11:12:40 +00:00
|
|
|
ld [wEnemyMonSpecies2], a
|
2014-08-09 05:39:13 +00:00
|
|
|
callab LoadEnemyMonData
|
2014-05-22 22:13:20 +00:00
|
|
|
call SetPokedexOwnedFlag
|
2015-02-08 06:18:42 +00:00
|
|
|
callab SendNewMonToBox
|
2014-05-26 21:04:56 +00:00
|
|
|
ld hl, wcf4b
|
2015-07-16 03:04:58 +00:00
|
|
|
ld a, [wCurrentBoxNum]
|
2014-05-22 22:13:20 +00:00
|
|
|
and $7f
|
2014-08-23 06:17:47 +00:00
|
|
|
cp 9
|
2015-07-19 03:49:52 +00:00
|
|
|
jr c, .singleDigitBoxNum
|
2014-08-23 06:17:47 +00:00
|
|
|
sub 9
|
|
|
|
ld [hl], "1"
|
2014-05-22 22:13:20 +00:00
|
|
|
inc hl
|
2014-08-23 06:17:47 +00:00
|
|
|
add "0"
|
2015-07-19 03:49:52 +00:00
|
|
|
jr .next
|
|
|
|
.singleDigitBoxNum
|
2014-08-23 06:17:47 +00:00
|
|
|
add "1"
|
2015-07-19 03:49:52 +00:00
|
|
|
.next
|
2014-05-22 22:13:20 +00:00
|
|
|
ld [hli], a
|
2014-08-23 06:17:47 +00:00
|
|
|
ld [hl], "@"
|
2020-05-26 11:10:55 +00:00
|
|
|
ld hl, SentToBoxText
|
2014-05-22 22:13:20 +00:00
|
|
|
call PrintText
|
|
|
|
scf
|
|
|
|
ret
|
2015-07-19 03:49:52 +00:00
|
|
|
.boxFull
|
2014-05-22 22:13:20 +00:00
|
|
|
ld hl, BoxIsFullText
|
|
|
|
call PrintText
|
|
|
|
and a
|
|
|
|
ret
|
2015-07-19 03:49:52 +00:00
|
|
|
.addToParty
|
2014-05-22 22:13:20 +00:00
|
|
|
call SetPokedexOwnedFlag
|
2014-06-16 20:03:05 +00:00
|
|
|
call AddPartyMon
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a, 1
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
|
2015-07-19 03:49:52 +00:00
|
|
|
ld [wAddedToParty], a
|
2014-05-22 22:13:20 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
SetPokedexOwnedFlag:
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [wcf91]
|
2014-05-22 22:13:20 +00:00
|
|
|
push af
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e], a
|
2014-06-16 20:57:26 +00:00
|
|
|
predef IndexToPokedex
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [wd11e]
|
2014-05-22 22:13:20 +00:00
|
|
|
dec a
|
|
|
|
ld c, a
|
2015-07-03 19:37:53 +00:00
|
|
|
ld hl, wPokedexOwned
|
2015-07-20 03:45:34 +00:00
|
|
|
ld b, FLAG_SET
|
2014-06-16 20:57:26 +00:00
|
|
|
predef FlagActionPredef
|
2014-05-22 22:13:20 +00:00
|
|
|
pop af
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e], a
|
2014-05-22 22:13:20 +00:00
|
|
|
call GetMonName
|
|
|
|
ld hl, GotMonText
|
|
|
|
jp PrintText
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
GotMonText:
|
2014-05-22 22:13:20 +00:00
|
|
|
TX_FAR _GotMonText
|
2016-07-18 06:17:03 +00:00
|
|
|
TX_SFX_ITEM_1
|
2014-05-22 22:13:20 +00:00
|
|
|
db "@"
|
|
|
|
|
2020-05-26 11:10:55 +00:00
|
|
|
SentToBoxText:
|
|
|
|
TX_FAR _SentToBoxText
|
2014-05-22 22:13:20 +00:00
|
|
|
db "@"
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
BoxIsFullText:
|
2014-05-22 22:13:20 +00:00
|
|
|
TX_FAR _BoxIsFullText
|
|
|
|
db "@"
|