pokecrystal-board/engine/events/shuckle.asm

143 lines
2.1 KiB
NASM
Raw Normal View History

2018-01-11 22:40:20 -08:00
MANIA_OT_ID EQU 00518
GiveShuckle: ; 7305
2016-03-27 09:47:28 -07:00
; Adding to the party.
xor a
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.
ld b, 0
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, SpecialShuckleNick
call CopyName2
; OT.
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, wPartyMonOT
2016-03-27 09:47:28 -07:00
call SkipNames
ld de, SpecialShuckleOT
call CopyName2
; Engine flag for this event.
ld hl, wDailyFlags
set DAILYFLAGS_GOT_SHUCKIE_TODAY_F, [hl]
2016-03-27 09:47:28 -07:00
ld a, 1
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2016-03-27 09:47:28 -07:00
ret
.NotGiven:
2016-03-27 09:47:28 -07:00
xor a
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2016-03-27 09:47:28 -07:00
ret
SpecialShuckleOT:
db "MANIA@"
SpecialShuckleNick:
db "SHUCKIE@"
ReturnShuckle: ; 737e
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, wPartyMonOT
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:
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2016-03-27 09:47:28 -07:00
ret
.refused
2018-01-11 22:40:20 -08:00
ld a, SHUCKIE_REFUSED
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2016-03-27 09:47:28 -07:00
ret
.DontReturn:
2018-01-11 22:40:20 -08:00
xor a ; SHUCKIE_WRONG_MON
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2016-03-27 09:47:28 -07:00
ret
.fainted
2018-01-11 22:40:20 -08:00
ld a, SHUCKIE_FAINTED
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2016-03-27 09:47:28 -07:00
ret