/
town.py
253 lines (249 loc) · 11.2 KB
/
town.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
import classes as cl
import save
import time as t
import colors as c
import field as f
import load
import tower
author='jajaio'
def inn():
print(c.clear)
innq=input(c.yellow+"Welcome to the inn. Would you like to rest here? Or leave? (1), (2)"+c.reset+">>>"+c.violet).strip()
if innq=="1":
print(c.yellow+"You shut your eyes and rest for a bit.")
t.sleep(.5)
cl.show_player()
print("[Game saved!]")
save.save_game()
qu=input('[Would you like to keep playing?] (Y/N)'+c.reset+' >>>'+c.violet).strip().lower()
if qu=='y':
print(c.yellow+'[Resuming game]')
elif qu=='n':
print(c.yellow+'[Exiting game...]')
exit()
else:
print(c.yellow+'[Resuming game]')
print(c.yellow+"You wake up feeling rested...")
t.sleep(1.5)
hub()
elif innq=="2":
print(c.yellow+"You return to the town.")
t.sleep(1)
hub()
else:
print(c.yellow+"I don't understand...")
t.sleep(1)
inn()
def hub():
save.save_game()
print(c.clear)
print(c.yellow+"Welcome to the Pines!")
hubquestion=input("Would you like to go to the field, shop, inn, or the old tower? (1), (2), (3), (4)"+c.reset+" >>>"+c.violet)
if hubquestion=="1":
print(c.yellow+"You decide to go to the field.")
t.sleep(1.3)
f.field()
elif hubquestion=="2":
print(c.yellow+"You decide to go to the shop.")
t.sleep(1.3)
shop()
elif hubquestion=="3":
print(c.yellow+"You decide to go to the inn.")
t.sleep(1.3)
inn()
elif hubquestion=="4":
print(c.yellow+"You take a lantern and travel to the old tower.")
t.sleep(1.25)
tower.tower()
else:
print("I don't understand...")
t.sleep(1)
hub()
def shop():
print(c.clear)
while True:
question=input(c.yellow+"Welcome to the shop! Would you like to see our professions, masteries, or would you like to leave? (1), (2), (3)"+c.reset+" >>>"+c.violet).strip()
if question=="1":
question_one=input(c.yellow+"Okay, would you like to see the the Rogue, Cleric, or Sellsword? (1),(2),(3)"+c.reset+" >>>"+c.violet).strip()
if question_one=="1":
cl.show_rogue()
buyr=input(c.yellow+"You currently have "+str(cl.Player.gold)+" gold. Would you like to purchase the Rogue class for 100 gold? (Y/N)"+c.reset+" >>>"+c.violet).strip().lower()
if buyr=="y":
if int(cl.Player.gold) >= 100:
cl.Player.hp=cl.Rogue.hp
cl.Player.att=cl.Rogue.att
cl.Player.agi=cl.Rogue.agi
cl.Player.deff=cl.Rogue.deff
cl.Player.mp=cl.Rogue.mp
cl.Player.gold-=100
print(c.yellow+"You are now a Rogue!")
t.sleep(1)
cl.show_player()
print()
save.save_game()
input("[Game saved! Press enter to continue.]")
hub()
if int(cl.Player.gold) < 100:
print(c.yellow+"You need more money! You currently have "+str(cl.Player.gold)+" and you need 100!")
input("[Press enter to continue.]")
hub()
elif buyr=="n":
print(c.yellow+"Oh, okay.")
t.sleep(1)
shop()
elif question_one=="2":
cl.show_cleric()
buyd=input(c.yellow+"You currently have "+str(cl.Player.gold)+" gold. Would you like to purchase the Cleric class for 100 gold? (Y/N)"+c.reset+" >>>"+c.violet).strip().lower()
if buyd=="y":
if int(cl.Player.gold) >= 100:
cl.Player.hp=cl.Cleric.hp
cl.Player.att=cl.Cleric.att
cl.Player.agi=cl.Cleric.agi
cl.Player.deff=cl.Cleric.deff
cl.Player.mp=cl.Cleric.mp
cl.Player.gold-=100
print(c.yellow+"You are now a Cleric!")
t.sleep(1)
cl.show_player()
print()
save.save_game()
input("[Press enter to continue.]")
hub()
elif int(cl.Player.gold) <= 100:
print(c.yellow+"You need more money! You currently have "+str(cl.Player.gold)+" and you need 100!")
hub()
elif buyd=="n":
print(c.yellow+"Oh, okay.")
t.sleep(1)
shop()
elif question_one=="3":
cl.show_sellsword()
buyf=input(c.yellow+"You currently have "+str(cl.Player.gold)+" gold. Would you like to purchase the Sellsword class for 100 gold? (Y/N)"+c.reset+" >>>"+c.violet).strip().lower()
if buyf=="y":
if int(cl.Player.gold) >= 100:
cl.Player.hp=cl.Sellsword.hp
cl.Player.att=cl.Sellsword.att
cl.Player.agi=cl.Sellsword.agi
cl.Player.deff=cl.Sellsword.deff
cl.Player.mp=cl.Sellsword.mp
cl.Player.gold-=100
print(c.yellow+"You are now a Sellsword!")
t.sleep(1)
cl.show_player()
print()
save.save_game()
input("[Game saved! Press enter to continue.]")
hub()
elif int(cl.Player.gold) <= 100:
print(c.yellow+"You need more money! You currently have "+str(cl.Player.gold)+" and you need 100!")
input("[Press enter to continue]")
hub()
elif buyf=="n":
print(c.yellow+"Oh, okay.")
t.sleep(1)
shop()
else:
print(c.yellow+"I'm not sure if I understand...")
t.sleep(1.25)
shop()
elif question=="2":
question_q=input(c.yellow+"Our masteries are the Assassin, Wizard, Paladin. What would you like to see? (1), (2), (3)"+c.reset+" >>>"+c.violet).strip()
if question_q=="1":
cl.show_assassin()
buyg=input(c.yellow+"You currently have "+str(cl.Player.gold)+" gold. Would you like to purchase the Assassin class for 200 gold? (Y/N)"+c.reset+" >>>"+c.violet).strip().lower()
if buyg=='y':
if int(cl.Player.gold) >= 200:
cl.Player.hp=cl.Assassin.hp
cl.Player.att=cl.Assassin.att
cl.Player.agi=cl.Assassin.agi
cl.Player.deff=cl.Assassin.deff
cl.Player.mp=cl.Assassin.mp
cl.Player.gold-=200
print(c.yellow+"You are now an Assassin!")
t.sleep(1)
cl.show_player()
print()
save.save_game()
input("[Game saved! Press enter to continue.]")
hub()
elif int(cl.Player.gold) <= 200:
print(c.yellow+"You need more money! You currently have "+str(cl.Player.gold)+" and you need 200!")
input("[Press enter to continue.]")
hub()
elif buyg=='n':
print(c.yellow+"Oh, okay.")
t.sleep(1)
shop()
else:
print("I'm not sure if I understand...")
t.sleep(1.25)
shop()
elif question_q=="2":
cl.show_wizard()
buyh=input(c.yellow+"You currently have "+str(cl.Player.gold)+" gold. Would you like to purchase the Wizard class for 200 gold? (Y/N)"+c.reset+" >>>"+c.violet).strip().lower()
if buyh=="y":
if int(cl.Player.gold) >= 200:
cl.Player.hp=cl.Wizard.hp
cl.Player.att=cl.Wizard.att
cl.Player.agi=cl.Wizard.agi
cl.Player.deff=cl.Wizard.deff
cl.Player.mp=cl.Wizard.mp
cl.Player.gold-=200
print(c.yellow+"You are now a Wizard!")
t.sleep(1)
cl.show_player()
print()
save.save_game()
input("[Game saved! Press enter to continue.]")
hub()
elif int(cl.Player.gold) <= 200:
print(c.yellow+"You need more money! You currently have "+str(cl.Player.gold)+" and you need 200!")
input("[Press enter to continue.]")
hub()
elif buyh=="n":
print("Oh, Okay.")
t.sleep(1)
shop()
else:
print("I'm not sure if I understand...")
t.sleep(1.25)
elif question_q=="3":
cl.show_paladin()
buyj=input(c.yellow+"You currently have "+str(cl.Player.gold)+" gold. Would you like to purchase the Paladin class for 200 gold? (Y/N)"+c.reset+" >>>"+c.violet).strip().lower()
if buyj=="y":
if int(cl.Player.gold) >= 200:
cl.Player.hphp=cl.Paladin.hp
cl.Player.att=cl.Paladin.att
cl.Player.agi=cl.Paladin.agi
cl.Player.deff=cl.Paladin.deff
cl.Player.mp=cl.Paladin.mp
cl.Player.gold -= 200
print("You are now a Paladin!")
t.sleep(1)
cl.show_player()
print()
save.save_game()
input('[Game saved! Press enter to continue.]')
hub()
elif int(cl.Player.gold) <= 200:
print(c.yellow+"You need more money! You currently have "+str(cl.Player.gold)+" and you need 200!")
input('[Press enter to continue.]')
hub()
elif buyj=="n":
print("Oh, Okay.")
t.sleep(1)
shop()
else:
print(c.yellow+"I'm not sure if I understand...")
t.sleep(1.25)
shop()
elif question=="3":
print(c.yellow+"You decide to go back to the town.")
t.sleep(1.25)
hub()
else:
print(c.yellow+"I'm not sure if I understand...")
t.sleep(1.25)
shop()
if __name__=='__main__':
hub()