daily pastebin goal
29%
SHARE
TWEET

Text Adventure Game Update 4

Mr_whitespace Jun 21st, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2. from time import sleep
  3.  
  4.  
  5. #Changelog 21/6/18 Added money/gold system, continued storyline, added a remove money system.
  6.  
  7. def AddMoney(playername, amount=0): #gold system
  8.     playername.inventory['gold'] += amount
  9.     print('You have recieved money, you now have ' + str(playername.inventory['gold']) + ' gold')
  10.  
  11.  
  12. def RemoveMoney(playername, amount=0): #Remove Gold system
  13.    
  14.     playername.inventory['gold'] -= amount
  15.     print('Lost money, you now have ' + str(playername.inventory['gold']))
  16.  
  17.    
  18. class Player: #Class to keep track of what the player has
  19.     inventory = {'gold': 10, 'Weapon': None}
  20.     health = 100
  21.     items = {'Sword':' Sword: 500'}
  22.  
  23.     def __init__(self, health=100, inventory='inven'):
  24.         self.health = 100
  25.         self.inventory = {'gold': 10, 'Weapon': None}
  26.  
  27.  
  28.  
  29. BallQuestFight = ['You win the fight', 'You lose the fight']
  30. def BallQuestPark(): #This function ties into the park storyline
  31.     while True:
  32.         print('You arrive at the park, a little boy wants help finding his ball.')
  33.         print("Do you look 'left', 'right', 'forward', or 'backwards'?")
  34.         BallQuest1 = input()
  35.         if BallQuest1 == 'left':
  36.             print('You look left but don\'t see the ball')
  37.             print('Try again')
  38.         elif BallQuest1 == 'right':
  39.             print("You see something to your right, do you 'follow' or 'stay back'?")
  40.             BallQuest2 = input()
  41.             if BallQuest2 == 'stay back':
  42.                 print("You stay back, do you look 'left', 'right', 'forward' or 'backwards'")
  43.                 BallQuest1 = input()
  44.             elif BallQuest2 == 'follow':
  45.                 print("You decide to follow this thing, you follow this thing into the dirty, muddy sewers.")
  46.                 print('Walking...')
  47.                 sleep(2)
  48.                 print('You enter the sewers...')
  49.                 sleep(1)
  50.                 print('Dun...')
  51.                 sleep(1)
  52.                 print('Dun...')
  53.                 print('You hear something coming towards you!')
  54.                 sleep(1)
  55.                 print("You run into a thug that is unarmed.")
  56.                 print("Do you either 'run', or 'fight'?")
  57.                 fight = input()
  58.                 if fight == 'fight':
  59.                     FightOutcome = random.choice(BallQuestFight)
  60.                     print('You throw a couple punches here and there...')
  61.                     print(FightOutcome)
  62.                     if FightOutcome == BallQuestFight[1]:
  63.                         print('You lie on the floor, the thugs have taken you hostage')
  64.                         break
  65.  
  66. FightChance = ['You win the fight and steal the money from the thugs', 'You lose the fight and the thugs steal your money']
  67.  
  68. print('Please enter your characters name')
  69. name = input()
  70. PlayerName = Player()
  71.          
  72. print('As you enter the gates to the city of sorrows you notice there are a few places you can go into')
  73. print("You see a 'tavern', a 'shopping centre' and a 'park', where do you go?")
  74.  
  75. answer1 = input()
  76.  
  77.      
  78. if answer1.lower() == 'tavern': #Tavern story line
  79.     print('Entering tavern...')
  80.     sleep(3)
  81.     print("You enter the tavern, do you 'order a drink', or 'leave'?")
  82.     tavQues = input()
  83.     if tavQues.lower() == 'leave':
  84.         print('Leaving tavern...')
  85.         sleep(2)
  86.         print('{} has left the tavern'.format(name))
  87.         sleep(2)
  88.         print("You get harrassed by a group of lowly thugs that are wanting your money, do you 'fight back' or 'stay civil")
  89.         fight = input()
  90.         if fight.lower() == 'fight back':
  91.             print('{} throws a couple punches here and there...'.format(name))
  92.             sleep(2)
  93.             fate = random.choice(FightChance)
  94.             if fate == FightChance[0]:
  95.                 print('You have won the fight!')
  96.                 AddMoney(PlayerName, 300)
  97.             elif fate == FightChance[1]:
  98.                 print('You lose the fight and are bruised')
  99.                 sleep(2)
  100.                 print('You pass out on the cold hard floor, when you wake up all your money is gone')
  101.                 RemoveMoney(PlayerName, 50)
  102.                 print("Do you 'Go back home' or 'grab food from the store'")
  103.                 decision = input()
  104.                 if decision.lower() == 'grab food from the store':
  105.                     print('Store is closed')
  106.                     print("'Go back home' or 'go to tavern'")
  107.                 elif decision.lower() == 'go back home':
  108.                     print('You start walking home...')
  109.                     sleep(4)
  110.                     print("You have arrived at home, do you 'open the door' or 'look around")
  111.                     Homedec = input()
  112.                     if Homedec == 'look around':
  113.                         print('Looking around...')
  114.                         sleep(2)
  115.                         print('You find a stick!')
  116.                         PlayerName.inventory['Weapon'] += 'stick'
  117.                         print(PlayerName.inventory)
  118.                        
  119.                
  120.         elif fight.lower() == 'stay civil':
  121.             print('The thugs appreciate your kindness, in return they give YOU money')
  122.             AddMoney(PlayerName, 50)
  123.            
  124.                        
  125.     elif tavQues.lower() == 'order drink':
  126.         print("You order a drink and start to feel a little bit dizzy, do you 'go back home', or 'stay'?")
  127. elif answer1.lower() == 'shopping centre':
  128.     print('Walking to store...')
  129.     sleep(2)
  130.     print('You walk in to the store, here are the items on sale: ')
  131.     print(PlayerName.items)
  132.     print('Items for sale: {}'.format(PlayerName.items))
  133.     print('Purchase sword?')
  134.     purchase = input()
  135.     if purchase == 'yes':
  136.         if PlayerName.inventory['gold'] < 500:
  137.             print('Not enough money')
  138.         else:
  139.              print('Buying item...')
  140.              PlayerName.inventory['Weapon'] == items
  141. elif answer1.lower() == 'park':
  142.     print('You walk to the park...')
  143.     sleep(2)
  144.     BallQuestPark()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top