-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathscreen.py
75 lines (59 loc) · 1.78 KB
/
screen.py
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
import logging
from tqdm import tqdm
import memory.main
import vars
logger = logging.getLogger(__name__)
game_vars = vars.vars_handle()
def battle_screen():
if memory.main.turn_ready():
return True
else:
return False
def faint_check():
faints = 0
char_hp = memory.main.get_battle_hp()
front_party = memory.main.get_active_battle_formation()
logger.debug(f"faint_check() {front_party}")
logger.debug(f"faint_check() {char_hp}")
if turn_aeon():
return 0
if front_party[0] != 255 and char_hp[0] == 0:
faints += 1
if front_party[1] != 255 and char_hp[1] == 0:
faints += 1
if front_party[2] != 255 and char_hp[2] == 0:
faints += 1
logger.debug(f"faint_check() Fainted Characters: {faints}")
return faints
def battle_complete():
if not memory.main.battle_active():
return True
else:
return False
def await_turn():
logger.debug("Waiting for next turn in combat.")
# Just to make sure there's no overlap from the previous character's turn
# Now let's do this.
fmt = "Waiting for player turn... elapsed {elapsed}"
with tqdm(bar_format=fmt) as pbar:
while not (battle_screen() or memory.main.user_control()):
pbar.update()
if not memory.main.battle_active():
pass
if memory.main.game_over():
return False
while not memory.main.main_battle_menu():
pass
return True
def turn_seymour():
if memory.main.get_battle_char_turn() == 7:
return True
else:
return False
def turn_aeon():
turn = memory.main.get_battle_char_turn()
if turn > 7 and turn <= 19:
logger.debug(f"Aeon's turn: {turn}")
return True
else:
return False