forked from webbshasta/pfb2019_VisuallyImpaired
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandom_encouters.py
executable file
·201 lines (194 loc) · 8.11 KB
/
Random_encouters.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
#!/usr/bin/env python3
import user
import random
import time
import sys
from print_quiz import re_input_easy, re_input_med, re_input_hard
import print_ascii
import os
import subprocess
def random_en1(user):
os.system("clear")
#find sketch food, do you eat it?
#if you choose to eat the apple, there's a 50% chance it will injure you and a 50% chance it will heal you
#print apple art
print_ascii.apple_pic()
time.sleep(1.5)
print("You found an apple, just sitting there on the ground. It looks very appetizing, but it's kind of strange that someone left it here. What do you do?")
time.sleep(1.5)
print("A) Eat the apple or B) Don't eat the apple")
en1_ans = input('>>> ')
while en1_ans not in ['a','b']:
print("There's only two choices, it's not that hard. Don't hurt yourself, try again.")
en1_ans = input('>>> ')
if en1_ans.lower() == 'a':
randomnum = random.randint(1,3)
if randomnum == 1:
print("Nasty! Why would you eat something you found on the ground? You lose 10 health")
user.injure(10)
time.sleep(1)
user.print_health_bar()
time.sleep(2)
input("Press enter to continue")
else:
print("Yum, a crisp and juicy apple. You gain 10 health.")
user.heal(10)
time.sleep(1)
user.print_health_bar()
time.sleep(2)
input("Press enter to continue")
else:
print("You leave the apple alone and walk away")
time.sleep(2)
input("Press enter to continue")
def random_en2(user):
os.system("clear")
time.sleep(2)
#useless item encouter
print_ascii.mysteryman_pic()
time.sleep(2)
print("A mysterious man approaches you.")
time.sleep(2)
#print man image
print("He hands you an ordinary-looking dirty pinecone.")
time.sleep(2)
print_ascii.pinecone_pic()
time.sleep(1.5)
#print pinecone image
print("'It's dangerous to go alone! Take this!'")
time.sleep(2)
print(".......")
time.sleep(2)
print("Okay...It's probably a good idea not to argue with him. You put the pinecone in your inventory and walk away.")
user.add_item('Useless Pinecone')
input("Press enter to continue ")
def random_en3(user):
os.system("clear")
print_ascii.sphinx_pic()
time.sleep(2)
print("You encounter Shasta the Sphinx. She says she has a quiz for you!")
#text color change
time.sleep(1.5)
print("\033[32mAnswer my questions and I will give you a prize!\033[37m")
subprocess.run(["say","-v","Samantha","Answer my questions and I will give you a prize!"])
time.sleep(2)
if user.intel >= 65:
print("\033[32mYou're a smart cookie, this one will be easy!\033[37m")
subprocess.run(["say","-v","Samantha","You're a smart cookie, this one will be easy!"])
re_e = re_input_easy('')
#easy regular expression quiz
while re_e.lower() not in ['a','b','c','d']:
print("\033[32mThat makes no sense. What did you say?\033[37m")
subprocess.run(["say","-v","Samantha","That makes no sense. What did you say?"])
re_e = re_input_easy('')
if re_e.lower() == 'b':
print("\033[32mCongrats! You chose the correct answer. All that studying is paying off.\033[37m")
subprocess.run(["say","-v","Samantha","Congrats! You chose the correct answer. All that studying is paying off"])
time.sleep(2)
print("Shasta hands you a healing potion. Sweet!")
time.sleep(2)
print_ascii.healthpotion_pic()
time.sleep(2)
user.add_item('Healing Potion')
input("Press enter to continue")
else:
print("\033[32mYikes...that's not right. Were you asleep during that module?\033[37m")
subprocess.run(["say","-v","Samantha","Yikes...that's not right. Were you asleep during that module?"])
time.sleep(2)
print("You walk away empty-handed")
time.sleep(2)
input("Press enter to continue")
elif user.intel >= 50:
#medium regex quiz
print("\033[32mYour intelligence is okay, but you'll have to think a little on this one...\033[37m")
re_m = re_input_med('')
while re_m.lower() not in ['a','b','c','d']:
print("\033[32mThat makes no sense. What did you say?\033[37m")
subprocess.run(["say","-v","Samantha","That makes no sense. What did you say?"])
re_m = re_input_med('')
if re_m.lower() == 'b':
print("\033[32mCongrats! You chose the correct answer. All that studying is paying off.\033[37m")
subprocess.run(["say","-v","Samantha","Congrats! You chose the correct answer. All that studying is paying off"])
time.sleep(2)
print("Shasta hands you a healing potion. Sweet!")
time.sleep(2)
print_ascii.healthpotion_pic()
time.sleep(2)
user.add_item('Healing Potion')
input("Press enter to continue")
else:
print("\033[32mYikes...that's not right. Were you asleep during that module?\033[37m")
subprocess.run(["say","-v","Samantha","Yikes...that's not right. Were you asleep during that module?"])
time.sleep(2)
print("You walk away empty-handed")
time.sleep(2)
input("Press enter to continue")
else:
#hard regex quiz
print("\033[32mWhew, you're not exactly the sharpest crayon in the box, are you? This is going to be a tough one.\037[33m")
subprocess.run(["say","-v","Samantha","Whew, you're not exactly the sharpest crayon in the box, are you? This is going to be a tough one"])
re_h = re_input_hard('')
while re_h.lower() not in ['a','b','c','d']:
print("\033[32mThat makes no sense. What did you say?\033[37m")
subprocess.run(["say","-v","Samantha","That makes no sense. What did you say?"])
re_h = re_input_hard('')
if re_h.lower() == 'b':
print("\033[32mCongrats! You chose the correct answer. All that studying is paying off.\033[37m")
subprocess.run(["say","-v","Samantha","Congrats! You chose the correct answer. All that studying is paying off"])
time.sleep(2)
print("Shasta hands you a healing potion. Sweet!")
time.sleep(2)
print_ascii.healthpotion_pic()
time.sleep(2)
user.add_item('Healing Potion')
input("Press enter to continue")
else:
print("\033[32mYikes...that's not right. Were you asleep during that module?\033[37m")
subprocess.run(["say","-v","Samantha","Yikes...that's not right. Were you asleep during that module?"])
time.sleep(2)
print("You walk away empty-handed")
time.sleep(2)
input("Press enter to continue")
#make mini-encounter before swan fight, yields "Bread"
def random_en4(user):
os.system("clear")
time.sleep(1)
print("Joe walks by and offers you some bread from the cafeteria. It looks like normal bread, but why is he giggling? Do you take the bread? \n\n")
time.sleep(3)
print_ascii.bread_pic()
time.sleep(1)
print("A) Take the bread or B) Just walk away")
en4_ans = input(">>> ")
while en4_ans.lower() not in ['a','b']:
print("You have two options, A or B, it's not that hard. Try again.")
print("Joe walks by and offers you some bread from the cafeteria. It looks like normal bread, but why is he giggling? Do you take the bread?")
print("A) Take the bread or B) Just walk away")
en4_ans = input(">>> ")
if en4_ans.lower() == 'a':
user.add_item("Bread")
time.sleep(1)
print("It seems like totally normal bread. This could be a nice snack in a little while...")
time.sleep(1.5)
print("Do you: A) eat the bread now or B) save it for later?")
bread_eat = input(">>> ")
while bread_eat.lower() not in ['a','b']:
print("You only have two choices, it's not that hard. Try again.")
print("It seems like totally normal bread. This could be a nice snack in a little while...")
print("Do you: A) eat the bread now or B) save it for later?")
bread_eat = input(">>> ")
if bread_eat.lower() == 'a':
user.heal(10)
time.sleep(1)
print("Yummy! The bread has restored 10 of your health points.")
time.sleep(1)
user.print_health_bar()
time.sleep(2)
input("Press enter to continue")
else:
print("You keep the bread in your pocket for later, just in case.")
time.sleep(2)
input("Press enter to continue")
else:
print("Mom said never to take candy from strangers. You walk away from Joe.")
time.sleep(2)
input("Press enter to continue")