Skip to content

Commit 1ec4e98

Browse files
authored
Merge pull request #249 from shenef/main
import and formatting fixes
2 parents 822a41b + 53af2e4 commit 1ec4e98

File tree

12 files changed

+243
-115
lines changed

12 files changed

+243
-115
lines changed

Diff for: area/djose.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ def trials():
359359
memory.main.click_to_control()
360360
logger.info("Leaving the fayth room")
361361

362-
while not pathing.set_movement([-1,-61]):
362+
while not pathing.set_movement([-1, -61]):
363363
pass
364-
FFXC.set_movement(1,1)
364+
FFXC.set_movement(1, 1)
365365
memory.main.await_event()
366366
FFXC.set_neutral()
367367

Diff for: area/home.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,15 @@ def desert():
241241
logger.debug("-----------------------------Flag statuses (end)")
242242
elif memory.main.diag_skip_possible():
243243
xbox.tap_b()
244-
244+
245245
# Move to save sphere
246246
checkpoint = 0
247247
while checkpoint < 7:
248248
if pathing.set_movement(pathing.home(checkpoint)):
249249
checkpoint += 1
250250
logger.debug(f"Checkpoint reached: {checkpoint}")
251251

252+
252253
def find_summoners():
253254
logger.info("Desert complete. Starting Home section")
254255
menu.home_grid()

Diff for: area/mrr.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,15 @@ def main_path():
224224
logger.info("End of MRR section. Status:")
225225
logger.info("[Yuna AP, Kim AP, Valefor OD steps, then other stuff]")
226226
logger.info(status)
227-
227+
228228
# Get close to save sphere
229229
checkpoint = 0
230230
while checkpoint < 4:
231231
if pathing.set_movement(pathing.battle_site(checkpoint)):
232232
checkpoint += 1
233233
logger.debug(f"Checkpoint reached: {checkpoint}")
234234

235+
235236
def battle_site():
236237
memory.main.await_control()
237238
if game_vars.get_l_strike() >= 2:

Diff for: battle/main.py

+7
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,7 @@ def miihen_road(self_destruct=False):
910910
logger.debug(f"self_destruct flag: {game_vars.self_destruct_get()}")
911911

912912

913+
# move to battle.aeon
913914
def aeon_shield():
914915
logger.info("Aeon Shield function")
915916
screen.await_turn()
@@ -926,6 +927,7 @@ def aeon_shield():
926927
tap_targeting()
927928

928929

930+
# move to battle.aeon
929931
def aeon_boost():
930932
logger.info("Aeon Boost function")
931933
screen.await_turn()
@@ -944,6 +946,7 @@ def aeon_boost():
944946
tap_targeting()
945947

946948

949+
# move to battle.aeon
947950
def aeon_dismiss():
948951
logger.info("Aeon Dismiss function")
949952
screen.await_turn()
@@ -3836,6 +3839,7 @@ def thunder_target(target, direction):
38363839
tap_targeting()
38373840

38383841

3842+
# move to battle.aeon
38393843
def aeon_summon(position):
38403844
logger.debug(f"Summoning Aeon {position}")
38413845
while not memory.main.main_battle_menu():
@@ -3870,14 +3874,17 @@ def aeon_summon(position):
38703874
pbar.update()
38713875

38723876

3877+
# move to battle.aeon
38733878
def aeon_spell(position):
38743879
aeon_spell_direction(position, None)
38753880

38763881

3882+
# move to battle.aeon
38773883
def aeon_spell_2(position, direction):
38783884
aeon_spell_direction(position, direction)
38793885

38803886

3887+
# move to battle.aeon
38813888
def aeon_spell_direction(position, direction):
38823889
logger.debug(f"Aeon casting a spell. Special direction: {direction}")
38833890
while memory.main.battle_menu_cursor() != 21:

Diff for: json_ai_files/oblitz_results.json

