-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmy_own_adventure.py
314 lines (277 loc) · 10.5 KB
/
my_own_adventure.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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# This is my adventure. Select the options and enjoy
from npcs import Npcs # The module NPC contains the npc of this game
import random
import elections
# Weather and envioronment
ENVIROMENT = ("windy", "sunny", "rainy", "cloudy")
random_weather = random.choice(ENVIROMENT)
# Make you player
your_name = input("What is your adventorous name? ")
# List of habilities
elements_control = []
# List of my stuff(inventory)
pets = []
elements = []
weapons = []
spells = {}
skills = {}
health = 4
# Enemies
ENEMIES = ["goblin", "big bat", "big mouse"]
print(
"Hi Adventorous",
your_name,
"and welcome to this history, your mision is to end your day alive",
)
answer_of_the_element = input(
"You have to select one of this two element controls: fire or water. What element do you want to control? (fire/water) "
).lower()
# Here you select your element
while True:
if answer_of_the_element == "fire":
elements.append("fire")
elements_control.append("fire")
spells[
"fire ball"
] = 600 # This is a spell for the magic book, the number is the power
skills["fire cut"] = 500
print("You select fire control.")
break
elif answer_of_the_element == "water":
elements.append("water")
elements_control.append("water")
spells[
"water ball"
] = 500 # This is a spell for the magic book, the number is the power
skills["water movement"] = 600
print("You select water control.")
break
else:
print("You have to select fire or water. This option is wrong. You lose")
quit()
# Here you select your weapon
# The class NPC contains the npcs of this game
dialogue = Npcs()
print(dialogue.npc_lopez())
while True:
answer_of_the_weapon = input(
"Each new warrior needs to select one of these weapons, magic sword or spell book. Select one \nwrite sword or book "
).lower()
if answer_of_the_weapon == "book":
weapons.append("spell book")
print("You select a spell book.")
print()
break
elif answer_of_the_weapon == "sword":
weapons.append("magic sword")
print("You select a magic sword.")
print()
break
else:
print("You have to select book or sword. This option is wrong. You lose")
quit()
print(
"Your profile is done.\nYour element is:",
elements_control[0],
"\nYour weapon is:",
weapons[0],
)
print()
# Here start the history
print("Today the weather is", random_weather)
print(
"Welcome new adventurer this is your first day in this world.\nGo to the tavern and select your task"
)
print()
dialogue.npc_bartender(1) # Number of the dialogue that you want to output
election_forest_cave = input(
"Where do you want to go? To the Forest or The Cave\nWrite forest or cave "
).lower()
# Forest
if election_forest_cave == "forest":
while health >= 0:
print(
"You enter in the forest and you find a old men. Do you want to talk with him or you want to continue on your way"
)
election = input("Write talk or continue ").lower()
print()
random_enemy = random.choice(ENEMIES)
if election == "continue":
print(
"You continue and then you get lose and you are hurt by a",
random_enemy,
)
health -= 1
print("You come back and you decide to talk with the old men")
print()
print(dialogue.npc_old_men())
your_choice = input(
"Do you want to go to the ruins or you want to continue\nWrite go or continue "
).lower()
print()
if your_choice == "continue":
print(
"You continue and then you get lose and you are hurt by a",
random_enemy,
)
health -= 1
print("You are so dumb. Please go to the ruins")
print()
your_choice = input(
"Do you want to go to the rouins do you want to continue\nWrite go or continue "
).lower()
if your_choice == "continue":
print("You die for a", random_enemy)
health -= 3
elif your_choice == "go":
election = input(
"You enter and there are two ways, which are left and right.\nWhere do you want to go? (write left or right) "
).lower()
if election == "right":
elections.choice_right_for_the_forest(
weapons, answer_of_the_weapon, skills, spells
)
break
elif election == "left":
elections.choice_left_for_the_forest(
weapons, answer_of_the_weapon, skills, spells, pets
)
break
else:
print(
"You wrote the wrong choice or your choice is not in the options... You DIE! Dumd!"
)
health -= 4
elif your_choice == "go":
election = input(
"You enter and there are two ways, which left and right.\nWhere do you want to go? (write left or right) "
).lower()
if election == "right":
elections.choice_right_for_the_forest(
weapons, answer_of_the_weapon, skills, spells
)
break
elif election == "left":
elections.choice_left_for_the_forest(
weapons, answer_of_the_weapon, skills, spells, pets
)
break
else:
print(
"You wrote the wrong choice or your choice is not in the options... You DIE! Dumd!"
)
health -= 5
elif election == "talk":
print(dialogue.npc_old_men())
your_choice = input(
"Do you want to go to the ruins or you want to continue\nWrite go or continue "
).lower()
print()
if your_choice == "continue":
print(
"You continue and then you get lose, and then, you are hurt by a",
random_enemy,
)
health -= 1
print("You are so dumb, Please go to the ruins")
print()
your_choice = input(
"Do you want to go to the rouins or you want to continue\nWrite go or continue "
).lower()
if your_choice == "continue":
print("You die for a", random_enemy)
health -= 2
elif your_choice == "go":
election = input(
"You enter and there are two ways, which are left and right.\nWhere do you want to go? (write left or right) "
).lower()
if election == "right":
elections.choice_right_for_the_forest(
weapons, answer_of_the_weapon, skills, spells
)
break
elif election == "left":
elections.choice_left_for_the_forest(
weapons, answer_of_the_weapon, skills, spells, pets
)
break
else:
print(
"You wrote the wrong choice or your choice is not in the options... You DIE! Dumd!"
)
health -= 4
break
else:
health -= 4
# Cave
elif election_forest_cave == "cave":
print("You go into the cave and a witch appears, and she says:")
dialogue.witch_npc(your_name, 1)
while True:
election = input(
"You enter to the cave and find two ways, which are left and right.\nWhere do you want to go? (write left or right) "
).lower()
if election == "right":
elections.choice_right_for_the_cave(
weapons, answer_of_the_weapon, skills, elements, spells, pets
)
break
elif election == "left":
elections.choice_left_for_the_cave(
weapons, answer_of_the_weapon, skills, spells
)
break
else:
print(
"You wrote the wrong choice or your choice is not in the options... You DIE! Dumd!"
)
break
else:
print("This option is not valid")
if health <= 0:
print("You lost")
empty_list = []
# Here is your inventory in the end that his output will be in other file
def inventory_file():
"Make a ner file .txt with your inventory in the end of the history"
with open("YourInventory.txt", "a") as file:
if answer_of_the_weapon == "sword":
if pets == empty_list:
pets.append("You don't find any pet")
file.write(
"""\n******************************************\n/Your end the history with this inventory/\n******************************************
\n"""
+ "\nYour skill is: "
+ str(skills)
+ "\nYour pet is: "
+ str(pets)
+ "\nYour inventory is "
+ str(weapons)
+ "\nYour health is: "
+ str(health)
+ "\nYou control this element:"
+ str(elements)
+ "\n"
)
elif answer_of_the_weapon == "book":
if "Baby dog" not in pets:
pets.append("You don't find any pet")
file.write(
"""\n******************************************\n/Your end the history with this inventory/\n******************************************
\n"""
+ "\nYour spell is: "
+ str(spells)
+ "\nYour pet is: "
+ str(pets)
+ "\nYour inventory is "
+ str(weapons)
+ "\nYour health is: "
+ str(health)
+ "\nnYou control this element:"
+ str(elements)
+ "\n"
)
else:
file.write("Error ")
inventory_file()
print("The end")