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 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")) 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 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_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 while choice != 'done': choices = list(player.get_inventory()) choices += ['done'] intro = 'Type 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 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 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 bongos(): global bongo_string raw_input("You stumble upon a large set of bongo drums!\n") next_bongo = 'poop' while next_bongo != 'done': 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:] raw_input('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 == 'b6fe35296e44d8d2955ef7f609f90904': raw_input('a giant computer appears') elif bongo_code_7 == '': raw_input('a plant appears') # 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 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
def bongos(): global bongo_string raw_input("You stumble upon a large set of bongo drums!\n") next_bongo = 'poop' while next_bongo != 'done': 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:] raw_input('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 == 'b6fe35296e44d8d2955ef7f609f90904': raw_input('a giant computer appears') elif bongo_code_7 == '': raw_input('a plant appears') # 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 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
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
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 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 start_game(): ###configure config.config() global press_enter, enter_two, enter_four global hardcore; hardcore = False global player global debug; debug = False global monsters_defeated; monsters_defeated = 0; global bongo_string; bongo_string = 'sevenya' global world_map #well I hope so world_map = False global map_0; map_0 = ' | | ' global map_1; map_1 = ' | | ' global map_2; map_2 = ' | | ' global tavern_name; tavern_name = '' global bartender_name; bartender_name = '' global traveler_name; traveler_name = '' global arena_boss; arena_boss = '' global BORIS_CRED; BORIS_CRED = 0 global cheated; cheated = False global in_tavern; in_tavern = False ### the story begins ### print('\n'*100) #clear screen print ' AVENTUREGAME! \n' print '< use numbers/letters to choose >\n' press_enter = getpass.getpass( '< press enter to continue >\n' ) print('\n'*100) if press_enter[0:4] =='yolo': hardcore = True ###TODO remove this and make this actually do things, like double score, etc cheated = True raw_input('<hardcore mode activated>\n') name = raw_input('Name?\n\n') if name == '': name = 'Nameless One' if name == 'debug': name = 'Valiant Beta Tester' print "<debug mode activated>\n" debug = True player = helpful.Player(name) #name character if debug: print "Helpful debug commands:\n\n" print "money int\nhealth int\nloc place\nfight\n\n" raw_input("\n") else: raw_input('\nWelcome, '+ str(player) +'!\n') raw_input('You wake up slightly dizzy and very thirsty. You are sitting on a dirt path.\n') raw_input('You have no idea how you got here, or even who you are.\n') raw_input('The last thing you remember is an old man telling you...\n') raw_input("Telling you...\n") raw_input("Wow, you really can't remember anything. Your head hurts a lot.\n") raw_input("You can't remember exactly what he told you. Something about dragons.\n") raw_input("There's a weird fruit next to you. It has a note on it:\n") raw_input(" MYTHICAL KUMQUAT\n" + \ " \n" + \ " (do not lose me)\n") raw_input("There's also a basket of supplies. You should take some.\n") print ('\n'*10) bag = [ items_lists.random_weapon('short_weapons'), items_lists.random_weapon('short_weapons'), items_lists.random_weapon('short_weapons'), items_lists.random_weapon('long_weapons'), items_lists.random_weapon('long_weapons'), helpful.Item('laser',0,50,0,12) ] random.shuffle(bag) num_choices = 1 if not hardcore: num_choices = 3 while num_choices > 0: text = str(num_choices) + ' starting weapons left to choose!' if num_choices == 1: text = 'Last one!' item = helpful.pick_item(bag,text) bag.remove(item) player.grab(item) print 'You acquired a ' + str(item) + '.\n' num_choices -= 1 if not hardcore: bag = [ helpful.Item('apple',50,0,5,1), helpful.Item('pizza',10,0,14.99,8), helpful.Item('turnip',28,0,2,1) ] item = helpful.pick_item(bag,'Now choose a foodstuff!') player.grab(item) raw_input('Let the adventure begin!\n') player.grab(helpful.Item('mythical kumquat',0,0,1000)) enter_two = '' enter_four = '' next_location = 'woods' #start here while next_location: #the main journey loop! aaaaand we're off # raw_input('next up: ' + str(next_location) + '\n') next_location = visit(next_location)
while 1: try: start_game() except: print '\nWe ran into an error.\n' print 'Admin will be notified.\n' logging.exception("AventureGameError:") #LOG choice_count = 0 choice = "n" choices = (["y","n"],["yes","no"]) question = "Play again? (y/n)" while choice == "n": choice_count += 1 choice = helpful.pick_item(choices,question) if choice_count < 3: question = "No, really.\n" elif choice_count < 7: question = "I'm serious. Play again.\n" elif choice_count < 15: question = "Just press yes.\n" elif choice_count < 25: question = "Please.\n" elif choice_count < 35: question = "Stop it.\n" elif choice_count < 45: question = "You're the worst kind of person.\n" elif choice_count < 46: question = "Do you want to not play again?\n" choices = (["n","y"],["yes","no"])
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(random.choice(who_fight)) else: ###else picks a monster at random, not boss though enemy = items_lists.random_monster() # print 'fighting:\n' + enemy.advanced_str() encountered = words.being_adj().capitalize() + ' ' + 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!') elif defend > 0: raw_input('You gained ' + str(defend) + ' HP!') else: 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) raw_input('You looted the following items:\n' + enemy.get_inv_string()) 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 start_game(): ###configure config.config() global press_enter, enter_two, enter_four global hardcore global player global monsters_defeated global bongo_string global world_map #well I hope so global map_0 global map_1 global map_2 global tavern_name global bartender_name global traveler_name global arena_boss global cheated hardcore = False monsters_defeated = 0 bongo_string = 'sevenya' world_map = False map_0 = '| | ' map_1 = '| | ' map_2 = '| | ' tavern_name = '' bartender_name = '' traveler_name = '' arena_boss = '' in_tavern = False cheated = False ### the story begins ### print('\n' * 100) #clear screen print ' AVENTUREGAME! \n' print '< use numbers/letters to choose >\n' press_enter = getpass.getpass('< press enter to continue >\n') print('\n' * 100) if press_enter[0:4] == 'yolo': hardcore = True cheated = True ###TODO remove this and make this actually do things, like double score, etc raw_input('<hardcore mode activated>\n') name = raw_input('Name?\n\n') if name == '': name = 'Nameless One' player = helpful.Player(name) #name character raw_input('\nWelcome, ' + str(player) + '!\n') print 'You are a poor orphan, determined to make your way in the world.\n' raw_input('You have nothing but the clothes on your back (which you stole) ' + \ 'and an odd-looking fruit.\n') raw_input("You've heard rumors of a giant, horrifying dragon terrorizing the " + \ 'land.\n\nIf you can defeat him, surely you will be remembered ' + \ 'as more than just a smelly, penniless orphan.\n') raw_input('Good luck!\n') print('\n' * 10) bag = [ items_lists.random_weapon('short_weapons'), items_lists.random_weapon('long_weapons'), helpful.Item('apple', 50, 0, 5, 1), helpful.Item('pizza', 10, 0, 14.99, 8), helpful.Item('laser', 0, 50, 0, 15) ] num_choices = 3 while num_choices > 0: item = helpful.pick_item( bag, str(num_choices) + ' starting items left to choose!') bag.remove(item) player.grab(item) print 'You acquired a ' + str(item) + '.\n' num_choices -= 1 raw_input('Let the adventure begin!\n') player.grab(helpful.Item('mythical kumquat', 0, 0, 1000)) enter_two = '' enter_four = '' next_location = 'woods' #start here while next_location: #the main journey loop! aaaaand we're off # raw_input('next up: ' + str(next_location) + '\n') next_location = visit(next_location)
def start_game(): ###configure config.config() global press_enter, enter_two, enter_four global hardcore global player global monsters_defeated global bongo_string global world_map #well I hope so global map_0 global map_1 global map_2 global tavern_name global bartender_name global traveler_name global arena_boss global cheated hardcore = False monsters_defeated = 0 bongo_string = 'sevenya' world_map = False map_0 = '| | ' map_1 = '| | ' map_2 = '| | ' tavern_name = '' bartender_name = '' traveler_name = '' arena_boss = '' in_tavern = False cheated = False ### the story begins ### print('\n'*100) #clear screen print ' AVENTUREGAME! \n' print '< use numbers/letters to choose >\n' press_enter = getpass.getpass( '< press enter to continue >\n' ) print('\n'*100) if press_enter[0:4] =='yolo': hardcore = True cheated = True ###TODO remove this and make this actually do things, like double score, etc raw_input('<hardcore mode activated>\n') name = raw_input('Name?\n\n') if name == '': name = 'Nameless One' player = helpful.Player(name) #name character raw_input('\nWelcome, '+ str(player) +'!\n') print 'You are a poor orphan, determined to make your way in the world.\n' raw_input('You have nothing but the clothes on your back (which you stole) ' + \ 'and an odd-looking fruit.\n') raw_input("You've heard rumors of a giant, horrifying dragon terrorizing the " + \ 'land.\n\nIf you can defeat him, surely you will be remembered ' + \ 'as more than just a smelly, penniless orphan.\n') raw_input('Good luck!\n') print ('\n'*10) bag = [ items_lists.random_weapon('short_weapons'), items_lists.random_weapon('long_weapons'), helpful.Item('apple',50,0,5,1), helpful.Item('pizza',10,0,14.99,8), helpful.Item('laser',0,50,0,15) ] num_choices = 3 while num_choices > 0: item = helpful.pick_item(bag,str(num_choices) + ' starting items left to choose!') bag.remove(item) player.grab(item) print 'You acquired a ' + str(item) + '.\n' num_choices -= 1 raw_input('Let the adventure begin!\n') player.grab(helpful.Item('mythical kumquat',0,0,1000)) enter_two = '' enter_four = '' next_location = 'woods' #start here while next_location: #the main journey loop! aaaaand we're off # raw_input('next up: ' + str(next_location) + '\n') next_location = visit(next_location)