forked from AdriaGual/marvel-snap-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.py
50 lines (42 loc) · 1.4 KB
/
info.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
from utils import global_utils
import logging
import cv2
import hand_cards
import fields
import field_cards
import mana
# Gets all the possible information from the screen
# Mana to spend
# Cards in hand
# Active fields
# Available fields to play
def get_info(counter, screenshot, screenshot_dimensions, player_turn):
# Logging information
logging.info("---------------------------")
logging.info("Picture: " + str(counter))
# Log turn
logging.info('* Turn: ' + str(player_turn))
# Detect mana
remaining_mana = mana.get_mana(screenshot, screenshot_dimensions)
logging.info('* Mana: ' + str(remaining_mana))
# Detect my cards
my_hand_cards = hand_cards.get_my_hand_cards(
screenshot, screenshot_dimensions, counter, False)
hand_cards.log_hand_cards(my_hand_cards)
# Detect fields
active_fields = fields.get_fields(screenshot, screenshot_dimensions, False)
fields.log_fields(active_fields)
# Detect field cards
player_played_cards = field_cards.get_player_fields_cards(
screenshot, screenshot_dimensions)
field_cards.log_player_fields_cards(player_played_cards)
cv2.waitKey(10)
counter += 1
return {
'player_turn': player_turn,
'mana': remaining_mana,
'my_hand_cards': my_hand_cards,
'active_fields': active_fields,
'player_played_cards': player_played_cards,
'counter': counter
}