/
main.py
113 lines (104 loc) · 3.98 KB
/
main.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import os
import sys
import random
import blessed
from Player import *
from Monsters import *
from Attack import *
from debug import *
from saveload import *
from inventory_player import *
from shop import *
player = Player()
sv = SaveLoad()
pinv = P_inv()
term = blessed.Terminal()
class mainScreen():
def mainLoop(self):
while True:
os.system('cls')
print("1.Play\n2.Load\n3.Exit")
ip = input(">>")
if(ip== '1'):
player_start = playerStart()
player_start.char_selection()
break
if(ip== '2'):
flag = sv.loadgame()
if flag == 0:
break
else:
print("Wrong Password\n")
if(ip== '3'):
print("Bye!")
sys.exit()
else:
print("Enter Valid Options")
os.system('cls')
print("Type !help for list of commands")
while True:
cmd = input(">>")
os.system('cls')
if(cmd == "!stats"): #stats
player.status()
elif(cmd == "!help"): #Help
os.system('cls')
print("!explore, !stats, !inv !quit !save !location !equipment !use !uprade !shop")
elif(cmd == "!quit"): #Quit
os.system('cls')
qans = input("Quit Game : [Y/N] ?")
if(qans == 'Y' or qans == "y"):
sys.exit()
else:
pass
elif (cmd == "!inv"): #Inventory
os.system('cls')
print("1.List 2.Equip 3.Unequip 4.Back")
while True:
ii = input(f"{term.limegreen}<>{term.normal}")
if ii == '1':
pinv.inv_list()
elif ii == '2':
pinv.equip()
elif ii == '3':
print("1.Weapon 2.Armour 3.Back")
pinv.unequip(input("<<>"))
elif ii == '4':
break
else:
print("Enter Valid Option!")
elif (cmd == "!explore"): #Explore
os.system('cls')
os.system("cls")
atk = Attack()
atk.attackloop()
del atk
elif (cmd == "!save"): #Save
os.system('cls')
sv.savegame(player.name,player.HP,player.MP,player.STR,player.INT,player.DEX,player.DEF,player.LUCK,player.XP,player.GOLD,player.MAX_HP,player.MAX_MP,player.eq_wep,player.eq_arm,)
elif (cmd == "!location"): #Location
os.system('cls')
pass
elif (cmd == "!debug"): #Debug
os.system('cls')
Debug.debug(self)
elif (cmd == '!equipment'): #Equipment
os.system('cls')
player.equipments()
input("Press Enter To go back")
elif (cmd == '!use'): #Equipment
os.system('cls')
pinv.use_potion()
elif (cmd == '!upgrade'): #Equipment
os.system('cls')
pass
elif (cmd == '!shop'): #Equipment
os.system('cls')
shop = Shop()
else:
print("Type !help for more info")
#atk = Attack()
#atk.battle()
if __name__ == "__main__":
game = mainScreen()
game.mainLoop()