-
Notifications
You must be signed in to change notification settings - Fork 0
/
story.py
394 lines (349 loc) · 16 KB
/
story.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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
import time
import ddisplay
from classes import workclass
from simulation import run_sim as run_sim
def instructions():
"""
Displays the employee "manual", which is actually tips for playing.
"""
ddisplay.print_from_file("resources/story/instructions.txt")
def intro():
"""
The story introduction. Introduces Dave, has first story choice.
Choices: 1
Simulations: 0
TODO: Have choice of asking about wife or not indicate interest or lack
thereof in Dave's personal life. Eventually to impact ability to
prevent Dave's suicide and its impact on the story.
TODO: Make coffee intake a relevant stat somehow.
"""
ddisplay.print_from_file("resources/story/intro/credits.txt")
raw_input('\n(Press enter key to continue)')
ddisplay.print_from_file("resources/story/intro/good_morning_dave.txt")
choice = 0
again = ['\nCome on, now. I know you haven\'t had your coffee yet, but surely you',
'can find the 1 and 2 keys on your keyboard.']
while (int(choice) != 1) and (int(choice) != 2):
menu = ['\nWhat do you do?',
'1 - Grunt, wave goodbye, and go to your cubicle.',
'2 - Ask about his wife.']
ddisplay.print_text(menu)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
ddisplay.print_from_file("resources/story/intro/good_morning_dave_r1.txt")
elif int(choice) == 2:
ddisplay.print_from_file("resources/story/intro/good_morning_dave_r2.txt")
else:
ddisplay.print_text(again)
except ValueError:
choice = 0
ddisplay.print_text(again)
def ch01():
intro = ['\nAfter logging in, you consider your options.',
'\nWhat do you do?']
ddisplay.print_text(intro)
nosebook = False
email = False
again = ['\nNo, no, no, that\'s not a valid choice. Try again!']
while True:
menu = ['1 - See what\'s happening on Nosebook.',
'2 - Check your email.',
'3 - Do the work they\'re paying you to be here for.']
ddisplay.print_text(menu)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
if nosebook:
print '\nYeah... still a lot of nosebook-picking going on here.'
else:
ddisplay.print_from_file("resources/story/ch01/ch01_nosebook.txt")
nosebook = True
elif int(choice) == 2:
if email:
print '\nNo new email. Alas.'
else:
print '\nEarlobe enlargement? Wow, they\'ll try anything these days.'
email = True
elif int(choice) == 3:
ddisplay.print_from_file("resources/story/ch01/ch01_work.txt")
while True:
menu = ['\nWhat do you do?',
'1 - Review the manual again to stave off the inevitable. [How to Play]',
'2 - Just do it.']
ddisplay.print_text(menu)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
instructions()
elif int(choice) == 2:
workplacesToBe = []
workplacesToBe.append(workclass.WorkplaceToBe(7, True, workclass.Farm,
"FARM #216", "A216"))
workplacesToBe.append(workclass.WorkplaceToBe(5, True, workclass.Factory,
"FACTORY #139", "C139"))
workplacesToBe.append(workclass.WorkplaceToBe(2, False, workclass.Unassigned,
"UNASSIGNED", "NONE"))
run_sim(workplacesToBe, 2, '#135466')
break
else:
print 'Try again, please. Invalid input.'
except ValueError:
choice = 0
print 'Try again, please. Invalid input.'
break
else:
ddisplay.print_text(again)
except ValueError:
choice = 0
ddisplay.print_text(again)
print '\nWhat do you do next?'
lunch = ['You yawn and stretch. Coffee time is past. It\'s snack time now.',
'\nWhoops!',
'\nApparently you meant lunch time.']
ddisplay.print_text(lunch)
choice = 0
again = ['\nYou... wait, what?! Try that again.']
while (int(choice) != 1) and (int(choice) != 2):
chc1 = ['\nWhere do you want to go?',
'1 - The good old cafeteria. Mediocre free food, decent conversation.',
'2 - Home. Sandwiches and solitude.']
ddisplay.print_text(chc1)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
ddisplay.print_from_file("resources/story/ch01/ch01_cafeteria.txt")
elif int(choice) == 2:
ddisplay.print_from_file("resources/story/ch01/ch01_home.txt")
else:
ddisplay.print_text(again)
except ValueError:
choice = 0
ddisplay.print_text(again)
raw_input('\n(Press enter key to continue)')
def ch02():
"""
Returns True if Dave is still in player's life at end of module or False
otherwise.
"""
ddisplay.print_from_file("resources/story/ch02/ch02_intro.txt")
choice = 0
while (int(choice) != 1) and (int(choice) != 2):
opts = ['\n1 - Yeah... that\'s so out of character I can only assume aliens',
' are involved.',
'2 - Nah. Dave\'s a great guy but it\'s nice not to have to deal',
' with his peppy peppiness sometimes.']
ddisplay.print_text(opts)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
dave = True
ddisplay.print_from_file("resources/story/ch02/ch02_look.txt")
elif int(choice) == 2:
dave = False
print '\nYou sip your coffee obtained in quiet and log in.'
else:
print '\nDrink some of your coffee and try that again.'
except ValueError:
choice = 0
print '\nDrink some of your coffee and try that again.'
intro = ['Confronted with the usual options...',
'\nWhat do you do?']
ddisplay.print_text(intro)
#Goof off or work.
nosebook = False
email = False
while True:
opts = ['1 - See what\'s happening on Nosebook.',
'2 - Check your email.']
if dave:
opts.append('3 - Work. Maybe it\'ll take your mind off things.')
else:
opts.append('3 - Do the work they\'re paying you to be here for.')
ddisplay.print_text(opts)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
if nosebook:
if dave:
noseSeen = ['\nEven scoffing at the nosebook-picking can\'t cheer you up.',
'The term "nosebook-picking" isn\'t even funny right now.']
else:
noseSeen = ['\nMore nosebook-picking. Ah, nosebook-picking.',
'Just the term makes you happy. How do you visualize that?']
ddisplay.print_text(noseSeen)
else:
ddisplay.print_from_file("resources/story/ch02/ch02_nosebook.txt")
if dave:
print('\nThis isn\'t helping.')
else:
print('\nYou should probably work. Probably.')
nosebook = True
elif int(choice) == 2:
if email:
if dave:
print('\nNo new email. Not that you did a good job reading the first two.')
else:
print('\nNo new email. Who\'s surprised?')
else:
newEmail = ['\nSomething from Biggs about a party... don\'t care right now.',
'And... news. Noone cares about that.']
ddisplay.print_text(newEmail)
email = True
elif int(choice) == 3:
#Working.
while True:
opts = ['\nWhat do you do?',
'1 - Review the manual again.']
if dave:
opts.append('2 - Work. Or try to.')
else:
opts.append('2 - Work! It\'s like a crummy party you get paid to attend.')
ddisplay.print_text(opts)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
instructions()
elif int(choice) == 2:
workplacesToBe = []
workplacesToBe.append(workclass.WorkplaceToBe(7, True, workclass.Farm,
"FARM #512", "A512"))
workplacesToBe.append(workclass.WorkplaceToBe(5, True, workclass.Factory,
"FACTORY #110", "C110"))
workplacesToBe.append(workclass.WorkplaceToBe(6, True, workclass.Factory,
"FACTORY #112", "C112"))
workplacesToBe.append(workclass.WorkplaceToBe(4, False, workclass.Unassigned,
"UNASSIGNED", "NONE"))
run_sim(workplacesToBe, 4, '#187949')
break
else:
print 'Try again, please. Invalid input.'
except ValueError:
choice = 0
print 'Try again, please. Invalid input.'
break
else:
if dave:
print('\nI know you\'re distracted, but please use proper input.')
else:
print('Have a sip of carefree coffee and try again.')
except ValueError:
choice = 0
if dave:
print('\nI know you\'re distracted, but please use proper input.')
else:
print('Have a sip of carefree coffee and try again.')
print '\nWhat do you do next?'
if dave:
print('\nLunch time. You still haven\'t heard from Dave. Time to go check on him.')
else:
ddisplay.print_from_file("resources/story/ch02/ch02_worked.txt")
raw_input('\n(Press enter key to continue)')
return dave
def ch03(dave):
if dave:
ddisplay.print_from_file("resources/story/ch03/ch03_dave_intro.txt")
print('\nWhat do you do?')
time.sleep(0.2)
#Goof off or work.
nosebook = False
email = False
while True:
opts = ['1 - Pick your Nosebook.',
'2 - Check your eternally uninteresting email.',
'3 - Slave away.']
ddisplay.print_text(opts)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
if nosebook:
print '\nOh, why bother.'
else:
ddisplay.print_from_file("resources/story/ch03/ch03_nosebook.txt")
nosebook = True
elif int(choice) == 2:
if email:
print '\nNo new email. Again.'
else:
print '\nNothing.'
email = True
elif int(choice) == 3:
#Tries to work.
ddisplay.print_from_file("resources/story/ch03/ch03_work.txt")
raw_input('\n(Press enter key to continue)')
break
else:
print '\nJust put in a correct input so you can get this done and go home.'
except ValueError:
choice = 0
print '\nJust put in a correct input so you can get this done and go home.'
print '\nWhat do you do next?'
else:
ddisplay.print_from_file("resources/story/ch03/ch03_nodave_intro.txt")
choice = 0
while (int(choice) != 1) and (int(choice) != 2):
opts = ['\nWill you eat with Biggs and Wedge today?',
'1 - Yeah.',
'2 - No.']
ddisplay.print_text(opts)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
ddisplay.print_from_file("resources/story/ch03/ch03_yes.txt")
raw_input('\n(Press enter key to continue)')
elif int(choice) == 2:
ddisplay.print_from_file("resources/story/ch03/ch03_no.txt")
raw_input('\n(Press enter key to continue)')
else:
print '\nSimple question. He\'s just asking.'
except ValueError:
choice = 0
print '\nSimple question. He\'s just asking.'
def spanishInquisition():
ddisplay.print_from_file("resources/story/si/si_intro.txt")
choice = 0
while (int(choice) != 1) and (int(choice) != 2):
opts = ['\nWell, do you?',
'1 - I still don\'t understand what I\'m supposed to have done.',
'2 - Would it matter if I did?']
ddisplay.print_text(opts)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
pass
elif int(choice) == 2:
ddisplay.print_from_file("resources/story/si/si_no_change.txt")
else:
print '\n"Have you anything to say in your defense?" he asks again.'
except ValueError:
choice = 0
print '\n"Have you anything to say in your defense?" he asks again.'
ddisplay.print_from_file("resources/story/si/si_verdict.txt")
raw_input('\n(Press enter key to continue)')
ddisplay.print_from_file("resources/story/si/si_ending01.txt")
raw_input('\n(Press enter key to continue)')
ddisplay.print_from_file("resources/story/si/si_ending02.txt")
raw_input('\n(Press enter key to continue)')
ddisplay.print_from_file("resources/story/si/si_ending03.txt")
choice = 0
again = ['\n"What\'s that?" he asks. I can\'t hear you."',
'\nHis subordinate snickers.']
while (int(choice) != 1) and (int(choice) != 2):
opts = ['1 - You\'re kidding, right? You can\'t be serious.',
'2 - Say nothing.']
ddisplay.print_text(opts)
choice = raw_input("Pick one:")
try:
if int(choice) == 1:
ddisplay.print_from_file("resources/story/si/si_speech.txt")
elif int(choice) == 2:
ddisplay.print_from_file("resources/story/si/si_silence.txt")
else:
ddisplay.print_text(again)
except ValueError:
choice = 0
ddisplay.print_text(again)
ddisplay.print_from_file("resources/story/si/si_ending04.txt")
raw_input('\n(Press enter key to continue)')
ddisplay.print_from_file("resources/story/si/si_ending05.txt")
raw_input('\n\nTHE END')