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
104
105
106
|
Preload_Clerk9:
call TryGiveMedalPCPacks
get_event_value EVENT_MEDAL_COUNT
ld hl, .jump_table
cp 9
jp c, JumpToFunctionInTable
debug_nop
jr .less_than_three_medals
.jump_table
dw .less_than_three_medals
dw .less_than_three_medals
dw .less_than_three_medals
dw .three_medals
dw .four_medals
dw .five_medals
dw .more_than_five_medals
dw .more_than_five_medals
dw .more_than_five_medals
.three_medals
get_event_value EVENT_CHALLENGE_CUP_1_STATE
or a ; cp CHALLENGE_CUP_NOT_STARTED
jr nz, .less_than_three_medals
ld c, CHALLENGE_CUP_READY_TO_START
set_event_value EVENT_CHALLENGE_CUP_1_STATE
jr .less_than_three_medals
.five_medals
get_event_value EVENT_CHALLENGE_CUP_2_STATE
or a ; cp CHALLENGE_CUP_NOT_STARTED
jr nz, .four_medals
ld c, CHALLENGE_CUP_READY_TO_START
set_event_value EVENT_CHALLENGE_CUP_2_STATE
jr .four_medals
.more_than_five_medals
ld c, CHALLENGE_CUP_OVER
set_event_value EVENT_CHALLENGE_CUP_2_STATE
.four_medals
ld c, CHALLENGE_CUP_OVER
set_event_value EVENT_CHALLENGE_CUP_1_STATE
.less_than_three_medals
set_event_false EVENT_CHALLENGE_CUP_STARTING
get_event_value EVENT_CHALLENGE_CUP_1_STATE
cp CHALLENGE_CUP_NOT_STARTED
jr z, .check_challenge_cup_two
cp CHALLENGE_CUP_OVER
jr z, .check_challenge_cup_two
ld c, 1
jr .start_challenge_cup
.check_challenge_cup_two
get_event_value EVENT_CHALLENGE_CUP_2_STATE
cp CHALLENGE_CUP_NOT_STARTED
jr z, .check_challenge_cup_three
cp CHALLENGE_CUP_OVER
jr z, .check_challenge_cup_three
ld c, 2
jr .start_challenge_cup
.check_challenge_cup_three
get_event_value EVENT_CHALLENGE_CUP_3_STATE
cp CHALLENGE_CUP_NOT_STARTED
jr z, .no_challenge_cup
cp CHALLENGE_CUP_OVER
jr z, .no_challenge_cup
ld c, 3
.start_challenge_cup
set_event_value EVENT_CHALLENGE_CUP_NUMBER
max_event_value EVENT_CHALLENGE_CUP_STARTING
ld a, MUSIC_CHALLENGE_HALL
ld [wDefaultSong], a
.no_challenge_cup
scf
ret
Script_Clerk9:
start_script
jump_if_event_zero EVENT_CHALLENGE_CUP_1_STATE, .ows_f066
jump_if_event_equal EVENT_CHALLENGE_CUP_3_STATE, CHALLENGE_CUP_OVER, .ows_f069
jump_if_event_equal EVENT_CHALLENGE_CUP_3_STATE, CHALLENGE_CUP_LOST, .ows_f06f
jump_if_event_equal EVENT_CHALLENGE_CUP_3_STATE, CHALLENGE_CUP_WON, .ows_f072
jump_if_event_equal EVENT_CHALLENGE_CUP_3_STATE, CHALLENGE_CUP_READY_TO_START, .ows_f06c
jump_if_event_equal EVENT_CHALLENGE_CUP_2_STATE, CHALLENGE_CUP_OVER, .ows_f069
jump_if_event_equal EVENT_CHALLENGE_CUP_2_STATE, CHALLENGE_CUP_LOST, .ows_f06f
jump_if_event_equal EVENT_CHALLENGE_CUP_2_STATE, CHALLENGE_CUP_WON, .ows_f072
jump_if_event_equal EVENT_CHALLENGE_CUP_2_STATE, CHALLENGE_CUP_READY_TO_START, .ows_f06c
jump_if_event_equal EVENT_CHALLENGE_CUP_1_STATE, CHALLENGE_CUP_OVER, .ows_f069
jump_if_event_equal EVENT_CHALLENGE_CUP_1_STATE, CHALLENGE_CUP_LOST, .ows_f06f
jump_if_event_equal EVENT_CHALLENGE_CUP_1_STATE, CHALLENGE_CUP_WON, .ows_f072
jump_if_event_equal EVENT_CHALLENGE_CUP_1_STATE, CHALLENGE_CUP_READY_TO_START, .ows_f06c
.ows_f066
print_text_quit_fully Text050a
.ows_f069
print_text_quit_fully Text050b
.ows_f06c
print_text_quit_fully Text050c
.ows_f06f
print_text_quit_fully Text050d
.ows_f072
print_text_quit_fully Text050e
|