/
aventure_game.py
executable file
·1445 lines (1186 loc) · 37.6 KB
/
aventure_game.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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
"""
AVENTUREGAME
"""
import logging #LOG: uncomment all lines containing this comment to enable error logging to a file
logging.basicConfig(level=logging.DEBUG, filename='debug.log') #LOG
########### imports n stuff ###########
import random
import getpass
import config
import hashlib
import cPickle as pickle
import json
########### desktop/programs/python ###########
import words
import helpful
import items_lists
########### logistics ###########
def head_asplode():
raise HeadAsplodeError('YOU HEAD ASPLODE')
def encounter_monster(categories=None):
global monsters_defeated
result = fight(categories)
if result == 'death':
raw_input('You defeated ' +str(monsters_defeated) + ' monsters before dying a grisly death!\n')
return 'death'
else:
return
def fight(who_fight=None):
"""
returns 'win' or 'lose', or 'death'
modifies monsters_defeated
who_fight can be list of categories or a specific monster
"""
global monsters_defeated
if isinstance(who_fight,helpful.Being):
###specific monster
enemy = who_fight
elif isinstance(who_fight,list):
###list of categories
enemy = items_lists.random_monster(who_fight)
else:
###else picks a monster at random, not boss though
enemy = items_lists.random_monster()
if debug:
print '<\n\nfighting:\n' + enemy.advanced_str() +'\n>\n'
encountered = str(enemy)
raw_input(str(player) + ' encounters a ' + encountered + '!\n')
choice = helpful.pick_item(['yes','no','inventory'],'Fight?','inventory')
while choice == 'inventory':
inspect_inventory()
choice = helpful.pick_item(['yes','no','inventory'],'Fight?','inventory')
if choice == 'yes':
while enemy.get_health() > 0 and player.get_health() > 0:
#player attacks
item = helpful.pick_item(player.get_inventory(), 'What to use?')
player.use(item)
attack = item.get_damage()
defend = item.get_health()
if attack > 0:
enemy.hit(item)
raw_input('You dealt ' +str(attack) + ' damage!')
if defend > 0:
raw_input('You gained ' + str(defend) + ' HP!')
if attack == 0 and defend == 0:
raw_input('That was pretty dumb.\n')
if enemy.get_health() > 0: #if the enemy is still alive
###enemy attacks, using random item in enemy's inventory
enemy_choice = random.choice(enemy.get_inventory())
player.hit(enemy_choice)
raw_input(str(enemy).capitalize() + ' used ' + str(enemy_choice) + '!\n')
raw_input('You lost ' + str(enemy_choice.get_damage()) + ' health!\n')
player.set_health(max(0,player.get_health())) #make health nonnegative
enemy.set_health(max(0,enemy.get_health()))
print('Player Health: ' + str(player.get_health()) + '\n')
raw_input(str(enemy) + ' Health: ' + str(enemy.get_health()) + '\n')
if enemy.get_health() == 0:
winner = str(player)
money = enemy.get_money()
print('You looted the following items:\n' + enemy.get_inv_string())
raw_input('and gained ' + str(money) + ' smackaroonies.\n')
player.gain_money(money)
player.grab_items(enemy.get_inventory())
result = 'win'
monsters_defeated += 1
if player.get_health() == 0:
winner = str(enemy)
result = 'death'
print(winner + ' wins!\n')
elif choice == 'no':
ouch = random.randrange(0,2)
if enter_two == config.confus(config.config2):
ouch = 0
global cheated
cheated = True
print '<yolo>'
if ouch:
enemy_choice = random.choice(enemy.get_inventory())
player.hit(enemy_choice)
print 'You got away, but were hit by the ' + \
str(enemy) +"'s " + str(enemy_choice) +'!' + '\n'
raw_input('You sustained ' + str(enemy_choice.get_damage()) +' damage.\n')
if player.get_health() <= 0:
return 'death'
else:
raw_input('You got away safely!\n\nThat was close!\n')
result = 'lose'
return result
def inspect_inventory(sell=False):
"""
can inspect or sell items from inventory
"""
choice = 'poop'
if sell:
while choice != 'done':
choices = list(player.get_inventory())
choices += ['done']
choice = helpful.pick_item(choices,'Sell something?','done')
# if choice == 'done':
if str(choice) == 'mythical kumquat':
raw_input("You can't sell your " + str(choice) + "!\n")
elif choice == 'done':
return
else:
cost = choice.get_cost()
question = 'Sell your ' + str(choice) + ' for $' + str(cost) + '?'
sell_yn = helpful.pick_item(['yes','no'],question)
if sell_yn == 'yes':
cost = choice.get_cost()
player.gain_money(cost)
player.drop(choice)
raw_input('You sold your ' + str(choice) + '. ' + \
"That's $" + str(cost) + ' more in your pocket.\n')
else: #if not selling
print '\n'.join([player.get_name() + ' ' + player.get_title(), \
'='*len(player.get_name() + ' ' + player.get_title()), \
'Health: ' + str(player.get_health())])
while choice != 'done':
choices = list(player.get_inventory())
choices += ['done']
intro = '\nType item name/number for more info...\n\nInventory:'
choice = helpful.pick_item(choices,intro,'done')
if choice == 'done':
return
raw_input(choice.advanced_str())
if choice.get_health() > 0:
use_yn = helpful.pick_item(['yes','no'],'Use this item?')
if use_yn == 'yes':
player.use(choice)
def inspect_map():
if world_map:
print ' +---------+'
print ' ' + map_0
print ' ' + map_1
print ' ' + map_2
print ' +---------+'
raw_input('')
else:
raw_input('You have no world map :(')
return
def pick_place(choices_arg, question='Where to next?',inv=True):
"""
pretty much identical to pick_item. at least, it started that way.
break_before breaks before inventory
"""
original_question = question
choices_alt = []
if isinstance(choices_arg,list):
choices = list(choices_arg)
if inv:
choices += ['inventory','map']
elif isinstance(choices_arg,tuple):
choices = choices_arg[0]
choices_alt = choices_arg[1]
if inv:
choices += ['inventory','map']
choices_alt += ['inventory','map']
staying = True
while staying:
print question + '\n'
if choices_alt:
for index in range(len(choices_alt)): #print alternate choices in menu form
if str(choices[index]) == 'inventory':
print
print(str(index+1) + ': ' + str(choices_alt[index]))
else:
for index in range(len(choices)): #print choices in menu form
if str(choices[index]) == 'inventory':
print
print(str(index+1) + ': ' + str(choices[index]))
print('') #get some blank line in here yo
chosen = raw_input('').lower()
if debug:
if chosen[0:4] == "loc ":
raw_input("<debug jumping...>\n")
return chosen[4:]
elif chosen[0:5] == "fight":
raw_input("<debug fighting...>\n")
encounter_monster()
continue
elif chosen[0:5] == "money":
try:
gained = int(chosen[6:])
except:
gained = 100
player.gain_money(gained)
raw_input("<debug money+" + str(gained) + ">\n")
continue
elif chosen[0:6] == "health":
try:
gained = int(chosen[7:])
except:
gained = 100
player.gain_health(gained)
raw_input("<debug health+" + str(gained) + ">\n")
continue
try:
final = ''
for index in range(len(choices)): #check if they typed a number
item = choices[index]
if index == int(chosen)-1:
final = item
staying = False
if final == '':
print 'Nice Try.\n' #if they type a number not in range
question = 'Try again, foo.'
except:
final = ''
if choices_alt:
for index in range(len(choices_alt)): #check if they typed letters
item = choices_alt[index]
if chosen == str(item).lower():
final = choices[index]
staying = False
else:
for index in range(len(choices)): #check if they typed letters
item = choices[index]
if chosen == str(item).lower():
final = item
staying = False
if final == '':
print 'Nice Try.\n' #if they misspelled
question = 'Try again, foo.'
if final == 'map':
inspect_map()
if question == 'Where to next?':
question = 'Where to?'
else:
question = original_question
staying = True
if final == 'inventory':
inspect_inventory()
if question == 'Where to next?':
question = 'Where to?'
else:
question = original_question
staying = True
return final
########### journeying ###########
def visit(location):
"""
this function (and every function after it in this section)
should return a string name of the next place to visit
dying is no return
"""
if debug:
print "<visiting " + str(location) + ">\n"
func_map = {
'woods':woods_0_0,
'purchase beer':beer,
'purchase weapons':buy,
'sell stuff':sell,
'purchase map':buy_map,
'map':inspect_map
}
global locations_list
global press_enter
global map_0, map_1, map_2
# reset map
map_0 = map_0[:12] + '| |' + map_0[24:]
map_1 = map_1[:12] + '| |' + map_1[24:]
map_2 = map_2[:12] + '| |' + map_2[24:]
locations_list = func_map.keys()
if location not in locations_list:
try:
func = eval(location)
except:
print '<invalid location>\n'
else:
func = func_map[location]
crazy_spot = 0
if location[0:5] == 'woods': #only go into the portal/bongos from the woods
crazy_spot = random.randint(0,15)
if crazy_spot == 1:
func = bongos
if crazy_spot == 2:
func = portal
return func()
### tavern stuff ###
def tavern():
"""
where all the cool kids hang out
+---------+
| |
| T |
| |
+---------+
"""
global tavern_name
global bartender_name
global press_enter, enter_two, enter_four
global map_1
map_1 = map_1[:12] + '| T |' + map_1[24:]
if not tavern_name:
tavern_name = 'The ' + words.tavern_adj().capitalize() + ' ' + \
words.noun().capitalize() + ' Tavern'
bartender_name = items_lists.random_bartender_name()
enter_two = getpass.getpass('You enter ' + tavern_name + '.\n')
raw_input('The bartender, ' + bartender_name + ', grins at you.\n')
raw_input('"Greetings, ' + str(player) + '."')
enter_four = getpass.getpass('"' + "We're out of beer." +'"\n')
if press_enter == config.confus(config.config0):
player.grab(config.config1)
global cheated
cheated = True
else:
raw_input('You enter ' + tavern_name + '.\n')
raw_input('The bartender, ' + bartender_name + ', grins at you.\n')
raw_input('"You again, ' + str(player) + ' ?"')
raw_input('"Yup, ' + "we're still out of beer." + '"\n')
in_tavern = True
while in_tavern:
choices = (
['beer','buy map','buy','sell','mirror','box','woods','improve_weapons'],
['purchase beer','purchase map','purchase weapons','sell stuff','mirror','intriguing box','back to the woods','creepy guy']
)
next = pick_place(choices,'What next?')
if next == 'beer':
beer()
elif next == 'buy map':
buy_map()
elif next == 'buy':
buy()
elif next == 'sell':
sell()
elif next == 'mirror':
mirror()
elif next == 'box':
box()
elif next == 'improve_weapons':
improve_weapons()
else:
return next
raw_input('You return to the bar.\n')
raw_input('The bartender winks at you.\n')
def beer():
"""
should only be called from in the tavern
"""
global cheated, enter_four
if enter_four == config.confus(config.config4):
player.grab(helpful.Item('SixPack',17,0,0,6))
cheated = True
print '<achievement unlocked>\n'
enter_four = ''
if player.get_money() >= 100:
player.gain_health(17)
player.lose_money(17)
raw_input('You take out your money.\n')
raw_input(words.possesivize(bartender_name) + " eyes widen at your stack of bills.\n")
raw_input('"I guess we have this stuff, if you really need a drink."\n')
raw_input("The 'beer' healed you a bit.\n")
raw_input('It also cost $17.\n')
else:
print bartender_name + ' chuckles and looks pointedly at his empty tip jar.\n'
raw_input('"' +"Beer's expensive, kid." + '"\n')
raw_input('"Nice try."\n')
def buy_map():
"""
should only call from the tavern
"""
global world_map
if world_map:
raw_input('You already have one!')
elif player.get_money() >= 10:
raw_input('You bought a map for $10! Woohoo!\n')
player.lose_money(10)
world_map = True
else:
raw_input('"You seem to be a bit low in the money department..."\n')
def buy():
raw_input('"Buying stuff, eh? ' + "Let's see what I got." +'"\n')
choice = 'poop'
if player.get_money() == 0:
raw_input('"Hey, you have no money! Nice try!"\n')
choice = 'done buying'
while choice != 'done buying':
sale = items_lists.random_weapon()
markup = sale.copy(None,None,None,sale.get_cost()*2)
# print 'yolo'
raw_input(markup.advanced_str())
purchasable = False
if player.get_money() >= markup.get_cost():
purchasable = True
if purchasable:
choice = helpful.pick_item(['yes','more options','done buying'],'Buy ' + str(sale) + '?')
if choice == 'done buying':
break
if choice == 'yes':
player.grab(sale)
player.lose_money(markup.get_cost()) #see that shady deal? ooh so shady
else: #too expensive
raw_input('"Never mind... You seem to be a bit short on cash."\n')
choice = helpful.pick_item(['more options','done buying'],'Keep shopping?')
if choice == 'done buying':
break
print '"We also have this fine item..."\n'
def sell():
raw_input('"Selling stuff, eh? ' + "Let's see what you got." +'"\n')
inspect_inventory(True)
def mirror():
"""
wooo
"""
raw_input("You walk to a mirror hanging on the wall " + \
"and admire your rugged visage.\n")
raw_input(player.advanced_str())
# raw_input('') #TODO see if this is better
def box():
"""
leave thing for next player?
"""
raw_input("There's a note on a wooden box:\n\n" + \
'"Take an item, leave an item..."\n')
choices = (
['box','done'],
['leave something in the box','ignore']
)
choice = helpful.pick_item(choices,'Do it.')
if choice == 'box':
gotem = pickle.load(open("box.txt", "rb"))
# gotem = helpful.Item('test_item')
item = 'mythical kumquat'
question = 'What to leave in the box?'
while str(item) == 'mythical kumquat':
item = helpful.pick_item(player.get_inventory(),question)
question = 'No, really.'
pickle.dump(item, open("box.txt", "wb"))
#json.dump(item, open("boxjson.txt", "wb"))
player.drop(item)
player.grab(gotem)
raw_input('You trade your ' + str(item) + ' for the item in the box:\n')
print gotem.advanced_str()
def improve_weapons():
global BORIS_CRED
raw_input("You walk towards the creepy-looking man with red glowing eyes.\n")
if BORIS_CRED > 100:
print('"WELCOME, FRIEND. GOOD TO SEE YOU AGAIN."\n')
else:
print('"WELCOME TO THE MAGIC ANVIL. MY NAME IS BORIS."\n')
#learn more and more about boris
#get good prices with boris
#one day, he'll come with you to fight and win glory woohoo
talk = helpful.pick_item(["Okay.","No."],'"MY SERVICES COST A MILLION DOLLARS."')
if talk == "Okay.":
if player.get_money() > 1000000:
player.lose_money(1000000)
raw_input("WOW. THAT IS SO MUCH MONEY. THANK YOU. WHATEVER YOU WANT, FOR FREE.")
BORIS_CRED += 1000000
elif BORIS_CRED > 100:
raw_input("NO CHARGE FOR FRIENDS OF BORIS.\n")
BORIS_CRED += 2
else:
raw_input('"' + "YOU OBVIOUSLY DON'T HAVE A MILLION DOLLARS. THAT'S OKAY THOUGH." +'"\n')
choice = helpful.pick_item(["$100","$10","Haha. No."],"Donate to Boris?")
if choice == "$100":
if player.get_money() > 100:
player.lose_money(100)
BORIS_CRED += 50
else:
BORIS_CRED -= 10
raw_input("Yikes. You don't have that much. Oops. Boris is a little sad.\n\nHe agrees to help you though.\n")
elif choice == "$10":
if player.get_money() > 10:
player.lose_money(10)
BORIS_CRED += 2
else:
BORIS_CRED -=2
raw_input("Yikes. You don't have that much. Oops. Boris is a little sad.\n\nHe agrees to help you though.\n")
else:
BORIS_CRED -= 10
else:
raw_input('"WELL THEN. GOODBYE."\n')
BORIS_CRED -= 5
return
improve = "poop"
while improve != "Done":
improve = helpful.pick_item(player.get_inventory() + ['"Never mind, I want a refund."'],'"WHAT WOULD YOU LIKE TO IMPROVE?"\n')
if improve == '"Never mind, I want a refund."':
raw_input('"NO REFUNDS."\n')
BORIS_CRED -= 1
continue
if BORIS_CRED > 900000:
incd = 100
elif BORIS_CRED > 100:
incd = 10
else:
incd = 4
if improve.get_damage() > 0:
improve.inc_damage(incd)
which = "DAMAGE"
elif improve.get_health() > 0:
improve.inc_health(incd)
which = "HEALTH"
else:
raw_input("UM. NOPE. PICK SOMETHING ELSE.\n")
print '"OKAY, I IMPROVED YER ' + str(improve).upper() + ' BY ' + str(incd) + ' POINTS OF ' + (which) + '."\n'
raw_input(improve.advanced_str())
raw_input('\n"YOU' + "'" + 'RE WELCOME."\n')
improve = "Done" #break
def traveler():
"""
TODO: getts the traveler?
"""
raw_input('A wizened old traveler\n')\
def advice():
"""
TODO
"""
raw_input('A sign on the counter reads: "Advice $1".\n')
raw_input('The bartender leans in close and whispers:\n')
# raw_input('...\n')
raw_input('"There is an old man hidden in the forest. You must talk to him."\n')
# return 'tavern'
def old_man_hut():
"""
TODO
"""
raw_input('You are suddenly transported inside a small hut, seemingly made of bamboo.\n')
raw_input("There's a teakettle on the stove, and some fresh cookies on a plate in front of you.\n")
raw_input("Suddenly, a crazy old man rushes in and stabs you.\n")
return 'death'
### cool places ###
def arena():
"""
location
arena where you fight until you die hahahaha
"""
global monsters_defeated, arena_boss
if not arena_boss:
arena_boss = items_lists.random_monster('boss_monsters')
if debug:
print '<arena boss = ' + str(arena_boss) + '>\n'
raw_input("You enter a terrifyingly massive arena.\n")
raw_input("Thousands of bloodthirsty fans are screaming your name.\n")
raw_input("Suddenly, the doors behind you close with a slam.\n")
raw_input("There's no escape.\n")
boss_win = False
arena_monsters_encountered = 0
while player.get_health() > 0 and not boss_win:
arena_monsters_encountered += 1
if arena_monsters_encountered % 10:
fight()
else: #every 10th monster, fight the boss
boss_fight = fight(arena_boss)
if boss_fight == 'win':
boss_win = True
if boss_win:
raw_input("The dying monster's body crashes through the floor, revealing " + \
"a cavernous tunnel underneath the arena...\n")
raw_input("The fans are getting restless, demanding another fight. You seize " + \
"your opportunity quickly and enter the enormous tunnel.\n")
return 'main_tunnel'
else:
raw_input('You defeated ' +str(monsters_defeated) + ' monsters before dying a grisly death!\n')
return 'death'
def portal():
"""
location
"""
raw_input("Oops.\n")
raw_input("You trip and fall into a mysterious portal...\n")
raw_input("...\n")
raw_input("...\n")
raw_input("You wake up in a pair of " + words.color().lower() + \
" shoes and a " + words.color().lower() + " hat.\n")
raw_input("That's odd.\n")
next = [
'woods_1_1','woods_n1_1','woods_1_n1','woods_n1_n1','arena'
]
return random.choice(next)
def bongos():
global bongo_string
raw_input("You stumble upon a large set of bongo drums!\n")
next_bongo = 'poop'
while next_bongo == 'poop':
#if we enter a valid code (or press done), we leave this loop
next_bongo = helpful.pick_item(['a','b','c','d','e','f','g','done'],'Bongo?','done')
if next_bongo == 'done':
break
bongo_string += next_bongo
if len(bongo_string) > 8:
bongo_string = bongo_string[1:]
print 'The bongo booms a glorious "' + next_bongo + \
'" that rings through the woods ominously.\n'
bongo_code_8 = hashlib.md5(bongo_string).hexdigest()
bongo_code_7 = hashlib.md5(bongo_string[1:]).hexdigest()
bongo_code_6 = hashlib.md5(bongo_string[2:]).hexdigest()
if bongo_code_8 == '25746c694387e5114dbb3b99fb9aeb5c':
raw_input('Something is rustling in the bushes.\n')
raw_input('You pull some weeds aside to reveal an enormous, rusty cage.\n')
raw_input("There's a pretty mean-looking bull inside. Thankfully, he's asleep.\n")
raw_input("Don't touch the cage, though.\n")
touch = pick_item((["y","n"],["Touch it!","Don't touch it!"]),"Touch it?")
if touch == "y":
return 'old_man_hut'
else:
raw_input('Good choice.\n')
elif bongo_code_8 == 'da07700b3beac79629b0648855c9d165':
player.grab(helpful.Item('Raw Meat',0,12,7))
raw_input('Some raw meat falls from a tree! Yummy!\n')
elif bongo_code_7 == 'b3188adab3f07e66582bbac456dcd212':
player.grab(helpful.Item('Cabbage',5,0,3,1))
raw_input('A plant appears!\n')
elif bongo_code_7 == '54a28e933e22fbabf29e267dd3f5c908':
raw_input('A giant computer appears!\n')
raw_input("No, really, it's like the size of your house. No idea how you're going to carry that.\n")
player.grab(helpful.Item('Massive Computer',0,0,5000))
elif bongo_code_6 == '50b845418f04cc6ff299ab3de28261fa':
raw_input('Your ' + str(item) + " glows with a pulsating green light.\n\nIt's been improved!")
"""TODO IMPROVE THAT"""
else:
next_bongo = "poop" #keep playing those bongos!
# print 'bongocode',bongo_code_6,bongo_code_8
# print 'bongostring',bongo_string
raw_input("You leave the mystical bongo circle, but to your amazement, " + \
"the sky is a bizarre green color, and the woods have shifted around you.\n")
next = [
'woods_1_1','woods_n1_1','woods_1_n1','woods_n1_n1','arena'
]
goto = random.choice(next)
return goto
### woods ###
def woods_0_0():
"""
main, central woods
+---------+
| |
| X |
| |
+---------+
"""
global woods_0_0_name, map_1
map_1 = map_1[:12] + '| X |' + map_1[24:]
try:
print "You're in " + woods_0_0_name + "!\n"
except:
woods_0_0_name = words.woods_name()
print "You enter " + woods_0_0_name + "!\n"
raw_input('Well-traveled paths lead north and south, ' + \
'and darker, twisting paths lead east and west.\n\n' + \
"There's also an odd-looking building in " + \
"the distance. Maybe it's a tavern?")
next = (
['woods_0_1','woods_1_0','woods_0_n1','woods_n1_0','tavern'],
["North","East","South","West","Tavern"]
)
return pick_place(next,'Where to next?')
def woods_0_1():
"""
quieter, northern woods
+---------+
| X |
| |
| |
+---------+
"""
global woods_0_1_name,map_0
map_0 = map_0[:12] + '| X |' + map_0[24:]
try:
raw_input("You enter " + woods_0_1_name + "!\n")
except:
woods_0_1_name = words.woods_name()
raw_input("You enter " + woods_0_1_name + "!\n")
monsta_here = round(random.random() -.2)
if monsta_here:
result = encounter_monster(['tiny_monsters'])
if result == 'death':
return result
else:
raw_input("Not much here.\n")
next = (
['woods_0_0','woods_1_1','woods_n1_1'],
["South","East","West"]
)
return pick_place(next,'Where to next?')
def woods_0_n1():
"""
quieter, southern woods
+---------+
| |
| |
| X |
+---------+
"""
global woods_0_n1_name,map_2
map_2 = map_2[:12] + '| X |' + map_2[24:]
try:
raw_input("You enter " + woods_0_n1_name + "!\n")
except:
woods_0_n1_name = words.woods_name()
raw_input("You enter " + woods_0_n1_name + "!\n")
monsta_here = round(random.random() -.2)
if monsta_here:
result = encounter_monster(['tiny_monsters','small_monsters'])
if result == 'death':
return result
else:
raw_input("Not much here.\n")
next = (
['woods_0_0','woods_1_n1','woods_n1_n1'],
["North","East","West"]
)
return pick_place(next,'Where to next?')
def woods_1_0():
"""
shady eastern woods
+---------+
| |
| X |
| |
+---------+
"""
global woods_1_0_name,map_1
map_1 = map_1[:12] + '| X |' + map_1[24:]
try:
print "You enter " + woods_1_0_name + ".\n"
except:
woods_1_0_name = words.woods_name()
print "You enter " + woods_1_0_name + ".\n"
monsta_here = round(random.random() +.3)
if monsta_here:
result = encounter_monster(['small_monsters','medium_monsters'])
if result == 'death':
return result
else:
raw_input("There's a giant colosseum in the distance...\n")
next = (
['woods_0_0','woods_1_1','woods_1_n1','arena'],
["West","North","South","Arena"]
)
return pick_place(next,'Where to next?')
def woods_1_1():
"""
dangerous corner woods
+---------+
| X |
| |
| |
+---------+
"""
global woods_1_1_name,map_0
map_0 = map_0[:12] + '| X |' + map_0[24:]
try:
raw_input("You enter " + woods_1_1_name + ".\n")
except:
woods_1_1_name = words.woods_name()
raw_input("You enter " + woods_1_1_name + ".\n")
monsta_here = round(random.random() + .4)
if monsta_here:
result = encounter_monster(['medium_monsters','large_monsters'])
if result == 'death':
return result
else:
raw_input("Not much here.\n")
next = (
['woods_1_0','woods_0_1'],
["South","West"]
)
return pick_place(next,'Where to next?')
def woods_1_n1():
"""
dangerous corner woods
+---------+
| |
| |
| X |
+---------+
"""
global woods_1_n1_name,map_2
map_2 = map_2[:12] + '| X |' + map_2[24:]
try:
raw_input("You enter " + woods_1_n1_name + ".\n")
except:
woods_1_n1_name = words.woods_name()
raw_input("You enter " + woods_1_n1_name + ".\n")
monsta_here = round(random.random() + .4)
if monsta_here:
result = encounter_monster(['medium_monsters','large_monsters'])
if result == 'death':
return result
else:
raw_input("Not much here.\n")
next = (
['woods_1_0','woods_0_n1'],
["North","West"]
)
return pick_place(next,'Where to next?')
def woods_n1_0():
"""
shady western woods
+---------+
| |
| X |
| |
+---------+
"""
global woods_n1_0_name,map_1
map_1 = map_1[:12] + '| X |' + map_1[24:]
try:
print "You enter " + woods_n1_0_name + ".\n"
except:
woods_n1_0_name = words.woods_name()
print "You enter " + woods_n1_0_name + ".\n"
raw_input("Uh oh...\n")
monsta_here = round(random.random() +.3)
if monsta_here: