forked from coderwilson/FFX_TAS_Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFFX_ThunderPlains.py
More file actions
340 lines (317 loc) · 10.9 KB
/
FFX_ThunderPlains.py
File metadata and controls
340 lines (317 loc) · 10.9 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
import time
import FFX_Xbox
import FFX_Screen
import FFX_Battle
import FFX_menu
import FFX_memory
FFXC = FFX_Xbox.FFXC
def southPathing(blitzwin):
print("Start of the Thunder Plains section")
checkpoint = 0
stepCount = 0
stepMax = 500
complete = 0
status = [False,False,False,False] #Rikku charged, Light Curtain, Lunar Curtain, Grenade Thrown
status[2] = blitzwin
speedcount = FFX_memory.getSpeed()
if speedcount >= 14:
status[3] = True
FFX_memory.fullPartyFormat_New('postbunyip', 11)
while complete == 0:
if FFX_Screen.dodgeLightning():
print("Dodge")
if FFX_memory.userControl():
pos = FFX_memory.getCoords()
stepCount += 1
if checkpoint == 0:
if pos[1] > -800:
checkpoint = 1
else:
FFXC.set_value('AxisLy', 1)
if pos[0] > 15:
FFXC.set_value('AxisLx', 0)
else:
FFXC.set_value('AxisLx', 1)
elif checkpoint == 1:
if pos[1] > -600:
checkpoint = 2
else:
FFXC.set_value('AxisLy', 1)
if pos[0] > 0:
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLx', 0)
elif checkpoint == 2:
if pos[1] > 700:
checkpoint = 3
else:
FFXC.set_value('AxisLy', 1)
if pos[0] < -30:
FFXC.set_value('AxisLx', 1)
elif pos[0] > 12:
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLx', 0)
elif checkpoint == 3:
if FFX_memory.getMap() == 256:
checkpoint = 4
print("End of the southern section.")
else:
FFXC.set_value('AxisLy', 1)
if pos[0] < 70:
FFXC.set_value('AxisLx', 1)
else:
FFXC.set_value('AxisLx', 0)
elif checkpoint == 4:
FFXC.set_value('AxisLy', 1)
FFX_Xbox.SkipDialog(0.5)
FFXC.set_value('AxisLx', -1)
FFX_Xbox.SkipDialog(10)
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
complete = 1
else:
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
if FFX_memory.diagSkipPossible():
FFX_Xbox.menuB()
if FFX_Screen.BattleScreen():
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
print("Starting battle")
status = FFX_Battle.thunderPlains(status, 1)
elif FFX_Screen.BattleComplete():
FFX_Xbox.menuB()
return status
def agency(blitzWin):
#Arrive at the travel agency
FFX_memory.clickToControl3()
speedCount = FFX_memory.getSpeed()
#Talk to the lady
FFXC.set_value('AxisLy', 1)
time.sleep(0.3)
FFXC.set_value('AxisLx', 1)
FFX_Xbox.SkipDialog(0.15)
FFXC.set_value('AxisLy', 0)
FFXC.set_value('AxisLx', 0)
time.sleep(0.6)
FFX_Xbox.menuB()
FFX_Screen.awaitPixel(888,470,(191, 191, 191))
time.sleep(0.2)
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuB()
time.sleep(1.6)
FFX_Xbox.menuB()
time.sleep(0.2)
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuB()
time.sleep(0.2)
FFX_Xbox.menuRight()
speedNeeded = 14 - speedCount #15 plus two (Spherimorph, Flux), minus 1 because it starts on 1
if speedNeeded > 1:
speedNeeded = 1 #Limit so we don't over-spend and run out of money.
if speedNeeded > 0:
while speedNeeded > 0:
FFX_Xbox.menuRight()
speedNeeded -= 1
FFX_Xbox.menuB()
time.sleep(0.2)
FFX_Xbox.menuA()
FFX_Xbox.menuA()
FFX_Xbox.SkipDialog(0.3)
#Next, Grab Auron's weapon
time.sleep(0.5)
FFX_Xbox.menuB()
FFX_Screen.awaitPixel(888,470,(191, 191, 191))
time.sleep(0.2)
FFX_Xbox.menuDown()
FFX_Xbox.menuB() #Got any weapons?
time.sleep(1.6)
FFX_Xbox.menuRight()
time.sleep(0.4)
FFX_Xbox.menuB() #Sell
time.sleep(0.4)
FFX_Xbox.menuB()
time.sleep(0.1)
FFX_Xbox.menuUp()
FFX_Xbox.menuB() #Sell Tidus' longsword
time.sleep(0.1)
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuB()
time.sleep(0.1)
FFX_Xbox.menuUp()
FFX_Xbox.menuB() #Sell Auron Katana
time.sleep(0.1)
time.sleep(0.1)
FFX_Xbox.menuA()
FFX_Xbox.menuLeft()
time.sleep(0.4)
FFX_Xbox.menuB() #Buy
time.sleep(0.8)
#time.sleep(30) #Testing only
if blitzWin == False:
FFX_Xbox.menuB()
time.sleep(0.8)
FFX_Xbox.menuUp() #Baroque sword
#time.sleep(10) #Testing only
time.sleep(0.1)
FFX_Xbox.menuB() #Weapon for Tidus (for Evrae fight)
time.sleep(0.1)
FFX_Xbox.menuB() #Do not equip
time.sleep(0.1)
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuDown()
FFX_Xbox.menuB() #Shimmering Blade
time.sleep(0.1)
FFX_Xbox.menuUp()
FFX_Xbox.menuB()
time.sleep(0.1)
FFX_Xbox.menuB() #Do not equip
time.sleep(0.1)
FFX_Xbox.menuA()
FFX_Xbox.menuA()
#Now for Yuna's scene
FFXC.set_value('AxisLx', 1)
time.sleep(1.2)
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 1)
time.sleep(1.5)
FFXC.set_value('AxisLy', 0)
time.sleep(2) #Scene in Yuna's room. Not as exciting as it sounds.
FFX_memory.clickToControl3()
print("Yuna's done talking. Let's keep going.")
FFXC.set_value('AxisLy', -1)
time.sleep(1.5)
FFXC.set_value('AxisLy', 0)
FFXC.set_value('AxisLx', -1)
time.sleep(0.2)
FFXC.set_value('AxisLx', 0)
FFX_Xbox.menuB() #Talk to Rikku
FFX_memory.clickToControl3()
FFXC.set_value('AxisLy', 1)
FFXC.set_value('AxisLx', 1)
time.sleep(1.5)
FFXC.set_value('AxisLx', 0)
time.sleep(0.1)
FFX_Xbox.SkipDialog(3) #Pick up lightning shield
time.sleep(2)
FFXC.set_value('AxisLy', 0)
FFX_Screen.awaitMap1()
def northPathing(status):
#Start of northern section
checkpoint = 0
stepCount = 0
stepMax = 500
while checkpoint < 1000:
if FFX_Screen.dodgeLightning():
print("Dodge")
if FFX_memory.userControl():
pos = FFX_memory.getCoords()
stepCount += 1
if pos == [0.0,0.0]: #This means we've lost control of the character for any reason.
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
FFX_Xbox.menuB()
elif checkpoint == 0:
if pos[1] > -900:
checkpoint = 10
else:
FFXC.set_value('AxisLy', 1)
elif checkpoint == 10:
if pos[1] > -700:
checkpoint = 20
else:
FFXC.set_value('AxisLy', 1)
if pos[0] < 10:
FFXC.set_value('AxisLx', 1)
elif pos[0] > 50:
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLx', 0)
elif checkpoint == 20:
if pos[1] > -20:
checkpoint = 30
else:
FFXC.set_value('AxisLy', 1)
if pos[0] < 50:
FFXC.set_value('AxisLx', 1)
elif pos[0] > 85:
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLx', 0)
elif checkpoint == 30:
if pos[1] > -100:
checkpoint = 40
#complete = 1
else:
FFXC.set_value('AxisLy', 1)
if pos[0] > 50:
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLx', 0)
elif checkpoint == 40:
if pos[1] > 190:
checkpoint = 50
#complete = 1
else:
if pos[0] > 90:
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLy', 1)
elif checkpoint == 50:
if status[2] == True:
checkpoint = 60
else:
FFXC.set_value('AxisLy', 0)
FFXC.set_value('AxisLx', 1)
time.sleep(1)
FFXC.set_value('AxisLx', -1)
time.sleep(1)
elif checkpoint == 60:
if pos[1] > 1 and pos[1] < 150:
checkpoint = 1000
else:
FFXC.set_value('AxisLy', 1)
if pos[0] < 70:
FFXC.set_value('AxisLx', 1)
elif pos[0] > 90:
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLx', 0)
elif FFX_Screen.BattleScreen():
print("Starting battle")
status = FFX_Battle.thunderPlains(status, 2)
elif FFX_memory.menuOpen():
FFX_Xbox.menuB()
elif FFX_memory.getMap() == 110:
print("Thunder Plains North complete")
checkpoint = 1000
else:
FFX_Xbox.menuB()
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
FFX_memory.awaitControl()
print("Thunder Plains North complete. Moving up to the Macalania save sphere.")
FFXC.set_value('AxisLy', 1)
FFX_Xbox.SkipDialog(6)
FFXC.set_value('AxisLy', 0)
FFXC.set_value('AxisLx', 0)
FFX_memory.clickToControl3() # Conversation with Auron about Yuna being hard to guard.
FFXC.set_value('AxisLy', 1)
FFXC.set_value('AxisLx', 1)
FFX_Xbox.SkipDialog(6)
FFXC.set_value('AxisLy', 0)
FFXC.set_value('AxisLx', 0) #Approaching the party
return status