-
Notifications
You must be signed in to change notification settings - Fork 0
/
shop.py
76 lines (63 loc) · 2.47 KB
/
shop.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
from email.mime import image
import config
import cards
import imageloader
def display_shop(stdscr):
stdscr.scrollok(1)
stdscr.move(0,0)
config.prev_key = config.key
event = stdscr.getch()
if(event != -1):
config.key = event
else:
config.key = ord(']')
if(config.key != config.prev_key):
if(config.key == ord('a')):
config.card_id_selection -= 1
elif(config.key == ord('d')):
config.card_id_selection += 1
elif(config.key == ord('i')):
config.erase_shop = False
config.current_screen = "open_world"
return
elif(0 < config.shop_points):
if(config.key == ord('h')):
#health
config.shop_points -= 1
config.main_deck.get_card().HP += 1
if(config.key == ord('j')):
#defence
config.shop_points -= 1
config.main_deck.get_card().DEF += 1
if(config.key == ord('k')):
#attack
config.shop_points -= 1
config.main_deck.get_card().ATT += 1
if(config.key == ord('l')):
#energy
config.shop_points -= 1
config.main_deck.get_card().ENG += 1
config.main_deck.select_card(config.card_id_selection)
if(config.card_id_selection > 4):
config.card_id_selection = 0
if(config.card_id_selection < 0):
config.card_id_selection = 4
card_ui_as_string = "{}\n{}\nHealth:{} Defense:{} Attack:{} Energy:{}\n".format(
imageloader.images("shop_ui_logo"),
config.main_deck.get_card().NAME,
str(config.main_deck.get_card().HP),
str(config.main_deck.get_card().DEF),
str(config.main_deck.get_card().ATT),
str(config.main_deck.get_card().ENG)
)
# Print Graphics Line-By-Line to Prevent Out-Of-Bounds Errors
imageloader.print_string_to_screen(stdscr, card_ui_as_string)
imageloader.print_string_to_screen(stdscr,'''PRESS I TO EXIT''')
imageloader.print_string_to_screen(stdscr,"\nYour remaining points to spend is " + str(config.shop_points))
imageloader.print_string_to_screen(stdscr,'''
PICK 'H' to upgrade Health or
PICK 'J' to upgrade DEFENSE or
PICK 'K' to upgrade ATTACK or
PICK 'L' to upgrade ENERGY''')
imageloader.print_image_to_screen(stdscr, "card_ui_lowermenu_selection_" + str(config.card_id_selection))
stdscr.refresh()