1
+ import logging
2
+
1
3
import battle .main
2
4
import logs
3
5
import memory .main
4
6
import screen
5
7
import vars
6
8
import xbox
7
- import logging
8
9
9
10
FFXC = xbox .controller_handle ()
10
11
game_vars = vars .vars_handle ()
11
12
12
13
logger = logging .getLogger (__name__ )
13
14
15
+
14
16
def ammes ():
15
17
BattleComplete = 0
16
18
countAttacks = 0
@@ -65,7 +67,7 @@ def klikk():
65
67
logger .info ("Fight start: Klikk" )
66
68
klikkAttacks = 0
67
69
klikkRevives = 0
68
- stealCount = 0
70
+ steal_count = 0
69
71
while not memory .main .battle_complete (): # AKA end of battle screen
70
72
if memory .main .turn_ready ():
71
73
BattleHP = memory .main .get_battle_hp ()
@@ -79,7 +81,7 @@ def klikk():
79
81
battle .main .attack ("none" )
80
82
klikkAttacks += 1
81
83
elif screen .turn_rikku ():
82
- grenadeCount = memory .main .get_item_count_slot (
84
+ gregrenade_count = memory .main .get_item_count_slot (
83
85
memory .main .get_item_slot (35 )
84
86
)
85
87
if (
@@ -95,12 +97,12 @@ def klikk():
95
97
elif memory .main .get_enemy_current_hp ()[0 ] < 58 :
96
98
battle .main .attack ("none" )
97
99
klikkAttacks += 1
98
- elif grenadeCount < 6 and memory .main .next_steal (
99
- steal_count = stealCount
100
+ elif gregrenade_count < 6 and memory .main .next_steal (
101
+ steal_count = steal_count
100
102
):
101
103
logger .info ("Attempting to steal from Klikk" )
102
104
battle .main .steal ()
103
- stealCount += 1
105
+ steal_count += 1
104
106
else :
105
107
battle .main .attack ("none" )
106
108
klikkAttacks += 1
@@ -168,20 +170,20 @@ def tros():
168
170
Revives += 1
169
171
elif screen .turn_rikku ():
170
172
logger .debug ("Rikku turn" )
171
- grenadeSlot = memory .main .get_item_slot (35 )
172
- grenadeCount = memory .main .get_item_count_slot (grenadeSlot )
173
+ grenade_slot = memory .main .get_item_slot (35 )
174
+ gregrenade_count = memory .main .get_item_count_slot (grenade_slot )
173
175
logger .debug ("------------------------------" )
174
- logger .debug (f"Current grenade count: { grenadeCount } " )
176
+ logger .debug (f"Current grenade count: { gregrenade_count } " )
175
177
logger .debug (f"Grenades used: { Grenades } " )
176
178
logger .debug ("------------------------------" )
177
- totalNades = grenadeCount + Grenades
179
+ totalNades = gregrenade_count + Grenades
178
180
if totalNades < 6 :
179
181
if trosPos == 1 :
180
182
battle .main .defend ()
181
183
else :
182
184
battle .main .steal ()
183
185
Steals += 1
184
- elif grenadeCount == 0 :
186
+ elif gregrenade_count == 0 :
185
187
if trosPos == 1 :
186
188
battle .main .defend ()
187
189
else :
@@ -192,8 +194,8 @@ def tros():
192
194
battle .main .steal ()
193
195
Steals += 1
194
196
else :
195
- grenadeSlot = memory .main .get_use_items_slot (35 )
196
- battle .main .use_item (grenadeSlot , "none" )
197
+ grenade_slot = memory .main .get_use_items_slot (35 )
198
+ battle .main .use_item (grenade_slot , "none" )
197
199
Grenades += 1
198
200
elif screen .turn_tidus ():
199
201
logger .debug ("Tidus turn" )
@@ -217,7 +219,7 @@ def sin_fin():
217
219
logger .info ("Fight start: Sin's Fin" )
218
220
screen .await_turn ()
219
221
finTurns = 0
220
- kimTurn = False
222
+ kim_turn = False
221
223
complete = False
222
224
while not complete :
223
225
if memory .main .turn_ready ():
@@ -231,27 +233,27 @@ def sin_fin():
231
233
battle .main .thunder_target (target = 23 , direction = "r" )
232
234
elif screen .turn_kimahri ():
233
235
battle .main .lancet_target (target = 23 , direction = "r" )
234
- kimTurn = True
236
+ kim_turn = True
235
237
elif screen .turn_lulu ():
236
238
battle .main .thunder_target (target = 23 , direction = "r" )
237
239
else :
238
240
battle .main .defend ()
239
- if finTurns >= 3 and kimTurn :
241
+ if finTurns >= 3 and kim_turn :
240
242
complete = True
241
243
242
244
logger .info ("First few turns are complete. Now for the rest of the fight." )
243
245
# After the first two turns, the rest of the fight is pretty much scripted.
244
- turnCounter = 0
246
+ turn_counter = 0
245
247
while not memory .main .battle_complete ():
246
248
if memory .main .turn_ready ():
247
- turnCounter += 1
249
+ turn_counter += 1
248
250
if screen .turn_kimahri ():
249
251
screen .await_turn ()
250
252
battle .main .lancet_target (23 , "r" )
251
253
elif screen .turn_lulu ():
252
254
battle .main .thunder_target (23 , "r" )
253
255
elif screen .turn_tidus ():
254
- if turnCounter < 4 :
256
+ if turn_counter < 4 :
255
257
battle .main .defend ()
256
258
memory .main .wait_frames (30 * 0.2 )
257
259
else :
@@ -460,7 +462,7 @@ def chocobo_eater():
460
462
else :
461
463
battle .main .buddy_swap_auron ()
462
464
battle .main .revive ()
463
- # elif 0 not in memory.main.getActiveBattleFormation ():
465
+ # elif 0 not in memory.main.getActivebattle_formation ():
464
466
# Doesn't work - it still hits Tidus if he swapped out and back in (instead of Yuna).
465
467
# buddySwapTidus()
466
468
elif (
@@ -493,15 +495,17 @@ def gui():
493
495
logger .info ("Fight start: Sinspawn Gui" )
494
496
xbox .click_to_battle ()
495
497
logger .info ("Engaging Gui" )
496
- logger .debug (f"##### Expecting crit: { memory .main .next_crit (character = 3 , char_luck = 18 , enemy_luck = 15 )} " )
498
+ logger .debug (
499
+ f"##### Expecting crit: { memory .main .next_crit (character = 3 , char_luck = 18 , enemy_luck = 15 )} "
500
+ )
497
501
wakkaTurn = False
498
502
yunaTurn = False
499
503
auronTurn = False
500
- tidusTurn = False
501
- aeonTurn = False
504
+ tidus_turn = False
505
+ aeon_turn = False
502
506
kimahriCrit = False
503
507
504
- while not aeonTurn :
508
+ while not aeon_turn :
505
509
if memory .main .turn_ready ():
506
510
if screen .turn_yuna ():
507
511
if not yunaTurn :
@@ -515,7 +519,9 @@ def gui():
515
519
wakkaTurn = True
516
520
else :
517
521
battle .main .buddy_swap_kimahri ()
518
- logger .debug (f"##### Expecting crit: { memory .main .next_crit (character = 3 , char_luck = 18 , enemy_luck = 15 )} " )
522
+ logger .debug (
523
+ f"##### Expecting crit: { memory .main .next_crit (character = 3 , char_luck = 18 , enemy_luck = 15 )} "
524
+ )
519
525
elif screen .turn_kimahri ():
520
526
dmgBefore = memory .main .get_enemy_current_hp ()[0 ]
521
527
battle .overdrive .kimahri (2 )
@@ -530,9 +536,9 @@ def gui():
530
536
else :
531
537
logs .write_stats ("False" )
532
538
elif screen .turn_tidus ():
533
- if not tidusTurn :
539
+ if not tidus_turn :
534
540
battle .main .defend ()
535
- tidusTurn = True
541
+ tidus_turn = True
536
542
elif screen .faint_check () > 0 :
537
543
battle .main .buddy_swap_kimahri ()
538
544
else :
@@ -547,7 +553,7 @@ def gui():
547
553
battle .main .defend ()
548
554
elif screen .turn_aeon ():
549
555
battle .overdrive .valefor ()
550
- aeonTurn = True
556
+ aeon_turn = True
551
557
552
558
screen .await_turn ()
553
559
nextHP = memory .main .get_battle_hp ()[0 ]
@@ -718,10 +724,10 @@ def spherimorph():
718
724
FFXC .set_neutral ()
719
725
720
726
spellNum = 0
721
- tidusturns = 0
727
+ tidus_turns = 0
722
728
rikkuturns = 0
723
729
yunaTurn = False
724
- kimTurn = False
730
+ kim_turn = False
725
731
while not memory .main .turn_ready ():
726
732
pass
727
733
while memory .main .battle_active (): # AKA end of battle screen
@@ -731,13 +737,13 @@ def spherimorph():
731
737
turnchar = memory .main .get_battle_char_turn ()
732
738
party_hp = memory .main .get_battle_hp ()
733
739
if turnchar == 0 :
734
- if tidusturns == 0 :
740
+ if tidus_turns == 0 :
735
741
battle .main .equip_in_battle (equip_type = "armor" , ability_num = 0x8028 )
736
- elif tidusturns == 1 :
742
+ elif tidus_turns == 1 :
737
743
battle .main .defend ()
738
744
else :
739
745
battle .main .buddy_swap_rikku ()
740
- tidusturns += 1
746
+ tidus_turns += 1
741
747
elif turnchar == 1 :
742
748
rikkuslotnum = memory .main .get_battle_char_slot (6 )
743
749
if rikkuslotnum < 3 and party_hp [rikkuslotnum ] == 0 :
@@ -762,9 +768,11 @@ def spherimorph():
762
768
rikkuslotnum = memory .main .get_battle_char_slot (6 )
763
769
if rikkuslotnum < 3 and party_hp [rikkuslotnum ] == 0 :
764
770
battle .main .revive ()
765
- kimTurn = True
766
- elif not kimTurn :
767
- logger .debug (f"RNG11 before Spherimorph: { memory .main .rng_array_from_index (index = 11 , array_len = 30 )} " )
771
+ kim_turn = True
772
+ elif not kim_turn :
773
+ logger .debug (
774
+ f"RNG11 before Spherimorph: { memory .main .rng_array_from_index (index = 11 , array_len = 30 )} "
775
+ )
768
776
logs .write_rng_track ("RNG11 before Spherimorph" )
769
777
logs .write_rng_track (
770
778
memory .main .rng_array_from_index (index = 11 , array_len = 30 )
@@ -775,7 +783,7 @@ def spherimorph():
775
783
# _steal()
776
784
# else:
777
785
battle .main .defend ()
778
- kimTurn = True
786
+ kim_turn = True
779
787
elif 6 not in memory .main .get_active_battle_formation ():
780
788
battle .main .buddy_swap_rikku ()
781
789
elif 5 not in memory .main .get_active_battle_formation ():
@@ -859,7 +867,7 @@ def crawler():
859
867
# One each for two Negators, Crawler, and guados.
860
868
battle .main .negator_with_steal ()
861
869
else :
862
- tidusturns = 0
870
+ tidus_turns = 0
863
871
rikkuturns = 0
864
872
kimahriturns = 0
865
873
luluturns = 0
@@ -872,12 +880,12 @@ def crawler():
872
880
if memory .main .turn_ready ():
873
881
turnchar = memory .main .get_battle_char_turn ()
874
882
if turnchar == 0 :
875
- if tidusturns == 0 :
883
+ if tidus_turns == 0 :
876
884
logger .debug ("Swapping Tidus for Rikku" )
877
885
battle .main .buddy_swap_rikku ()
878
886
else :
879
887
battle .main .defend ()
880
- tidusturns += 1
888
+ tidus_turns += 1
881
889
elif turnchar == 6 :
882
890
if luluturns < 2 :
883
891
logger .debug ("Using Lightning Marble" )
@@ -1004,7 +1012,9 @@ def wendigo():
1004
1012
)
1005
1013
if battle .main .fullheal (target = 0 , direction = "l" ) == 0 :
1006
1014
if screen .faint_check ():
1007
- logger .debug ("No healing items so revive someone instead" )
1015
+ logger .debug (
1016
+ "No healing items so revive someone instead"
1017
+ )
1008
1018
battle .main .revive ()
1009
1019
else :
1010
1020
logger .debug ("No healing items so just go face" )
@@ -1046,8 +1056,8 @@ def wendigo():
1046
1056
):
1047
1057
battle .main .steal ()
1048
1058
guadosteal = True
1049
- # elif memory.main.get_enemy_current_hp().count(0) == 2 and not 5 in memory.main.getActiveBattleFormation ():
1050
- # buddySwapLulu ()
1059
+ # elif memory.main.get_enemy_current_hp().count(0) == 2 and not 5 in memory.main.getActivebattle_formation ():
1060
+ # buddy_swap_lulu ()
1051
1061
else :
1052
1062
battle .main .defend ()
1053
1063
elif turnchar == 2 :
@@ -1114,9 +1124,9 @@ def evrae():
1114
1124
kimahriTurns = 0
1115
1125
lunarCurtain = False
1116
1126
if memory .main .rng_seed () == 31 :
1117
- stealCount = 2
1127
+ steal_count = 2
1118
1128
else :
1119
- stealCount = 0
1129
+ steal_count = 0
1120
1130
FFXC .set_neutral ()
1121
1131
# This gets us past the tutorial and all the dialog.
1122
1132
xbox .click_to_battle ()
@@ -1201,20 +1211,20 @@ def evrae():
1201
1211
logger .debug ("Heal should be successful." )
1202
1212
elif game_vars .skip_kilika_luck ():
1203
1213
if memory .main .get_use_items_slot (32 ) != 255 :
1204
- throwSlot = memory .main .get_use_items_slot (32 )
1214
+ throw_slot = memory .main .get_use_items_slot (32 )
1205
1215
elif memory .main .get_use_items_slot (24 ) != 255 :
1206
- throwSlot = memory .main .get_use_items_slot (24 )
1216
+ throw_slot = memory .main .get_use_items_slot (24 )
1207
1217
elif memory .main .get_use_items_slot (27 ) != 255 :
1208
- throwSlot = memory .main .get_use_items_slot (27 )
1218
+ throw_slot = memory .main .get_use_items_slot (27 )
1209
1219
else :
1210
- throwSlot = memory .main .get_use_items_slot (30 )
1211
- if throwSlot == 255 :
1220
+ throw_slot = memory .main .get_use_items_slot (30 )
1221
+ if throw_slot == 255 :
1212
1222
battle .main .steal ()
1213
1223
else :
1214
- battle .main .use_item (throwSlot )
1224
+ battle .main .use_item (throw_slot )
1215
1225
else :
1216
1226
battle .main .steal ()
1217
- stealCount += 1
1227
+ steal_count += 1
1218
1228
elif turnchar == 3 :
1219
1229
logger .debug ("Registering Kimahri's turn" )
1220
1230
if not game_vars .get_blitz_win () and not lunarCurtain :
@@ -1234,20 +1244,20 @@ def evrae():
1234
1244
logger .debug ("Heal should be successful." )
1235
1245
elif game_vars .skip_kilika_luck ():
1236
1246
if memory .main .get_use_items_slot (32 ) != 255 :
1237
- throwSlot = memory .main .get_use_items_slot (32 )
1247
+ throw_slot = memory .main .get_use_items_slot (32 )
1238
1248
elif memory .main .get_use_items_slot (24 ) != 255 :
1239
- throwSlot = memory .main .get_use_items_slot (24 )
1249
+ throw_slot = memory .main .get_use_items_slot (24 )
1240
1250
elif memory .main .get_use_items_slot (27 ) != 255 :
1241
- throwSlot = memory .main .get_use_items_slot (27 )
1251
+ throw_slot = memory .main .get_use_items_slot (27 )
1242
1252
else :
1243
- throwSlot = memory .main .get_use_items_slot (30 )
1244
- if throwSlot == 255 :
1253
+ throw_slot = memory .main .get_use_items_slot (30 )
1254
+ if throw_slot == 255 :
1245
1255
battle .main .steal ()
1246
1256
else :
1247
- battle .main .use_item (throwSlot )
1257
+ battle .main .use_item (throw_slot )
1248
1258
else :
1249
1259
battle .main .steal ()
1250
- stealCount += 1
1260
+ steal_count += 1
1251
1261
elif memory .main .diag_skip_possible ():
1252
1262
xbox .tap_b ()
1253
1263
@@ -1505,6 +1515,7 @@ def seymour_flux():
1505
1515
logger .info ("-----------------------------" )
1506
1516
# time.sleep(60) #Testing only
1507
1517
1518
+
1508
1519
def s_keeper_bahamut_crit () -> int :
1509
1520
bahamut_crit = memory .main .next_crit (character = 7 , char_luck = 17 , enemy_luck = 15 )
1510
1521
logger .debug (f"Next Aeon Crit: { bahamut_crit } " )
@@ -1754,8 +1765,8 @@ def yu_yevon():
1754
1765
xbox .tap_down ()
1755
1766
while memory .main .main_battle_menu ():
1756
1767
xbox .tap_b ()
1757
- itemPos = memory .main .get_throw_items_slot (itemNum )
1758
- battle .main ._navigate_to_position (itemPos )
1768
+ item_pos = memory .main .get_throw_items_slot (itemNum )
1769
+ battle .main ._navigate_to_position (item_pos )
1759
1770
while memory .main .other_battle_menu ():
1760
1771
xbox .tap_b ()
1761
1772
while not memory .main .enemy_targetted ():
0 commit comments