Guest User

Untitled

a guest
Oct 14th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 KB | None | 0 0
  1.  
  2. import sys,os,random
  3.  
  4. weapons = {"OH SHIT! Sword":10}
  5.  
  6. class Player:
  7. def __init__(self,name):
  8. self.name = name
  9. self.maxhealth = 100
  10. self.health = self.maxhealth
  11. self.base_attack = 10
  12. self.gold = 100
  13. self.pots = 2
  14. self.weap = ['OH SHIT! Sword']
  15. self.curweap = ['OH SHIT! Sword']
  16.  
  17. @property
  18. def attack(self):
  19. attack = self.base_attack
  20. if self.curweap == 'Dildo':
  21. self.attack += 10
  22.  
  23. if self.curweap == "OH SHIT! Sword":
  24. attack += 9000
  25.  
  26. return attack
  27.  
  28. class Goblin:
  29. def __init__(self,name):
  30. self.name = name
  31. self.maxhealth = 50
  32. self.health = self.maxhealth
  33. self.attack = 800
  34. self.goldgoin = 10
  35. GoblinIG = Goblin('Goblin')
  36.  
  37. class Zombie:
  38. def __init__(self,name):
  39. self.name = name
  40. self.maxhealth = 70
  41. self.health = self.maxhealth
  42. self.attack = 800
  43. self.goldgoin = 12
  44. ZombieIG = Zombie('Zombie')
  45.  
  46. def main():
  47. os.system('cls')
  48. print('welcome to my game\n')
  49. print('1.) Start')
  50. print('2.) Load')
  51. print('3.) Exit\n')
  52. option = input('-->')
  53. if option=="1":
  54. start()
  55. elif option=="2":
  56. pass
  57. elif option=="3":
  58. sys.exit()
  59. else:
  60. main()
  61.  
  62. def start():
  63. os.system('cls')
  64. print ('hello, what is your name?')
  65. option = input('-->')
  66. global PlayerIG
  67. PlayerIG = Player(option)
  68. start1()
  69.  
  70. def start1():
  71. os.system('cls')
  72. print('Name: %s' % PlayerIG.name)
  73. print('Attack: %i' % PlayerIG.attack)
  74. print('Health: %i/%i\n' % (PlayerIG.health, PlayerIG.maxhealth))
  75. print('Current Weapons: %s' % PlayerIG.curweap)
  76. print('Gold: %d' % PlayerIG.gold)
  77. print('Potions: %d\n' % PlayerIG.pots)
  78. print('1.) Fight')
  79. print('2.) Store')
  80. print('3.) Save')
  81. print('4.) Exit')
  82. option = input('-->')
  83. if option=='1':
  84. prefight()
  85. elif option=='2':
  86. store()
  87. elif option=='3':
  88. pass
  89. elif option =='4':
  90. sys.exit()
  91. else:
  92. start1()
  93.  
  94. def prefight():
  95. global enemy
  96. enemynum = random.randint(1, 2)
  97. if enemynum==1:
  98. enemy=GoblinIG
  99. else:
  100. enemy=ZombieIG
  101. fight()
  102.  
  103. def fight():
  104. print('\n%s VS %s\n' % (PlayerIG.name,enemy.name))
  105. print("%s's health: %d/%d %s's Health: %i/%i\n" % (PlayerIG.name,PlayerIG.health,PlayerIG.maxhealth,enemy.name,enemy.health,enemy.maxhealth))
  106. print('potions: %s\n' % PlayerIG.pots)
  107. print('1.) Attack')
  108. print('2.) Drink Potion')
  109. print('3.) Run')
  110. option = input(' ')
  111. if option=='1':
  112. attack()
  113. elif option=='2':
  114. drinkpot()
  115. elif option=='3':
  116. run()
  117. else:
  118. fight()
  119.  
  120. def attack():
  121. os.system('cls')
  122. PAttack = random.randint(PlayerIG.attack /2, PlayerIG.attack)
  123. EAttack = random.randint(enemy.attack /2, enemy.attack)
  124.  
  125. if PAttack == PlayerIG.attack/2:
  126. print ('YOU MISS!')
  127. fight()
  128. else:
  129. enemy.health -= PAttack
  130. print ('you deal %i damage' % PAttack)
  131. if enemy.health<=0:
  132. win()
  133.  
  134. if EAttack == enemy.attack/2:
  135. print ('ENEMY MISS!')
  136. option = input(' ')
  137. os.system('cls')
  138. fight()
  139.  
  140. else:
  141. PlayerIG.health -= EAttack
  142. print ('enemy deal %i damage' % EAttack)
  143. option=input(' ')
  144. os.system('cls')
  145. if PlayerIG.health <= 0:
  146. dead()
  147. else:
  148. fight()
  149.  
  150. def drinkpot():
  151. os.system('cls')
  152. if PlayerIG.pots == 0:
  153. print('you have no potions')
  154. fight()
  155. else:
  156. PlayerIG.health+=50
  157. PlayerIG.pots-=1
  158.  
  159. if PlayerIG.health > PlayerIG.maxhealth:
  160. PlayerIG.health = PlayerIG.maxhealth
  161. print('You drank a potion')
  162. option = input(' ')
  163. fight()
  164.  
  165. def run():
  166. runnum = random.randint(1,3)
  167. EAttack = random.randint(enemy.attack /2, enemy.attack)
  168.  
  169. if runnum == 1:
  170. print('you successfully ran away')
  171. option=input(' ')
  172. start1()
  173.  
  174. else:
  175. print('you failed to run away')
  176.  
  177. if EAttack == enemy.attack/2:
  178. print ('ENEMY MISS!')
  179. option = input(' ')
  180. fight()
  181.  
  182. else:
  183. PlayerIG.health -= EAttack
  184. print ('enemy deal %i damage' % EAttack)
  185. os.system('cls')
  186. option=input(' ')
  187.  
  188. if PlayerIG.health <= 0:
  189. dead()
  190. else:
  191. fight()
  192.  
  193. def win():
  194. os.system('cls')
  195. enemy.health = enemy.maxhealth
  196. PlayerIG.gold += enemy.goldgoin
  197. print('you have defeated the %s' % enemy.name)
  198. print('you have found %i gold' % enemy.goldgoin)
  199. option = input(' ')
  200. start1()
  201. def dead():
  202. os.system('cls')
  203. print('you have died')
  204. option=input(' ')
  205.  
  206. def store():
  207. os.system('cls')
  208. print ('Hello Welcome to the shop!')
  209. print ('\nWhat are you buyin?')
  210. print ('1.) OH SHIT! Sword')
  211. print (' ')
  212. option=input(' ')
  213.  
  214. if option in weapons:
  215. if PlayerIG.gold >= weapons[option]:
  216. os.system('cls')
  217. PlayerIG.gold -= weapons[option]
  218. PlayerIG.weap.append(option)
  219. print('you have purchased the %s' % option)
  220. store()
  221.  
  222. else:
  223. os.system('cls')
  224. print("you don't have enough")
  225. option = input(' ')
  226. store()
  227.  
  228. elif option == "back":
  229. start1()
  230.  
  231. else:
  232. os.system(' ')
  233. print('this does not exist here')
  234. option=input(' ')
  235. store()
  236.  
  237. main()
Advertisement
Add Comment
Please, Sign In to add comment