forked from jfd02/TFT-OCR-BOT
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcomps.py
57 lines (47 loc) · 2.23 KB
/
comps.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
import random
class CompsManager:
def __init__(self):
self.index_current : int = -1
self.sequence_index : int = -1
self.is_sequence_mode = False
self.sequence : list = []
self.comps_loaded : list[str, dict[str, dict[str,]]] = []
self.champions: dict[str, dict[str, int]] = {}
def SetCOMPSLoaded(self, input):
self.comps_loaded = input
def SelectNextComp(self):
sequence_len = len(self.sequence)
comps_size = len(self.comps_loaded)
if self.is_sequence_mode == False:
self.index_current = random.randint(0, comps_size-1)
else:
self.sequence_index = self.sequence_index + 1
if (self.sequence_index >= sequence_len):
self.sequence_index = 0
self.index_current = self.sequence[self.sequence_index]
print(f"[!] {self.CURRENT_COMP()[0]} [{','.join(self.CURRENT_COMP()[1])}] comp is selected")
def CURRENT_COMP(self):
return self.comps_loaded[self.index_current]
def champion_board_size(self, champion: str) -> int:
return self.champions[champion]["Board Size"]
def champion_gold_cost(self, champion: str) -> int:
return self.champions[champion]["Gold"]
def champions_to_buy(self) -> list:
"""Creates a list of champions to buy during the game"""
champs_to_buy: list = []
for champion, champion_data in self.CURRENT_COMP()[1].items():
if champion_data["level"] == 1:
champs_to_buy.append(champion)
elif champion_data["level"] == 2:
champs_to_buy.extend([champion] * 3)
elif champion_data["level"] == 3:
champs_to_buy.extend([champion] * 9)
else:
raise Exception("Comps.py | Champion level must be a valid level (1-3)")
return champs_to_buy
def get_unknown_slots(self) -> list:
"""Creates a list of slots on the board that don't have a champion from the team composition"""
container: list = []
for champion_data in self.CURRENT_COMP()[1]:
container.append(self.CURRENT_COMP()[1][champion_data]["board_position"])
return [n for n in range(27) if n not in container]