pokecrystal-board/engine/events/move_tutor.asm

104 lines
1.5 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
MoveTutor:
call FadeToMenu
call ClearBGPalettes
call ClearScreen
call DelayFrame
ld b, CGB_PACKPALS
call GetCGBLayout
xor a
ld [wItemAttributeValue], a
call .GetMoveTutorMove
ld [wNamedObjectIndex], a
ld [wPutativeTMHMMove], a
call GetMoveName
call CopyName1
2017-12-24 09:47:30 -08:00
farcall ChooseMonToLearnTMHM
jr c, .cancel
jr .enter_loop
.loop
2017-12-24 09:47:30 -08:00
farcall ChooseMonToLearnTMHM_NoRefresh
jr c, .cancel
.enter_loop
call CheckCanLearnMoveTutorMove
jr nc, .loop
2018-01-11 22:40:20 -08:00
xor a ; FALSE
2023-09-30 10:12:57 -07:00
ldh [hScriptVar], a
jr .quit
.cancel
ld a, -1
2023-09-30 10:12:57 -07:00
ldh [hScriptVar], a
.quit
call CloseSubmenu
ret
2018-06-24 07:09:41 -07:00
.GetMoveTutorMove:
2023-09-30 10:12:57 -07:00
ldh a, [hScriptVar]
2018-01-11 22:40:20 -08:00
cp MOVETUTOR_FLAMETHROWER
jr z, .flamethrower
2018-01-11 22:40:20 -08:00
cp MOVETUTOR_THUNDERBOLT
jr z, .thunderbolt
2018-01-11 22:40:20 -08:00
; MOVETUTOR_ICE_BEAM
ld a, MT03_MOVE ; ICE_BEAM
ret
.flamethrower
ld a, MT01_MOVE ; FLAMETHROWER
ret
.thunderbolt
ld a, MT02_MOVE ; THUNDERBOLT
ret
2018-06-24 07:09:41 -07:00
CheckCanLearnMoveTutorMove:
ld hl, .MenuHeader
call LoadMenuHeader
predef CanLearnTMHMMove
push bc
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld hl, wPartyMonNicknames
call GetNickname
pop bc
ld a, c
and a
jr nz, .can_learn
push de
ld de, SFX_WRONG
call PlaySFX
pop de
ld a, BANK(TMHMNotCompatibleText)
ld hl, TMHMNotCompatibleText
call FarPrintText1bpp
jr .didnt_learn
.can_learn
2017-12-24 09:47:30 -08:00
callfar KnowsMove
jr c, .didnt_learn
predef LearnMove
ld a, b
and a
jr z, .didnt_learn
ld c, HAPPINESS_LEARNMOVE
2017-12-24 09:47:30 -08:00
callfar ChangeHappiness
jr .learned
.didnt_learn
call ExitMenu
and a
ret
.learned
call ExitMenu
scf
ret
.MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1