-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmenu_upgradesAndCustomizations.py
282 lines (223 loc) · 10.4 KB
/
menu_upgradesAndCustomizations.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
from globals import *
#This document contains screens for:
# upgradeStronghold
# upgradeFiefMenu
# upgradeAttack
# upgradeFarm
# upgradeDefense
# changeStrongholdColor
# setStrongholdMessage
def UpgradesAndCustomizations(screen, userStronghold):
global currentPage
#This is the screen for upgrading and customizing your stronghold
#----------------------------------------------------------------------------------
if screen == "upgradeStronghold":
os.system("clear")
header(userStronghold.name)
print('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n')
print(" Avalible Commands:")
print(' -------------------------------------------------------')
print(' {1}: Return to Stronghold')
print(' {2}: Upgrade Attack')
print(' {3}: Change Stronghold Color')
print(' {4}: Set Stronghold Message')
print(' --------------------------------------------------------')
print('')
command = input(" Enter your command: ")
if command == '1':
screen = 'stronghold'
if command == '2':
screen = 'upgradeAttack'
if command == '3':
screen = 'changeStrongholdColor'
if command == '4':
screen = 'setStrongholdMessage'
#This is a menu for additional features
#----------------------------------------------------------------------------------
if screen == "upgradeFiefMenu":
os.system("clear")
header(userStronghold.name)
print('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n')
print(" Avalible Commands:")
print(' -------------------------------------------------------')
print(' {1}: Go Back')
print(' {2}: Upgrade Defenses')
# print(' {3}: Upgrade Farms')
# print(' {4}: Upgrade Training')
print(' --------------------------------------------------------')
print('')
command = input(" Enter your command: ")
if command == '1':
screen = 'ownedFiefDetails'
if command == '2':
screen = 'upgradeDefense'
# if command == '3':
# screen = 'upgradeFarm'
# if command == '4':
# screen = 'upgradeFiefMenu'
#This is the screen for updating a user's attack power.
#----------------------------------------------------------------------------------
if screen == "upgradeAttack":
os.system("clear")
header(userStronghold.name)
attTypeNext = 'undefined'
attUpgradeCost = 0
if userStronghold.attLevel == str('0'):
attTypeNext = NAME_ATTACK_T1
attUpgradeCost = UPGRADE_ATTACK_T1
if userStronghold.attLevel == str('1'):
attTypeNext = NAME_ATTACK_T2
attUpgradeCost = UPGRADE_ATTACK_T2
if userStronghold.attLevel == str('2'):
attTypeNext = NAME_ATTACK_T3
attUpgradeCost = UPGRADE_ATTACK_T3
if userStronghold.attLevel == str('3'):
attTypeNext = NAME_ATTACK_T4
attUpgradeCost = UPGRADE_ATTACK_T4
if userStronghold.attLevel == str('4'):
attTypeNext = NAME_ATTACK_T5
attUpgradeCost = UPGRADE_ATTACK_T5
if userStronghold.attLevel == str('5'):
attTypeNext = NAME_ATTACK_T6
attUpgradeCost = UPGRADE_ATTACK_T6
if userStronghold.attLevel == str('6'):
attTypeNext = NAME_ATTACK_T7
attUpgradeCost = UPGRADE_ATTACK_T7
if userStronghold.attLevel == str('7'):
print('\n\n')
print(' Your current army is made of ' + userStronghold.attType)
print(' This is currently the highest attack level!')
print('\n\n\n\n\n\n\n\n\n\n')
command = input(" Press Enter to Continue")
else:
print('\n\n')
print(' Your current army is made of ' + userStronghold.attType)
print(' Would you like to upgrade to ' + attTypeNext + ' for ' + GetResourceCost(attUpgradeCost, 1) + '?')
upgradeInput = input('\n\n Confirm Upgrade (y/n?): ')
if upgradeInput == 'y' and HaveEnoughResources(userStronghold, attUpgradeCost, 1):
print(" Upgrade Complete!")
userStronghold.attType = attTypeNext
userStronghold.attLevel = str(int(userStronghold.attLevel) + 1)
DeductResources(userStronghold, attUpgradeCost, 1)
userStronghold.write()
userStronghold.read()
elif upgradeInput == 'y' and HaveEnoughResources(userStronghold, attUpgradeCost, 1) == False:
print('\n')
print(" You need more resources first!\n\n\n\n")
elif upgradeInput == 'n':
print('\n')
print(" No changes made.")
print('\n\n\n\n\n\n\n\n\n\n')
command = input(" Press Enter to Continue")
screen = "stronghold"
#This is the screen for updating a fief's defenses. Note: there are two screens
#like this. One for fiefs and one for player strongholds.
#----------------------------------------------------------------------------------
if screen == "upgradeDefense":
os.system("clear")
headerFief(attackFief)
defTypeNext = 'undefined'
defUpgradeCost = 0
if attackFief.defLevel == str('0'):
defTypeNext = NAME_DEFENSE_T1
defUpgradeCost = UPGRADE_DEFENSE_T1
if attackFief.defLevel == str('1'):
defTypeNext = NAME_DEFENSE_T2
defUpgradeCost = UPGRADE_DEFENSE_T2
if attackFief.defLevel == str('2'):
defTypeNext = NAME_DEFENSE_T3
defUpgradeCost = UPGRADE_DEFENSE_T3
if attackFief.defLevel == str('3'):
defTypeNext = NAME_DEFENSE_T4
defUpgradeCost = UPGRADE_DEFENSE_T4
if attackFief.defLevel == str('4'):
defTypeNext = NAME_DEFENSE_T5
defUpgradeCost = UPGRADE_DEFENSE_T5
if attackFief.defLevel == str('5'):
defTypeNext = NAME_DEFENSE_T6
defUpgradeCost = UPGRADE_DEFENSE_T6
if attackFief.defLevel == str('6'):
print(' Your current defense style is: ' + attackFief.defType)
print(' This is currently the best defense style!')
print('\n\n\n\n\n\n\n\n\n\n')
command = input(" Press Enter to Continue")
else:
print(' Your current defense style is: ' + attackFief.defType)
print(' Would you like to upgrade to ' + defTypeNext + ' for ' + GetResourceCost(defUpgradeCost, 1) + '?')
upgradeInput = input(' (y/n): ')
if upgradeInput == 'y' and HaveEnoughResources(attackFief, defUpgradeCost, 1):
print(" Upgrade Complete!")
attackFief.defType = defTypeNext
attackFief.defLevel = str(int(attackFief.defLevel) + 1)
DeductResources(attackFief, defUpgradeCost, 1)
attackFief.write()
attackFief.read()
userStronghold.write()
userStronghold.read()
elif upgradeInput == 'y' and HaveEnoughResources(attackFief, defUpgradeCost, 1) == False:
print(" You need more resources first!")
elif upgradeInput == 'n':
print(" No changes made.")
print('\n\n\n\n\n\n\n\n\n\n')
command = input(" Press Enter to Continue")
currentPage = 1
screen = "ownedFiefDetails"
#This page prints a menu for choosing your stronghold's color:
if screen == "changeStrongholdColor":
os.system("clear")
header(userStronghold.name)
print('\n\n\n\n\n')
print(" Choose a Stronghold Color:")
print(' -------------------------------------')
print(''' {1}: Red '''+textColor.RED+'''#'''+textColor.RESET+''' ''')
print(''' {2}: Green '''+textColor.GREEN+'''#'''+textColor.RESET+''' ''')
print(''' {3}: Blue '''+textColor.BLUE+'''#'''+textColor.RESET+''' ''')
print(''' {4}: Yellow '''+textColor.YELLOW+'''#'''+textColor.RESET+''' ''')
print(''' {5}: Magenta '''+textColor.MAGENTA+'''#'''+textColor.RESET+''' ''')
print(''' {6}: Cyan '''+textColor.CYAN+'''#'''+textColor.RESET+''' ''')
print(''' {7}: White '''+textColor.BOLD+'''#'''+textColor.RESET+''' ''')
print(''' {8}: Gray '''+textColor.DARK_GRAY+'''#'''+textColor.RESET+''' ''')
print(' {9}: Leave color as is')
print(' -------------------------------------')
print('')
command = input(" Enter your command: ")
if command == "1":
userStronghold.color = 'red'
if command == "2":
userStronghold.color = 'green'
if command == "3":
userStronghold.color = 'blue'
if command == "4":
userStronghold.color = 'yellow'
if command == "5":
userStronghold.color = 'magenta'
if command == "6":
userStronghold.color = 'cyan'
if command == "7":
userStronghold.color = 'white'
if command == "8":
userStronghold.color = 'gray'
userStronghold.write()
screen = "stronghold"
#This is the screen for setting your stronghold message
#----------------------------------------------------------------------------------
if screen == "setStrongholdMessage":
os.system("clear")
header(userStronghold.name)
print('\n\n')
strongHoldMessage = ' Your current message is: ' + userStronghold.strongholdMessage
print(strongHoldMessage.center(110, ' '), end = ' ')
print('\n\n\n')
art_signpost()
print('\n\n\n')
#get input for the stronghold message and only write it if less than 80 characters
userStronghold.strongholdMessage = input(' Enter your new message: ')
if len(userStronghold.strongholdMessage) > 80:
print('\n Error! Only 80 characters allowed!')
if len(userStronghold.strongholdMessage) <= 80:
print('\n Message Accepted')
userStronghold.write()
print('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n')
tempInput = input(' Press Enter to Continue')
screen = 'stronghold'
return screen