Guest User

Pokemon Adventure Game

a guest
Nov 29th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.46 KB | None | 0 0
  1. import time, os
  2. import battle_function
  3. from os import system, name
  4. from random import randint
  5. def clear():#to clear page
  6. if name == 'nt':#window
  7. _ = system('cls')
  8. else:#mac linux
  9. _ = system('clear')
  10. def checkType(a):#change type if it int
  11. if a.isdigit():
  12. return int(a)
  13. def loading_page():#loading page to get game like feeling
  14. x= " . "
  15. for i in range(4):
  16. clear()
  17. print("Loading", end="")
  18. print(x)
  19. x += " . "
  20. time.sleep(1)
  21. clear()
  22. return
  23. def starter_poke():
  24. list = ["Chamander", "Squirtle", "Treecko"]
  25. global first_poke
  26. #info = [["004","Fire","Lizard Pokemon", "2′00″","18.7 pounds","Blaze, Solar Power (Hidden Ability)"],["007","Water","Tiny Turtle Pokemon","1′08″","19.8 pounds","Torrent, Rain Dish (Hidden Ability)"],["252","Grass","Wood Gecko Pokemon","1'08″,","11 pounds","vergrow, Unburden (Hidden Ability)"]]
  27. clear()
  28. print("Choose your starter Pokemon")
  29. x=1
  30. for i in range(3):
  31. print(x, ". ", list[i])
  32. x +=1
  33. #print("National Number:", info[i][0])
  34. #print("Type:", info[i][1])
  35. #print("Species:", info[i][2])
  36. #print("Height:", info[i][3])
  37. #print("Weight:", info[i][4])
  38. #print("Abilities:", info[i][5])
  39. #x += 1
  40. while True:
  41. choice = input("Your Choice :")
  42. choice = checkType(choice)
  43. global first_poke
  44. if choice == 1:
  45. first_poke = list[0]
  46. return "fire"
  47. elif choice == 2:
  48. first_poke = list[1]
  49. return "water"
  50. elif choice == 3:
  51. first_poke = list[2]
  52. return "grass"
  53. else:
  54. print("Invalid input. Please try again")
  55. return
  56. def battle(npcname):
  57. clear()
  58. pokemon_name = ["Charizard", "Blastoise", "Pikachu", "Snorlax", "Flygon", "Squirtle", "Ampharos"]
  59. random_no = randint(0,6)
  60. npc_health = 100
  61. print(npcname+" sent out a "+pokemon_name[random_no])
  62. print("What will "+first_poke+" do?")
  63. # print("Attack\n1.Tackle\n2.Growl\n3.Fire Fang\n4.Ember")
  64. # attack_choice = input("Your choice: ")
  65. # attack_choice = checkType(choice)
  66. if first_poke == "Chamander":
  67. while not npc_health <= 0:
  68. # clear()
  69. print("Attack\n1.Tackle\n2.Growl\n3.Fire Fang\n4.Ember")
  70. attack_choice = input("Your choice: ")
  71. attack_choice = checkType(attack_choice)
  72. if attack_choice == 1:
  73. clear()
  74. damage = 10
  75. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  76. npc_health = npc_health - damage
  77. print("Opponent health : "+str(npc_health))
  78.  
  79. if attack_choice == 2:
  80. clear()
  81. damage = 5
  82. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  83. npc_health = npc_health - damage
  84. print("Opponent health : "+str(npc_health))
  85.  
  86. if attack_choice == 3:
  87. clear()
  88. damage = 30
  89. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  90. npc_health = npc_health - damage
  91. print("Opponent health : "+str(npc_health))
  92.  
  93. if attack_choice == 4:
  94. clear()
  95. damage = 20
  96. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  97. npc_health = npc_health - damage
  98. print("Opponent health : "+str(npc_health))
  99.  
  100. else:
  101. clear()
  102. print("You have win the battle!")
  103. if first_poke == "Squirtle":
  104. while not npc_health <= 0:
  105. # clear()
  106. print("Attack\n1.Tackle\n2.Tail Whip\n3.Water Gun\n4.Water Pulse")
  107. attack_choice = input("Your choice: ")
  108. attack_choice = checkType(attack_choice)
  109. if attack_choice == 1:
  110. clear()
  111. damage = 10
  112. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  113. npc_health = npc_health - damage
  114. print("Opponent health : "+str(npc_health))
  115.  
  116. if attack_choice == 2:
  117. clear()
  118. damage = 15
  119. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  120. npc_health = npc_health - damage
  121. print("Opponent health : "+str(npc_health))
  122.  
  123. if attack_choice == 3:
  124. clear()
  125. damage = 25
  126. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  127. npc_health = npc_health - damage
  128. print("Opponent health : "+str(npc_health))
  129.  
  130. if attack_choice == 4:
  131. clear()
  132. damage = 35
  133. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  134.  
  135. npc_health = npc_health - damage
  136. print("Opponent health : "+str(npc_health))#
  137.  
  138. else:
  139. clear()
  140. print("You have win the battle!")
  141. if first_poke == "Treecko":
  142. while not npc_health <= 0:
  143. # clear()
  144. print("Attack\n1.Leer\n2.Pound\n3.Leafage\n4.Mega Drain")
  145. attack_choice = input("Your choice: ")
  146. attack_choice = checkType(attack_choice)
  147. if attack_choice == 1:
  148. clear()
  149. damage = 8
  150. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  151. npc_health = npc_health - damage
  152. print("Opponent health : "+str(npc_health))
  153.  
  154. if attack_choice == 2:
  155. clear()
  156. damage = 10
  157. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  158. npc_health = npc_health - damage
  159. print("Opponent health : "+str(npc_health))
  160.  
  161. if attack_choice == 3:
  162. clear()
  163. damage = 30
  164. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  165. npc_health = npc_health - damage
  166. print("Opponent health : "+str(npc_health))
  167.  
  168. if attack_choice == 4:
  169. clear()
  170. damage = 40
  171. print (first_poke+" has hit the opponent for " +str(damage)+" damage!")
  172. npc_health = npc_health - damage
  173. print("Opponent health : "+str(npc_health))
  174.  
  175. else:
  176. clear()
  177. print("You have win the battle!")
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184. pass
  185.  
  186.  
  187.  
  188.  
  189. def intro():
  190. global name
  191. print("Welcome to Pokemon text-based Adventure")
  192. name = input("Please enter your trainer name : ")
  193. print("Saving Data. . . \n")
  194. time.sleep(2)
  195. loading_page()
  196. print("Hey there! I'm the Prof. Oak. Welcome to Pokemon Reborn!\n")
  197. print("Pokemon are living creatures that inhabit our pokemon world, living alongside, \nand usually helping, us humans.\n")
  198. print("You must be "+name+", Right? Looks like you're new here.")
  199. print("So.. you want to become a Pokemon Trainer? Well, lets see what you're capable of.")
  200. print("Now listen closely, there is this new trainer named Ash.")
  201. print("Now I need you to take out his pokemon, capiche?")
  202. next=input("Continue:")
  203. pokeE = starter_poke()
  204. clear()
  205. print("Woah... The",pokeE, "pokemon. A good choice.")
  206. print("Your pokemon is a 'normal' type pokemon, there are nine type of pokemon in the game, as shown below:")
  207. type = ["Normal","Shiny","Haunted","Frost","Shadow","Glitter","Golden","Demon","Eternal"]
  208. for idx, val in enumerate(type, start = 1):
  209. print(" " + str(idx) + ". " + val)
  210. print("To catch pokemon, you have to walk around the various maps until a wild \npokemon shows up. You will then have to throw a pokeball to capture it!")
  211. print("Ash is in the next room, whenever you're ready.")
  212. next = input("Battle Ash- I'm Ready:")
  213. battle("Ash")
  214. n = 2
  215. while n == 2:
  216. print("Who do you want to battle now?")
  217. opponent = str(input("Enter name: "))
  218. battle(opponent)
  219.  
  220.  
  221.  
  222.  
  223. return
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230. while True:
  231. clear()
  232. intro()
  233. break
  234.  
Advertisement
Add Comment
Please, Sign In to add comment