+24-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,28 @@
1313
"victory": true
1414
}
1515
},
16+
"1": {
17+
"78287081": {
18+
"duration": 437,
19+
"victory": true
20+
},
21+
"191289547": {
22+
"duration": 534,
23+
"victory": false
24+
},
25+
"596621567": {
26+
"duration": 486,
27+
"victory": false
28+
},
29+
"720440554": {
30+
"duration": 548,
31+
"victory": true
32+
},
33+
"1563227986": {
34+
"duration": 473,
35+
"victory": false
36+
}
37+
},
1638
"16": {
1739
"453439872": {
1840
"duration": 487,
@@ -47,8 +69,8 @@
4769
"victory": false
4870
},
4971
"314267917": {
50-
"duration": 623,
51-
"victory": false
72+
"duration": 572,
73+
"victory": true
5274
},
5375
"328977576": {
5476
"duration": 432,

Diff for: load_game.py

+23-20
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Libraries and Core Files
2+
import json
23
import logging
34
import os
45
from pathlib import Path
56

6-
import json
77
import area.dream_zan
88
import logs
99
import memory.main
@@ -13,7 +13,7 @@
1313
import xbox
1414
import zz_airship_path
1515
from gamestate import game
16-
import logging
16+
1717
logger = logging.getLogger(__name__)
1818

1919
# This file is intended to load the game to a saved file.
@@ -23,27 +23,28 @@
2323
FFXC = xbox.controller_handle()
2424
game_vars = vars.vars_handle()
2525

26-
def move_after_load(spec_move:str):
26+
27+
def move_after_load(spec_move: str):
2728
if spec_move == "miihen_laugh":
2829
load_miihen_start_laugh()
2930
elif spec_move == "miihen_no_laugh":
3031
load_miihen_start()
3132
elif spec_move == "MRR":
3233
load_mrr()
33-
3434

35-
def load_into_game(gamestate:str, step_counter:str):
35+
36+
def load_into_game(gamestate: str, step_counter: str):
3637
logger.debug(f"Loading game state {gamestate} | {step_counter}")
3738
# If wrong maps are loaded in, try to reset.
3839
if memory.main.get_map() not in [23, 348, 349]:
3940
reset.reset_to_main_menu()
4041
area.dream_zan.new_game(gamestate=gamestate)
41-
42+
4243
# Now to get details for the load/save files
43-
filepath = os.path.join('json_ai_files', 'save_load_details.json')
44+
filepath = os.path.join("json_ai_files", "save_load_details.json")
4445
with open(filepath, "r") as fp:
4546
results = json.load(fp)
46-
47+
4748
# Try to use new method, otherwise try old method.
4849
try:
4950
step_counter = str(step_counter)
@@ -52,7 +53,7 @@ def load_into_game(gamestate:str, step_counter:str):
5253
logger.debug("Failure 1")
5354
load_into_game_old(gamestate=gamestate, step_counter=step_counter)
5455
return
55-
56+
5657
# Init variables so we don't crash later
5758
save_num_conf = 0
5859
nemesis_conf = "none"
@@ -61,11 +62,11 @@ def load_into_game(gamestate:str, step_counter:str):
6162
nea_zone = "none"
6263
nem_ap = "none"
6364
spec_move = "none"
64-
65+
6566
print(results[gamestate][step_counter].keys())
6667
for key in results[gamestate][step_counter]:
6768
save_num = int(results[gamestate][step_counter][key]["save_num"])
68-
69+
6970
nemesis = key
7071
if save_num > 200:
7172
pass
@@ -82,36 +83,37 @@ def load_into_game(gamestate:str, step_counter:str):
8283
logger.debug(f"End game version {end_ver}")
8384
logger.debug(f"NEA zone {nea_zone}")
8485
logger.debug(f"Nemesis checkpoint {nem_ap}")
85-
86+
8687
if save_num_conf == 0:
8788
logger.debug("Failure 2")
8889
load_into_game_old(gamestate=gamestate, step_counter=step_counter)
8990
return
9091
else:
9192
# Perform the load
9293
load_save_num(int(save_num_conf))
93-
game_vars.set_blitz_win(value=(blitz_win=="True"))
94+
game_vars.set_blitz_win(value=(blitz_win == "True"))
9495
game_vars.end_game_version_set(value=int(end_ver))
9596
game_vars.set_nea_zone(value=int(nea_zone))
9697
game_vars.set_nem_checkpoint_ap(value=int(nem_ap))
97-
98+
9899
if spec_move != "none":
99100
logger.debug(f"Special movement needed: {spec_move}")
100101
move_after_load(spec_move=spec_move)
101102
else:
102103
logger.debug("No Special movement needed")
103-
104+
104105
logger.debug(f"Blitz Win {game_vars.get_blitz_win()}")
105106
logger.debug(f"End game version {game_vars.end_game_version()}")
106107
logger.debug(f"NEA zone {game_vars.get_nea_zone()}")
107108
logger.debug(f"Nemesis checkpoint {game_vars.nem_checkpoint_ap()}")
108109
memory.main.check_nea_armor()
109-
110+
110111
except Exception as err_msg:
111112
logger.debug(f"Error message: {err_msg}")
112113
logger.debug("Failure 3")
113114
load_into_game_old(gamestate=gamestate, step_counter=step_counter)
114115

116+
115117
def load_into_game_old(gamestate: str, step_counter: str):
116118
logger.debug(f"Loading game, old method: {gamestate} | {step_counter}")
117119
if not (gamestate == "Luca" and step_counter == 3):
@@ -699,18 +701,19 @@ def load_miihen_start():
699701

700702
def load_mrr():
701703
memory.main.await_control()
702-
while not pathing.set_movement([-49,166]):
704+
while not pathing.set_movement([-49, 166]):
703705
pass
704-
while not pathing.set_movement([-43,285]):
706+
while not pathing.set_movement([-43, 285]):
705707
pass
706-
while not pathing.set_movement([-39,354]):
708+
while not pathing.set_movement([-39, 354]):
707709
pass
708-
710+
709711
FFXC.set_movement(0, 1)
710712
memory.main.await_event()
711713
FFXC.set_neutral()
712714
memory.main.click_to_control()
713715

716+
714717
def load_mrr_2():
715718
FFXC.set_movement(0, 1)
716719
memory.main.wait_frames(30 * 0.3)

0 commit comments

Comments
 (0)