2018-06-24 07:09:41 -07:00
|
|
|
EvolvePokemon:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wEvolvableFlags
|
2015-11-18 15:35:44 -08:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2015-11-18 15:35:44 -08:00
|
|
|
ld c, a
|
|
|
|
ld b, SET_FLAG
|
|
|
|
call EvoFlagAction
|
2018-06-24 07:09:41 -07:00
|
|
|
EvolveAfterBattle:
|
2015-11-18 15:35:44 -08:00
|
|
|
xor a
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wMonTriedToEvolve], a
|
2015-11-18 15:35:44 -08:00
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
2015-11-18 15:35:44 -08:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyCount
|
2015-11-18 15:35:44 -08:00
|
|
|
|
|
|
|
push hl
|
|
|
|
|
2018-05-05 00:19:04 -07:00
|
|
|
EvolveAfterBattle_MasterLoop:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wCurPartyMon
|
2015-11-18 15:35:44 -08:00
|
|
|
inc [hl]
|
|
|
|
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
|
|
|
cp $ff
|
2016-01-12 09:46:18 -08:00
|
|
|
jp z, .ReturnToMap
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2016-05-16 12:46:13 -07:00
|
|
|
ld [wEvolutionOldSpecies], a
|
2015-11-18 15:35:44 -08:00
|
|
|
|
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2015-11-18 15:35:44 -08:00
|
|
|
ld c, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wEvolvableFlags
|
2015-11-18 15:35:44 -08:00
|
|
|
ld b, CHECK_FLAG
|
|
|
|
call EvoFlagAction
|
|
|
|
ld a, c
|
|
|
|
and a
|
2016-01-12 09:46:18 -08:00
|
|
|
jp z, EvolveAfterBattle_MasterLoop
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2016-05-16 12:46:13 -07:00
|
|
|
ld a, [wEvolutionOldSpecies]
|
2015-11-18 15:35:44 -08:00
|
|
|
dec a
|
|
|
|
ld b, 0
|
|
|
|
ld c, a
|
|
|
|
ld hl, EvosAttacksPointers
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
|
|
|
|
push hl
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2018-02-22 08:13:29 -08:00
|
|
|
predef CopyMonToTempMon
|
2015-11-18 15:35:44 -08:00
|
|
|
pop hl
|
|
|
|
|
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
2016-01-12 09:46:18 -08:00
|
|
|
jr z, EvolveAfterBattle_MasterLoop
|
2015-11-18 15:35:44 -08:00
|
|
|
|
|
|
|
ld b, a
|
|
|
|
|
|
|
|
cp EVOLVE_TRADE
|
|
|
|
jr z, .trade
|
|
|
|
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
and a
|
|
|
|
jp nz, .dont_evolve_2
|
|
|
|
|
|
|
|
ld a, b
|
|
|
|
cp EVOLVE_ITEM
|
|
|
|
jp z, .item
|
|
|
|
|
2015-11-28 12:13:40 -08:00
|
|
|
ld a, [wForceEvolution]
|
2015-11-18 15:35:44 -08:00
|
|
|
and a
|
|
|
|
jp nz, .dont_evolve_2
|
|
|
|
|
|
|
|
ld a, b
|
|
|
|
cp EVOLVE_LEVEL
|
|
|
|
jp z, .level
|
|
|
|
|
|
|
|
cp EVOLVE_HAPPINESS
|
|
|
|
jr z, .happiness
|
|
|
|
|
|
|
|
; EVOLVE_STAT
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempMonLevel]
|
2015-11-18 15:35:44 -08:00
|
|
|
cp [hl]
|
|
|
|
jp c, .dont_evolve_1
|
|
|
|
|
|
|
|
call IsMonHoldingEverstone
|
|
|
|
jp z, .dont_evolve_1
|
|
|
|
|
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wTempMonAttack
|
|
|
|
ld hl, wTempMonDefense
|
2015-11-18 15:35:44 -08:00
|
|
|
ld c, 2
|
2018-07-22 21:25:53 -07:00
|
|
|
call CompareBytes
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, ATK_EQ_DEF
|
|
|
|
jr z, .got_tyrogue_evo
|
|
|
|
ld a, ATK_LT_DEF
|
|
|
|
jr c, .got_tyrogue_evo
|
|
|
|
ld a, ATK_GT_DEF
|
|
|
|
.got_tyrogue_evo
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
inc hl
|
|
|
|
cp [hl]
|
|
|
|
jp nz, .dont_evolve_2
|
|
|
|
|
|
|
|
inc hl
|
|
|
|
jr .proceed
|
|
|
|
|
|
|
|
.happiness
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempMonHappiness]
|
2017-08-24 15:29:56 -07:00
|
|
|
cp HAPPINESS_TO_EVOLVE
|
2015-11-18 15:35:44 -08:00
|
|
|
jp c, .dont_evolve_2
|
|
|
|
|
|
|
|
call IsMonHoldingEverstone
|
|
|
|
jp z, .dont_evolve_2
|
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
cp TR_ANYTIME
|
|
|
|
jr z, .proceed
|
|
|
|
cp TR_MORNDAY
|
|
|
|
jr z, .happiness_daylight
|
|
|
|
|
|
|
|
; TR_NITE
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTimeOfDay]
|
2017-12-10 22:02:28 -08:00
|
|
|
cp NITE_F
|
2015-11-18 15:35:44 -08:00
|
|
|
jp nz, .dont_evolve_3
|
|
|
|
jr .proceed
|
|
|
|
|
|
|
|
.happiness_daylight
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTimeOfDay]
|
2017-12-10 22:02:28 -08:00
|
|
|
cp NITE_F
|
2015-11-18 15:35:44 -08:00
|
|
|
jp z, .dont_evolve_3
|
|
|
|
jr .proceed
|
|
|
|
|
|
|
|
.trade
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
and a
|
|
|
|
jp z, .dont_evolve_2
|
|
|
|
|
|
|
|
call IsMonHoldingEverstone
|
|
|
|
jp z, .dont_evolve_2
|
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
inc a
|
|
|
|
jr z, .proceed
|
|
|
|
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_TIMECAPSULE
|
|
|
|
jp z, .dont_evolve_3
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempMonItem]
|
2015-11-18 15:35:44 -08:00
|
|
|
cp b
|
|
|
|
jp nz, .dont_evolve_3
|
|
|
|
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempMonItem], a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr .proceed
|
|
|
|
|
|
|
|
.item
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2015-11-18 15:35:44 -08:00
|
|
|
cp b
|
|
|
|
jp nz, .dont_evolve_3
|
|
|
|
|
2015-11-28 12:13:40 -08:00
|
|
|
ld a, [wForceEvolution]
|
2015-11-18 15:35:44 -08:00
|
|
|
and a
|
|
|
|
jp z, .dont_evolve_3
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
and a
|
|
|
|
jp nz, .dont_evolve_3
|
|
|
|
jr .proceed
|
|
|
|
|
|
|
|
.level
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempMonLevel]
|
2015-11-18 15:35:44 -08:00
|
|
|
cp b
|
|
|
|
jp c, .dont_evolve_3
|
|
|
|
call IsMonHoldingEverstone
|
|
|
|
jp z, .dont_evolve_3
|
|
|
|
|
|
|
|
.proceed
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempMonLevel]
|
|
|
|
ld [wCurPartyLevel], a
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, $1
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wMonTriedToEvolve], a
|
2015-11-18 15:35:44 -08:00
|
|
|
|
|
|
|
push hl
|
|
|
|
|
|
|
|
ld a, [hl]
|
2016-05-16 12:46:13 -07:00
|
|
|
ld [wEvolutionNewSpecies], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMonNicknames
|
2015-11-18 15:35:44 -08:00
|
|
|
call GetNick
|
|
|
|
call CopyName1
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, EvolvingText
|
2015-11-18 15:35:44 -08:00
|
|
|
call PrintText
|
|
|
|
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-18 15:35:44 -08:00
|
|
|
hlcoord 0, 0
|
|
|
|
lb bc, 12, 20
|
|
|
|
call ClearBox
|
|
|
|
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call ClearSprites
|
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall EvolutionAnimation
|
2015-11-18 15:35:44 -08:00
|
|
|
|
|
|
|
push af
|
|
|
|
call ClearSprites
|
|
|
|
pop af
|
|
|
|
jp c, CancelEvolution
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, CongratulationsYourPokemonText
|
2015-11-18 15:35:44 -08:00
|
|
|
call PrintText
|
|
|
|
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
ld a, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
|
|
|
ld [wTempMonSpecies], a
|
2016-05-16 12:46:13 -07:00
|
|
|
ld [wEvolutionNewSpecies], a
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call GetPokemonName
|
|
|
|
|
|
|
|
push hl
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, EvolvedIntoText
|
2019-04-08 05:15:10 -07:00
|
|
|
call PrintTextboxText
|
2018-01-02 11:00:14 -08:00
|
|
|
farcall StubbedTrainerRankings_MonsEvolved
|
2015-11-18 15:35:44 -08:00
|
|
|
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
ld de, SFX_CAUGHT_MON
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
|
|
|
|
ld c, 40
|
|
|
|
call DelayFrames
|
|
|
|
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-18 15:35:44 -08:00
|
|
|
call UpdateSpeciesNameIfNotNicknamed
|
|
|
|
call GetBaseData
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wTempMonExp + 2
|
|
|
|
ld de, wTempMonMaxHP
|
2018-02-22 09:12:43 -08:00
|
|
|
ld b, TRUE
|
2018-02-22 08:13:29 -08:00
|
|
|
predef CalcMonStats
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMons
|
2015-11-18 15:35:44 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
ld bc, MON_MAXHP
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wTempMonMaxHP + 1
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, [hld]
|
|
|
|
sub c
|
|
|
|
ld c, a
|
|
|
|
ld a, [hl]
|
|
|
|
sbc b
|
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wTempMonHP + 1
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, [hl]
|
|
|
|
add c
|
|
|
|
ld [hld], a
|
|
|
|
ld a, [hl]
|
|
|
|
adc b
|
|
|
|
ld [hl], a
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wTempMonSpecies
|
2015-11-18 15:35:44 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurSpecies]
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wTempSpecies], a
|
2015-11-18 15:35:44 -08:00
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2018-01-16 11:30:10 -08:00
|
|
|
call LearnLevelMoves
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, [wTempSpecies]
|
2015-11-18 15:35:44 -08:00
|
|
|
dec a
|
|
|
|
call SetSeenAndCaughtMon
|
|
|
|
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, [wTempSpecies]
|
2015-11-18 15:35:44 -08:00
|
|
|
cp UNOWN
|
|
|
|
jr nz, .skip_unown
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wTempMonDVs
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetUnownLetter
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar UpdateUnownDex
|
2015-11-18 15:35:44 -08:00
|
|
|
|
|
|
|
.skip_unown
|
|
|
|
pop de
|
|
|
|
pop hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempMonSpecies]
|
2015-11-18 15:35:44 -08:00
|
|
|
ld [hl], a
|
|
|
|
push hl
|
|
|
|
ld l, e
|
|
|
|
ld h, d
|
2016-01-12 09:46:18 -08:00
|
|
|
jp EvolveAfterBattle_MasterLoop
|
2015-11-18 15:35:44 -08:00
|
|
|
|
|
|
|
.dont_evolve_1
|
|
|
|
inc hl
|
|
|
|
.dont_evolve_2
|
|
|
|
inc hl
|
|
|
|
.dont_evolve_3
|
|
|
|
inc hl
|
|
|
|
jp .loop
|
|
|
|
|
2020-10-28 07:21:10 -07:00
|
|
|
.UnusedReturnToMap: ; unreferenced
|
2015-11-18 15:35:44 -08:00
|
|
|
pop hl
|
2016-04-10 11:42:14 -07:00
|
|
|
.ReturnToMap:
|
2015-11-18 15:35:44 -08:00
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
ld a, [wBattleMode]
|
|
|
|
and a
|
|
|
|
ret nz
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wMonTriedToEvolve]
|
2015-11-18 15:35:44 -08:00
|
|
|
and a
|
|
|
|
call nz, RestartMapMusic
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UpdateSpeciesNameIfNotNicknamed:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurSpecies]
|
2015-11-18 15:35:44 -08:00
|
|
|
push af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBaseDexNo]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call GetPokemonName
|
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
|
|
|
ld hl, wStringBuffer1
|
|
|
|
ld de, wStringBuffer2
|
2015-11-18 15:35:44 -08:00
|
|
|
.loop
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp [hl]
|
|
|
|
inc hl
|
|
|
|
ret nz
|
|
|
|
cp "@"
|
|
|
|
jr nz, .loop
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMonNicknames
|
2015-11-18 15:35:44 -08:00
|
|
|
call AddNTimes
|
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurSpecies]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call GetPokemonName
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wStringBuffer1
|
2015-11-18 15:35:44 -08:00
|
|
|
pop de
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2015-11-18 15:35:44 -08:00
|
|
|
jp CopyBytes
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CancelEvolution:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, StoppedEvolvingText
|
2015-11-18 15:35:44 -08:00
|
|
|
call PrintText
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-18 15:35:44 -08:00
|
|
|
pop hl
|
2016-01-12 09:46:18 -08:00
|
|
|
jp EvolveAfterBattle_MasterLoop
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
IsMonHoldingEverstone:
|
2015-11-18 15:35:44 -08:00
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMon1Item
|
2015-11-18 15:35:44 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
|
|
|
cp EVERSTONE
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
CongratulationsYourPokemonText:
|
|
|
|
text_far _CongratulationsYourPokemonText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
EvolvedIntoText:
|
|
|
|
text_far _EvolvedIntoText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
StoppedEvolvingText:
|
|
|
|
text_far _StoppedEvolvingText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
EvolvingText:
|
|
|
|
text_far _EvolvingText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
LearnLevelMoves:
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, [wTempSpecies]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-18 15:35:44 -08:00
|
|
|
dec a
|
|
|
|
ld b, 0
|
|
|
|
ld c, a
|
|
|
|
ld hl, EvosAttacksPointers
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
|
|
|
|
.skip_evos
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
jr nz, .skip_evos
|
|
|
|
|
|
|
|
.find_move
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyLevel]
|
2015-11-18 15:35:44 -08:00
|
|
|
cp b
|
|
|
|
ld a, [hli]
|
|
|
|
jr nz, .find_move
|
|
|
|
|
|
|
|
push hl
|
|
|
|
ld d, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1Moves
|
|
|
|
ld a, [wCurPartyMon]
|
2015-11-18 15:35:44 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
|
|
|
|
ld b, NUM_MOVES
|
|
|
|
.check_move
|
|
|
|
ld a, [hli]
|
|
|
|
cp d
|
|
|
|
jr z, .has_move
|
|
|
|
dec b
|
|
|
|
jr nz, .check_move
|
|
|
|
jr .learn
|
|
|
|
.has_move
|
|
|
|
|
|
|
|
pop hl
|
|
|
|
jr .find_move
|
|
|
|
|
|
|
|
.learn
|
|
|
|
ld a, d
|
2015-12-02 10:24:18 -08:00
|
|
|
ld [wPutativeTMHMMove], a
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call GetMoveName
|
|
|
|
call CopyName1
|
2018-01-16 11:30:10 -08:00
|
|
|
predef LearnMove
|
2015-11-18 15:35:44 -08:00
|
|
|
pop hl
|
|
|
|
jr .find_move
|
|
|
|
|
|
|
|
.done
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wTempSpecies], a
|
2015-11-18 15:35:44 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
FillMoves:
|
2018-01-23 14:39:09 -08:00
|
|
|
; Fill in moves at de for wCurPartySpecies at wCurPartyLevel
|
2015-11-18 15:35:44 -08:00
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
ld hl, EvosAttacksPointers
|
|
|
|
ld b, 0
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-11-18 15:35:44 -08:00
|
|
|
dec a
|
|
|
|
add a
|
|
|
|
rl b
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2016-04-10 11:42:14 -07:00
|
|
|
.GoToAttacks:
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
jr nz, .GoToAttacks
|
|
|
|
jr .GetLevel
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NextMove:
|
2015-11-18 15:35:44 -08:00
|
|
|
pop de
|
2016-04-10 11:42:14 -07:00
|
|
|
.GetMove:
|
2015-11-18 15:35:44 -08:00
|
|
|
inc hl
|
2016-04-10 11:42:14 -07:00
|
|
|
.GetLevel:
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
jp z, .done
|
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyLevel]
|
2015-11-18 15:35:44 -08:00
|
|
|
cp b
|
|
|
|
jp c, .done
|
2020-11-03 16:53:07 -08:00
|
|
|
ld a, [wSkipMovesBeforeLevelUp]
|
2015-11-18 15:35:44 -08:00
|
|
|
and a
|
|
|
|
jr z, .CheckMove
|
2020-10-29 11:45:40 -07:00
|
|
|
ld a, [wPrevPartyLevel]
|
2015-11-18 15:35:44 -08:00
|
|
|
cp b
|
|
|
|
jr nc, .GetMove
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.CheckMove:
|
2015-11-18 15:35:44 -08:00
|
|
|
push de
|
|
|
|
ld c, NUM_MOVES
|
2016-04-10 11:42:14 -07:00
|
|
|
.CheckRepeat:
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp [hl]
|
|
|
|
jr z, .NextMove
|
|
|
|
dec c
|
|
|
|
jr nz, .CheckRepeat
|
|
|
|
pop de
|
|
|
|
push de
|
|
|
|
ld c, NUM_MOVES
|
2016-04-10 11:42:14 -07:00
|
|
|
.CheckSlot:
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, [de]
|
|
|
|
and a
|
|
|
|
jr z, .LearnMove
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .CheckSlot
|
|
|
|
pop de
|
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
call ShiftMoves
|
2016-05-16 12:46:13 -07:00
|
|
|
ld a, [wEvolutionOldSpecies]
|
2015-11-18 15:35:44 -08:00
|
|
|
and a
|
|
|
|
jr z, .ShiftedMove
|
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld bc, wPartyMon1PP - (wPartyMon1Moves + NUM_MOVES - 1)
|
2015-11-18 15:35:44 -08:00
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
call ShiftMoves
|
|
|
|
pop de
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.ShiftedMove:
|
2015-11-18 15:35:44 -08:00
|
|
|
pop hl
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.LearnMove:
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
2016-05-16 12:46:13 -07:00
|
|
|
ld a, [wEvolutionOldSpecies]
|
2015-11-18 15:35:44 -08:00
|
|
|
and a
|
|
|
|
jr z, .NextMove
|
|
|
|
push hl
|
|
|
|
ld a, [hl]
|
|
|
|
ld hl, MON_PP - MON_MOVES
|
|
|
|
add hl, de
|
|
|
|
push hl
|
|
|
|
dec a
|
|
|
|
ld hl, Moves + MOVE_PP
|
|
|
|
ld bc, MOVE_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld a, BANK(Moves)
|
|
|
|
call GetFarByte
|
|
|
|
pop hl
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
|
|
|
jr .NextMove
|
|
|
|
|
|
|
|
.done
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ShiftMoves:
|
2015-11-18 15:35:44 -08:00
|
|
|
ld c, NUM_MOVES - 1
|
|
|
|
.loop
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
EvoFlagAction:
|
2015-11-18 15:35:44 -08:00
|
|
|
push de
|
|
|
|
ld d, $0
|
2018-01-16 11:30:10 -08:00
|
|
|
predef SmallFarFlagAction
|
2015-11-18 15:35:44 -08:00
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetPreEvolution:
|
2018-01-23 14:39:09 -08:00
|
|
|
; Find the first mon to evolve into wCurPartySpecies.
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
; Return carry and the new species in wCurPartySpecies
|
2015-11-18 15:35:44 -08:00
|
|
|
; if a pre-evolution is found.
|
|
|
|
|
|
|
|
ld c, 0
|
|
|
|
.loop ; For each Pokemon...
|
|
|
|
ld hl, EvosAttacksPointers
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-18 15:35:44 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
.loop2 ; For each evolution...
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
2018-01-23 14:39:09 -08:00
|
|
|
jr z, .no_evolve ; If we jump, this Pokemon does not evolve into wCurPartySpecies.
|
2015-11-18 15:35:44 -08:00
|
|
|
cp EVOLVE_STAT ; This evolution type has the extra parameter of stat comparison.
|
|
|
|
jr nz, .not_tyrogue
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
.not_tyrogue
|
|
|
|
inc hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-11-18 15:35:44 -08:00
|
|
|
cp [hl]
|
|
|
|
jr z, .found_preevo
|
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr nz, .loop2
|
|
|
|
|
|
|
|
.no_evolve
|
|
|
|
inc c
|
|
|
|
ld a, c
|
|
|
|
cp NUM_POKEMON
|
|
|
|
jr c, .loop
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.found_preevo
|
|
|
|
inc c
|
|
|
|
ld a, c
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-18 15:35:44 -08:00
|
|
|
scf
|
|
|
|
ret
|