pokecrystal/engine/events/shuckle.asm

143 lines
2.1 KiB
NASM
Raw Normal View History

2018-01-12 06:40:20 +00:00
MANIA_OT_ID EQU 00518
2018-06-24 14:09:41 +00:00
GiveShuckle:
2016-03-27 16:47:28 +00:00
; Adding to the party.
xor a
2018-01-23 22:39:09 +00:00
ld [wMonType], a
2016-03-27 16:47:28 +00:00
; Level 15 Shuckle.
ld a, SHUCKLE
2018-01-23 22:39:09 +00:00
ld [wCurPartySpecies], a
2016-03-27 16:47:28 +00:00
ld a, 15
2018-01-23 22:39:09 +00:00
ld [wCurPartyLevel], a
2016-03-27 16:47:28 +00:00
predef TryAddMonToParty
2016-03-27 16:47:28 +00:00
jr nc, .NotGiven
; Caught data.
ld b, 0
2017-12-24 17:47:30 +00:00
farcall SetGiftPartyMonCaughtData
2016-03-27 16:47:28 +00:00
; Holding a Berry.
ld bc, PARTYMON_STRUCT_LENGTH
2018-01-23 22:39:09 +00:00
ld a, [wPartyCount]
2016-03-27 16:47:28 +00:00
dec a
push af
push bc
2018-01-23 22:39:09 +00:00
ld hl, wPartyMon1Item
2016-03-27 16:47:28 +00:00
call AddNTimes
ld [hl], BERRY
pop bc
pop af
; OT ID.
2018-01-23 22:39:09 +00:00
ld hl, wPartyMon1ID
2016-03-27 16:47:28 +00:00
call AddNTimes
2018-01-12 06:40:20 +00:00
ld a, HIGH(MANIA_OT_ID)
2016-03-27 16:47:28 +00:00
ld [hli], a
2018-01-12 06:40:20 +00:00
ld [hl], LOW(MANIA_OT_ID)
2016-03-27 16:47:28 +00:00
; Nickname.
2018-01-23 22:39:09 +00:00
ld a, [wPartyCount]
2016-03-27 16:47:28 +00:00
dec a
2018-01-23 22:39:09 +00:00
ld hl, wPartyMonNicknames
2016-03-27 16:47:28 +00:00
call SkipNames
ld de, SpecialShuckleNick
call CopyName2
; OT.
2018-01-23 22:39:09 +00:00
ld a, [wPartyCount]
2016-03-27 16:47:28 +00:00
dec a
2018-01-23 22:39:09 +00:00
ld hl, wPartyMonOT
2016-03-27 16:47:28 +00: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 16:47:28 +00:00
ld a, 1
2018-01-23 22:39:09 +00:00
ld [wScriptVar], a
2016-03-27 16:47:28 +00:00
ret
.NotGiven:
2016-03-27 16:47:28 +00:00
xor a
2018-01-23 22:39:09 +00:00
ld [wScriptVar], a
2016-03-27 16:47:28 +00:00
ret
SpecialShuckleOT:
db "MANIA@"
2018-12-23 19:02:07 +00:00
2016-03-27 16:47:28 +00:00
SpecialShuckleNick:
db "SHUCKIE@"
2018-06-24 14:09:41 +00:00
ReturnShuckle:
2017-12-24 17:47:30 +00:00
farcall SelectMonFromParty
2016-03-27 16:47:28 +00:00
jr c, .refused
2018-01-23 22:39:09 +00:00
ld a, [wCurPartySpecies]
2016-03-27 16:47:28 +00:00
cp SHUCKLE
jr nz, .DontReturn
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
ld hl, wPartyMon1ID
2016-03-27 16:47:28 +00:00
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
; OT ID
ld a, [hli]
2018-01-12 06:40:20 +00:00
cp HIGH(MANIA_OT_ID)
2016-03-27 16:47:28 +00:00
jr nz, .DontReturn
ld a, [hl]
2018-01-12 06:40:20 +00:00
cp LOW(MANIA_OT_ID)
2016-03-27 16:47:28 +00:00
jr nz, .DontReturn
; OT
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
ld hl, wPartyMonOT
2016-03-27 16:47:28 +00:00
call SkipNames
ld de, SpecialShuckleOT
.CheckOT:
2016-03-27 16:47:28 +00:00
ld a, [de]
cp [hl]
jr nz, .DontReturn
cp "@"
jr z, .done
inc de
inc hl
jr .CheckOT
.done
2017-12-24 17:47:30 +00:00
farcall CheckCurPartyMonFainted
2016-03-27 16:47:28 +00:00
jr c, .fainted
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
ld hl, wPartyMon1Happiness
2016-03-27 16:47:28 +00:00
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [hl]
cp 150
2018-01-12 06:40:20 +00:00
ld a, SHUCKIE_HAPPY
2016-03-27 16:47:28 +00:00
jr nc, .HappyToStayWithYou
xor a ; REMOVE_PARTY
2016-03-27 16:47:28 +00:00
ld [wPokemonWithdrawDepositParameter], a
2017-12-24 17:47:30 +00:00
callfar RemoveMonFromPartyOrBox
2018-01-12 06:40:20 +00:00
ld a, SHUCKIE_RETURNED
.HappyToStayWithYou:
2018-01-23 22:39:09 +00:00
ld [wScriptVar], a
2016-03-27 16:47:28 +00:00
ret
.refused
2018-01-12 06:40:20 +00:00
ld a, SHUCKIE_REFUSED
2018-01-23 22:39:09 +00:00
ld [wScriptVar], a
2016-03-27 16:47:28 +00:00
ret
.DontReturn:
2018-01-12 06:40:20 +00:00
xor a ; SHUCKIE_WRONG_MON
2018-01-23 22:39:09 +00:00
ld [wScriptVar], a
2016-03-27 16:47:28 +00:00
ret
.fainted
2018-01-12 06:40:20 +00:00
ld a, SHUCKIE_FAINTED
2018-01-23 22:39:09 +00:00
ld [wScriptVar], a
2016-03-27 16:47:28 +00:00
ret