-
Notifications
You must be signed in to change notification settings - Fork 1
/
hortensia_recollection.lua
216 lines (184 loc) · 6.55 KB
/
hortensia_recollection.lua
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
require("utils/lib_loader")
LOG_ENABLED = true
STAGE_NUM = 16
ALLOWED_AP_OPTIONS = {
"AP10",
"AP30",
"AP50",
"APMAX",
"APSTONE"
}
ALLOWED_BP_OPTIONS = {}
ALLOWED_TICKET_OPTIONS = {
--"ADELHEID",
"CHARLOT",
"MARYUS",
"MAURICE",
"DEFROT"
}
FINAL_WAVE_SKILL = true
MUS_PAUSE = 0.1
MUS_HOLD = 0
MUSA_PAUSE = 5
MUSA_HOLD = 0.3
REC_PATHS_LOAD_PAUSE = 7
REC_HOME_LOAD_PAUSE = 10
if LOG_ENABLED then
log("\n\n\nbegin script logging:")
end
local recollection_home_proceed = function()
return retry(recollection_home_tap_proceed)()
end
-------------------------------
-- Options for Unit Select --
-------------------------------
local sk = function()
return alert("no sk defined for recollection")
end
local ek = function()
return alert("this should not happen, no ek defined for recollection")
end
local exec_battle = function()
act_once(magonia_boss_unit_select_tap_unit(6))(MUS_PAUSE, MUS_HOLD)
return magonia_boss_unit_select_with_insufficient_bp_check(ALLOWED_BP_OPTIONS, sk, ek)(function()
act_once(magonia_boss_unit_select_tap_unit(7))(MUS_PAUSE, MUS_HOLD)
return magonia_boss_unit_select_with_insufficient_bp_check(ALLOWED_BP_OPTIONS, sk, ek)(function()
act_once(magonia_boss_unit_select_tap_unit(8))(MUS_PAUSE, MUS_HOLD)
return magonia_boss_unit_select_with_insufficient_bp_check(ALLOWED_BP_OPTIONS, sk, ek)(function()
act_once(magonia_boss_unit_select_tap_unit(9))(MUS_PAUSE, MUS_HOLD)
return magonia_boss_unit_select_with_insufficient_bp_check(ALLOWED_BP_OPTIONS, sk, ek)(function()
act_once(magonia_boss_unit_select_tap_unit(10))(MUS_PAUSE, MUS_HOLD)
return magonia_boss_unit_select_with_insufficient_bp_check(ALLOWED_BP_OPTIONS, sk, ek)(function()
act_once(magonia_boss_unit_select_tap_attack)(MUSA_PAUSE, MUSA_HOLD)
return recollection_execute_boss_battle()
end)
end)
end)
end)
end)
end
local special_mission_complete = function()
return mission_complete(mission_complete_special_complete)
end
local treasure_chance_complete = function()
return recollection_treasure_chance_complete() or mission_complete_battle_complete_friend_request()
end
function exec_mission(k)
-- Special Mission
retry(battle_helper_select_tap_first_helper)(2)
retry(battle_party_select_tap_confirm)()
return in_battle_daemon(special_mission_complete)(function()
mission_complete_proceed_to_rewards_confirm(REC_PATHS_LOAD_PAUSE)
if mission_complete_battle_complete_friend_request() then
if LOG_ENABLED then
log("battle_complete, got friend request prompt, tap_discard")
end
retry(mission_complete_friend_request_tap_discard)(REC_PATHS_LOAD_PAUSE)
end
if mission_complete_rank_up() then
if LOG_ENABLED then
log("battle_complete, rank_up_tap_confirm")
end
retry(mission_complete_rank_up_tap_confirm)()
end
if recollection_treasure_chance() then
if LOG_ENABLED then
log("encountered treasure chance!")
end
return recollection_treasure_chance_battle(ALLOWED_TICKET_OPTIONS)(function()
retry(battle_helper_select_tap_first_helper)(2)
retry(battle_party_select_tap_confirm)()
return in_battle_daemon(treasure_chance_complete)(function()
if mission_complete_battle_complete_friend_request() then
if LOG_ENABLED then
log("treasure chance battle complete, got friend request prompt")
end
retry(mission_complete_friend_request_tap_discard)()
end
sleep_sec(5) -- For stability, treasure_chance_complete animation may take some time
retry(recollection_treasure_chance_complete_tap_confirm)(REC_PATHS_LOAD_PAUSE)
return k()
end)
end, k)
end
act_once(mission_complete_special_tap_confirm)(REC_PATHS_LOAD_PAUSE)
return k()
end)
end
function execute_with(n, k)
local stage = recollection_get_stage(n)
local paths = recollection_get_paths(stage)
if stage.lamp and not recollection_paths_lamp_in_use() then
recollection_paths_use_lamp()
end
if LOG_ENABLED then
log(string.format("recollection proceeding with stage[%d]", n))
end
local tap_path = recollection_paths_tap_path(stage.total)
local ps = recollection_get_path_indices(stage)
local function f(ps)
if LIST.length(ps) == 0 then
return alert("number of paths remain is 0, this should not happen")
end
local i = ps[1]
if recollection_path_taken(paths[i]) then
if LOG_ENABLED then
log(string.format("already taken current path[%d], moving onto next path", i))
end
return f(LIST.tail(ps))
end
retry(tap_path(i))()
retry(tap_screen_center)()
if recollection_boss_encountered() then
recollection_conduct_boss_battle(exec_battle)
giftbox_accept_items()
retry(missions_tap_dropdown)()
retry(missions_dropdown_tap_event(2))(REC_HOME_LOAD_PAUSE) -- Loading event may take time
return with_insufficient_ap_check(recollection_home_proceed, ALLOWED_AP_OPTIONS)(function()
return exec_mission(function()
local next_stage = recollection_get_next_stage_num(n)
if LOG_ENABLED then
log(string.format("proceeding with next_stage[%d]", next_stage))
end
return k(next_stage)
end)
end)
end
if recollection_paths_ap_insufficient() then
if LOG_ENABLED then
log("recollection_paths_ap_insufficient")
end
retry(recollection_paths_ap_insufficient_tap_confirm)()
return with_insufficient_ap_check(recollection_home_proceed, ALLOWED_AP_OPTIONS)(function()
return exec_mission(function()
if not recollection_path_taken(paths[i]) then
local next_stage = recollection_get_next_stage_num(n)
if LOG_ENABLED then
log(string.format("path just taken is available once again, moving onto next_stage[%d]", next_stage))
end
return k(next_stage)
end
return f(LIST.tail(ps))
end)
end)
end
if LOG_ENABLED then
log("recollection proceed with path")
end
return exec_mission(function()
if not recollection_path_taken(paths[i]) then
local next_stage = recollection_get_next_stage_num(n)
if LOG_ENABLED then
log(string.format("path just taken is available once again, moving onto next_stage[%d]", next_stage))
end
return k(next_stage)
end
return f(LIST.tail(ps))
end)
end
return f(ps)
end
local function main(n)
return execute_with(n, main)
end
main(STAGE_NUM)