pokecrystal-board/engine/events/shuckle.asm

143 lines
2.1 KiB
NASM
Raw Normal View History

DEF MANIA_OT_ID EQU 00518
2018-01-11 22:40:20 -08:00
2018-06-24 07:09:41 -07:00
GiveShuckle:
2016-03-27 09:47:28 -07:00
; Adding to the party.
2019-08-21 05:43:21 -07:00
xor a ; PARTYMON
2018-01-23 14:39:09 -08:00
ld [wMonType], a
2016-03-27 09:47:28 -07:00
; Level 15 Shuckle.
ld a, SHUCKLE
2018-01-23 14:39:09 -08:00
ld [wCurPartySpecies], a
2016-03-27 09:47:28 -07:00
ld a, 15
2018-01-23 14:39:09 -08:00
ld [wCurPartyLevel], a
2016-03-27 09:47:28 -07:00
predef TryAddMonToParty
2016-03-27 09:47:28 -07:00
jr nc, .NotGiven
; Caught data.
2020-11-03 07:13:06 -08:00
ld b, CAUGHT_BY_UNKNOWN
2017-12-24 09:47:30 -08:00
farcall SetGiftPartyMonCaughtData
2016-03-27 09:47:28 -07:00
; Holding a Berry.
ld bc, PARTYMON_STRUCT_LENGTH
2018-01-23 14:39:09 -08:00
ld a, [wPartyCount]
2016-03-27 09:47:28 -07:00
dec a
push af
push bc
2018-01-23 14:39:09 -08:00
ld hl, wPartyMon1Item
2016-03-27 09:47:28 -07:00
call AddNTimes
ld [hl], BERRY
pop bc
pop af
; OT ID.
2018-01-23 14:39:09 -08:00
ld hl, wPartyMon1ID
2016-03-27 09:47:28 -07:00
call AddNTimes
2018-01-11 22:40:20 -08:00
ld a, HIGH(MANIA_OT_ID)
2016-03-27 09:47:28 -07:00
ld [hli], a
2018-01-11 22:40:20 -08:00
ld [hl], LOW(MANIA_OT_ID)
2016-03-27 09:47:28 -07:00
; Nickname.
2018-01-23 14:39:09 -08:00
ld a, [wPartyCount]
2016-03-27 09:47:28 -07:00
dec a
2018-01-23 14:39:09 -08:00
ld hl, wPartyMonNicknames
2016-03-27 09:47:28 -07:00
call SkipNames
ld de, SpecialShuckleNickname
2016-03-27 09:47:28 -07:00
call CopyName2
; OT.
2018-01-23 14:39:09 -08:00
ld a, [wPartyCount]
2016-03-27 09:47:28 -07:00
dec a
ld hl, wPartyMonOTs
2016-03-27 09:47:28 -07:00
call SkipNames
ld de, SpecialShuckleOT
call CopyName2
; Engine flag for this event.
ld hl, wDailyFlags1
set DAILYFLAGS1_GOT_SHUCKIE_TODAY_F, [hl]
2016-03-27 09:47:28 -07:00
ld a, 1
2023-09-30 10:12:57 -07:00
ldh [hScriptVar], a
2016-03-27 09:47:28 -07:00
ret
.NotGiven:
2016-03-27 09:47:28 -07:00
xor a
2023-09-30 10:12:57 -07:00
ldh [hScriptVar], a
2016-03-27 09:47:28 -07:00
ret
SpecialShuckleOT:
db "MANIA@"
2018-12-23 11:02:07 -08:00
SpecialShuckleNickname:
2016-03-27 09:47:28 -07:00
db "SHUCKIE@"
2021-03-17 08:38:01 -07:00
ReturnShuckie:
2017-12-24 09:47:30 -08:00
farcall SelectMonFromParty
2016-03-27 09:47:28 -07:00
jr c, .refused
2018-01-23 14:39:09 -08:00
ld a, [wCurPartySpecies]
2016-03-27 09:47:28 -07:00
cp SHUCKLE
jr nz, .DontReturn
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld hl, wPartyMon1ID
2016-03-27 09:47:28 -07:00
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
; OT ID
ld a, [hli]
2018-01-11 22:40:20 -08:00
cp HIGH(MANIA_OT_ID)
2016-03-27 09:47:28 -07:00
jr nz, .DontReturn
ld a, [hl]
2018-01-11 22:40:20 -08:00
cp LOW(MANIA_OT_ID)
2016-03-27 09:47:28 -07:00
jr nz, .DontReturn
; OT
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld hl, wPartyMonOTs
2016-03-27 09:47:28 -07:00
call SkipNames
ld de, SpecialShuckleOT
.CheckOT:
2016-03-27 09:47:28 -07:00
ld a, [de]
cp [hl]
jr nz, .DontReturn
cp "@"
jr z, .done
inc de
inc hl
jr .CheckOT
.done
2017-12-24 09:47:30 -08:00
farcall CheckCurPartyMonFainted
2016-03-27 09:47:28 -07:00
jr c, .fainted
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld hl, wPartyMon1Happiness
2016-03-27 09:47:28 -07:00
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [hl]
cp 150
2018-01-11 22:40:20 -08:00
ld a, SHUCKIE_HAPPY
2016-03-27 09:47:28 -07:00
jr nc, .HappyToStayWithYou
xor a ; REMOVE_PARTY
2016-03-27 09:47:28 -07:00
ld [wPokemonWithdrawDepositParameter], a
2017-12-24 09:47:30 -08:00
callfar RemoveMonFromPartyOrBox
2018-01-11 22:40:20 -08:00
ld a, SHUCKIE_RETURNED
.HappyToStayWithYou:
2023-09-30 10:12:57 -07:00
ldh [hScriptVar], a
2016-03-27 09:47:28 -07:00
ret
.refused
2018-01-11 22:40:20 -08:00
ld a, SHUCKIE_REFUSED
2023-09-30 10:12:57 -07:00
ldh [hScriptVar], a
2016-03-27 09:47:28 -07:00
ret
.DontReturn:
2018-01-11 22:40:20 -08:00
xor a ; SHUCKIE_WRONG_MON
2023-09-30 10:12:57 -07:00
ldh [hScriptVar], a
2016-03-27 09:47:28 -07:00
ret
.fainted
2018-01-11 22:40:20 -08:00
ld a, SHUCKIE_FAINTED
2023-09-30 10:12:57 -07:00
ldh [hScriptVar], a
2016-03-27 09:47:28 -07:00
ret