2018-06-25 00:10:37 +00:00
|
|
|
GiveDratini:
|
2018-01-23 22:39:09 +00:00
|
|
|
; if wScriptVar is 0 or 1, change the moveset of the last Dratini in the party.
|
2013-09-19 01:04:16 +00:00
|
|
|
; 0: give it a special moveset with Extremespeed.
|
|
|
|
; 1: give it the normal moveset of a level 15 Dratini.
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2013-09-19 01:04:16 +00:00
|
|
|
cp $2
|
|
|
|
ret nc
|
2018-01-23 22:39:09 +00:00
|
|
|
ld bc, wPartyCount
|
2013-09-19 01:04:16 +00:00
|
|
|
ld a, [bc]
|
2015-12-19 01:07:09 +00:00
|
|
|
ld hl, MON_SPECIES
|
|
|
|
call .GetNthPartyMon
|
2013-09-19 01:04:16 +00:00
|
|
|
ld a, [bc]
|
|
|
|
ld c, a
|
2015-11-04 16:19:58 +00:00
|
|
|
ld de, PARTYMON_STRUCT_LENGTH
|
2016-04-10 18:42:14 +00:00
|
|
|
.CheckForDratini:
|
2013-09-19 01:04:16 +00:00
|
|
|
; start at the end of the party and search backwards for a Dratini
|
|
|
|
ld a, [hl]
|
|
|
|
cp DRATINI
|
|
|
|
jr z, .GiveMoveset
|
|
|
|
ld a, l
|
|
|
|
sub e
|
|
|
|
ld l, a
|
|
|
|
ld a, h
|
|
|
|
sbc d
|
|
|
|
ld h, a
|
|
|
|
dec c
|
|
|
|
jr nz, .CheckForDratini
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.GiveMoveset:
|
2013-09-19 01:04:16 +00:00
|
|
|
push hl
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2013-09-19 01:04:16 +00:00
|
|
|
ld hl, .Movesets
|
|
|
|
ld bc, .Moveset1 - .Moveset0
|
|
|
|
call AddNTimes
|
|
|
|
|
|
|
|
; get address of mon's first move
|
|
|
|
pop de
|
|
|
|
inc de
|
2016-05-04 15:46:23 +00:00
|
|
|
inc de
|
2013-09-19 01:04:16 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.GiveMoves:
|
2013-09-19 01:04:16 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a ; is the move 00?
|
|
|
|
ret z ; if so, we're done here
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
ld [de], a ; give the Pokémon the new move
|
|
|
|
|
|
|
|
; get the PP of the new move
|
|
|
|
dec a
|
2014-06-11 06:23:55 +00:00
|
|
|
ld hl, Moves + MOVE_PP
|
|
|
|
ld bc, MOVE_LENGTH
|
2013-09-19 01:04:16 +00:00
|
|
|
call AddNTimes
|
|
|
|
ld a, BANK(Moves)
|
|
|
|
call GetFarByte
|
|
|
|
|
|
|
|
; get the address of the move's PP and update the PP
|
2015-11-07 18:05:58 +00:00
|
|
|
ld hl, MON_PP - MON_MOVES
|
2013-09-19 01:04:16 +00:00
|
|
|
add hl, de
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
inc de
|
|
|
|
inc hl
|
|
|
|
jr .GiveMoves
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Movesets:
|
|
|
|
.Moveset0:
|
2013-09-19 01:04:16 +00:00
|
|
|
; Dratini does not normally learn Extremespeed. This is a special gift.
|
|
|
|
db WRAP
|
|
|
|
db THUNDER_WAVE
|
|
|
|
db TWISTER
|
|
|
|
db EXTREMESPEED
|
|
|
|
db 0
|
2016-04-10 18:42:14 +00:00
|
|
|
.Moveset1:
|
2013-09-19 01:04:16 +00:00
|
|
|
; This is the normal moveset of a level 15 Dratini
|
|
|
|
db WRAP
|
|
|
|
db LEER
|
|
|
|
db THUNDER_WAVE
|
|
|
|
db TWISTER
|
|
|
|
db 0
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.GetNthPartyMon:
|
2013-09-19 01:04:16 +00:00
|
|
|
; inputs:
|
|
|
|
; hl must be set to 0 before calling this function.
|
|
|
|
; a must be set to the number of Pokémon in the party.
|
|
|
|
|
|
|
|
; outputs:
|
|
|
|
; returns the address of the last Pokémon in the party in hl.
|
|
|
|
; sets carry if a is 0.
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wPartyMon1
|
2013-09-19 01:04:16 +00:00
|
|
|
add hl, de
|
|
|
|
and a
|
|
|
|
jr z, .EmptyParty
|
|
|
|
dec a
|
|
|
|
ret z
|
2015-11-04 16:19:58 +00:00
|
|
|
ld de, PARTYMON_STRUCT_LENGTH
|
2013-09-19 01:04:16 +00:00
|
|
|
.loop
|
|
|
|
add hl, de
|
|
|
|
dec a
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
2015-12-19 01:07:09 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.EmptyParty:
|
2013-09-19 01:04:16 +00:00
|
|
|
scf
|
|
|
|
ret
|