2018-06-24 07:09:41 -07:00
|
|
|
CheckPartyFullAfterContest:
|
2020-06-17 14:03:38 -07:00
|
|
|
ld a, [wContestMonSpecies]
|
2017-12-15 17:10:54 -08:00
|
|
|
and a
|
|
|
|
jp z, .DidntCatchAnything
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
ld [wCurSpecies], a
|
2017-12-15 17:10:54 -08:00
|
|
|
call GetBaseData
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyCount
|
2017-12-15 17:10:54 -08:00
|
|
|
ld a, [hl]
|
2018-01-11 09:00:01 -08:00
|
|
|
cp PARTY_LENGTH
|
2017-12-15 17:10:54 -08:00
|
|
|
jp nc, .TryAddToBox
|
|
|
|
inc a
|
|
|
|
ld [hl], a
|
|
|
|
ld c, a
|
2018-01-11 09:00:01 -08:00
|
|
|
ld b, 0
|
2017-12-15 17:10:54 -08:00
|
|
|
add hl, bc
|
2020-06-17 14:03:38 -07:00
|
|
|
ld a, [wContestMonSpecies]
|
2017-12-15 17:10:54 -08:00
|
|
|
ld [hli], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
2018-01-11 09:00:01 -08:00
|
|
|
ld a, -1
|
2017-12-15 17:10:54 -08:00
|
|
|
ld [hl], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1Species
|
|
|
|
ld a, [wPartyCount]
|
2017-12-15 17:10:54 -08:00
|
|
|
dec a
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld hl, wContestMon
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2017-12-15 17:10:54 -08:00
|
|
|
dec a
|
2021-03-17 13:16:02 -07:00
|
|
|
ld hl, wPartyMonOTs
|
2017-12-15 17:10:54 -08:00
|
|
|
call SkipNames
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerName
|
2017-12-15 17:10:54 -08:00
|
|
|
call CopyBytes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2017-12-15 17:10:54 -08:00
|
|
|
call GetPokemonName
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wStringBuffer1
|
2017-12-15 17:10:54 -08:00
|
|
|
ld de, wMonOrItemNameBuffer
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2017-12-15 17:10:54 -08:00
|
|
|
call CopyBytes
|
|
|
|
call GiveANickname_YesNo
|
|
|
|
jr c, .Party_SkipNickname
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2017-12-15 17:10:54 -08:00
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
2017-12-15 17:10:54 -08:00
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ld de, wMonOrItemNameBuffer
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar InitNickname
|
2017-12-15 17:10:54 -08:00
|
|
|
|
|
|
|
.Party_SkipNickname:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2017-12-15 17:10:54 -08:00
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMonNicknames
|
2017-12-15 17:10:54 -08:00
|
|
|
call SkipNames
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld hl, wMonOrItemNameBuffer
|
|
|
|
call CopyBytes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2017-12-15 17:10:54 -08:00
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1Level
|
2017-12-15 17:10:54 -08:00
|
|
|
call GetPartyLocation
|
|
|
|
ld a, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyLevel], a
|
2017-12-15 17:10:54 -08:00
|
|
|
call SetCaughtData
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2017-12-15 17:10:54 -08:00
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1CaughtLocation
|
2017-12-15 17:10:54 -08:00
|
|
|
call GetPartyLocation
|
|
|
|
ld a, [hl]
|
2018-01-11 09:00:01 -08:00
|
|
|
and CAUGHT_GENDER_MASK
|
2017-12-15 17:10:54 -08:00
|
|
|
ld [hl], a
|
|
|
|
xor a
|
2020-06-17 14:03:38 -07:00
|
|
|
ld [wContestMonSpecies], a
|
2018-01-11 22:40:20 -08:00
|
|
|
and a ; BUGCONTEST_CAUGHT_MON
|
2023-09-30 10:12:57 -07:00
|
|
|
ldh [hScriptVar], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.TryAddToBox:
|
2017-12-15 17:10:54 -08:00
|
|
|
ld a, BANK(sBoxCount)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2017-12-15 17:10:54 -08:00
|
|
|
ld hl, sBoxCount
|
|
|
|
ld a, [hl]
|
|
|
|
cp MONS_PER_BOX
|
|
|
|
call CloseSRAM
|
|
|
|
jr nc, .BoxFull
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ld hl, wContestMon
|
|
|
|
ld de, wBufferMon
|
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerName
|
2017-12-15 17:10:54 -08:00
|
|
|
ld de, wBufferMonOT
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar InsertPokemonIntoBox
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2017-12-15 17:10:54 -08:00
|
|
|
call GetPokemonName
|
|
|
|
call GiveANickname_YesNo
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wStringBuffer1
|
2017-12-15 17:10:54 -08:00
|
|
|
jr c, .Box_SkipNickname
|
|
|
|
ld a, BOXMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ld de, wMonOrItemNameBuffer
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar InitNickname
|
2017-12-15 17:10:54 -08:00
|
|
|
ld hl, wMonOrItemNameBuffer
|
|
|
|
|
|
|
|
.Box_SkipNickname:
|
|
|
|
ld a, BANK(sBoxMonNicknames)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2017-12-15 17:10:54 -08:00
|
|
|
ld de, sBoxMonNicknames
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2017-12-15 17:10:54 -08:00
|
|
|
call CopyBytes
|
|
|
|
call CloseSRAM
|
|
|
|
|
|
|
|
.BoxFull:
|
|
|
|
ld a, BANK(sBoxMon1Level)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2017-12-15 17:10:54 -08:00
|
|
|
ld a, [sBoxMon1Level]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyLevel], a
|
2017-12-15 17:10:54 -08:00
|
|
|
call CloseSRAM
|
|
|
|
call SetBoxMonCaughtData
|
|
|
|
ld a, BANK(sBoxMon1CaughtLocation)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2017-12-15 17:10:54 -08:00
|
|
|
ld hl, sBoxMon1CaughtLocation
|
|
|
|
ld a, [hl]
|
2018-01-11 09:00:01 -08:00
|
|
|
and CAUGHT_GENDER_MASK
|
2017-12-15 17:10:54 -08:00
|
|
|
ld [hl], a
|
|
|
|
call CloseSRAM
|
|
|
|
xor a
|
|
|
|
ld [wContestMon], a
|
2018-01-11 22:40:20 -08:00
|
|
|
ld a, BUGCONTEST_BOXED_MON
|
2023-09-30 10:12:57 -07:00
|
|
|
ldh [hScriptVar], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.DidntCatchAnything:
|
2018-01-11 22:40:20 -08:00
|
|
|
ld a, BUGCONTEST_NO_CATCH
|
2023-09-30 10:12:57 -07:00
|
|
|
ldh [hScriptVar], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GiveANickname_YesNo:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, CaughtAskNicknameText
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2017-12-15 17:10:54 -08:00
|
|
|
jp YesNoBox
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
CaughtAskNicknameText:
|
|
|
|
text_far _CaughtAskNicknameText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2017-12-15 17:10:54 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SetCaughtData:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2017-12-15 17:10:54 -08:00
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1CaughtLevel
|
2017-12-15 17:10:54 -08:00
|
|
|
call GetPartyLocation
|
2018-06-24 07:09:41 -07:00
|
|
|
SetBoxmonOrEggmonCaughtData:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTimeOfDay]
|
2017-12-15 17:10:54 -08:00
|
|
|
inc a
|
|
|
|
rrca
|
|
|
|
rrca
|
2023-07-31 03:27:53 -07:00
|
|
|
and CAUGHT_TIME_MASK ; caught in eve becomes $0
|
2017-12-15 17:10:54 -08:00
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyLevel]
|
2017-12-15 17:10:54 -08:00
|
|
|
or b
|
|
|
|
ld [hli], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMapGroup]
|
2017-12-15 17:10:54 -08:00
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMapNumber]
|
2017-12-15 17:10:54 -08:00
|
|
|
ld c, a
|
|
|
|
call GetWorldMapLocation
|
|
|
|
ld b, a
|
2024-03-09 07:40:21 -08:00
|
|
|
ld a, [wPlayerCharacter]
|
2018-01-22 11:34:55 -08:00
|
|
|
rrca ; shift bit 0 (PLAYERGENDER_FEMALE_F) to bit 7 (CAUGHT_GENDER_MASK)
|
2017-12-15 17:10:54 -08:00
|
|
|
or b
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SetBoxMonCaughtData:
|
2017-12-15 17:10:54 -08:00
|
|
|
ld a, BANK(sBoxMon1CaughtLevel)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2017-12-15 17:10:54 -08:00
|
|
|
ld hl, sBoxMon1CaughtLevel
|
|
|
|
call SetBoxmonOrEggmonCaughtData
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SetGiftBoxMonCaughtData:
|
2017-12-15 17:10:54 -08:00
|
|
|
push bc
|
|
|
|
ld a, BANK(sBoxMon1CaughtLevel)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2017-12-15 17:10:54 -08:00
|
|
|
ld hl, sBoxMon1CaughtLevel
|
|
|
|
pop bc
|
|
|
|
call SetGiftMonCaughtData
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SetGiftPartyMonCaughtData:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2017-12-15 17:10:54 -08:00
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1CaughtLevel
|
2017-12-15 17:10:54 -08:00
|
|
|
push bc
|
|
|
|
call GetPartyLocation
|
|
|
|
pop bc
|
2018-06-24 07:09:41 -07:00
|
|
|
SetGiftMonCaughtData:
|
2017-12-15 17:10:54 -08:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
2020-03-15 14:26:10 -07:00
|
|
|
ld a, LANDMARK_GIFT
|
2017-12-15 17:10:54 -08:00
|
|
|
rrc b
|
|
|
|
or b
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SetEggMonCaughtData:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMon1CaughtLevel
|
2017-12-15 17:10:54 -08:00
|
|
|
call GetPartyLocation
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyLevel]
|
2017-12-15 17:10:54 -08:00
|
|
|
push af
|
2018-01-11 09:00:01 -08:00
|
|
|
ld a, CAUGHT_EGG_LEVEL
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyLevel], a
|
2017-12-15 17:10:54 -08:00
|
|
|
call SetBoxmonOrEggmonCaughtData
|
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyLevel], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ret
|