-
Notifications
You must be signed in to change notification settings - Fork 830
/
Copy pathmove_tutor.asm
103 lines (88 loc) · 1.54 KB
/
move_tutor.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
MoveTutor:
call FadeToMenu
call ClearBGPalettes
call ClearScreen
call DelayFrame
ld b, SCGB_PACKPALS
call GetSGBLayout
xor a
ld [wItemAttributeValue], a
call .GetMoveTutorMove
ld [wNamedObjectIndex], a
ld [wPutativeTMHMMove], a
call GetMoveName
call CopyName1
farcall ChooseMonToLearnTMHM
jr c, .cancel
jr .enter_loop
.loop
farcall ChooseMonToLearnTMHM_NoRefresh
jr c, .cancel
.enter_loop
call CheckCanLearnMoveTutorMove
jr nc, .loop
xor a ; FALSE
ld [wScriptVar], a
jr .quit
.cancel
ld a, -1
ld [wScriptVar], a
.quit
call CloseSubmenu
ret
.GetMoveTutorMove:
ld a, [wScriptVar]
cp MOVETUTOR_FLAMETHROWER
jr z, .flamethrower
cp MOVETUTOR_THUNDERBOLT
jr z, .thunderbolt
; MOVETUTOR_ICE_BEAM
ld a, MT03_MOVE ; ICE_BEAM
ret
.flamethrower
ld a, MT01_MOVE ; FLAMETHROWER
ret
.thunderbolt
ld a, MT02_MOVE ; THUNDERBOLT
ret
CheckCanLearnMoveTutorMove:
ld hl, .MenuHeader
call LoadMenuHeader
predef CanLearnTMHMMove
push bc
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 FarPrintText
jr .didnt_learn
.can_learn
callfar KnowsMove
jr c, .didnt_learn
predef LearnMove
ld a, b
and a
jr z, .didnt_learn
ld c, HAPPINESS_LEARNMOVE
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