Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. import requests
  2. import random
  3. import pprint
  4.  
  5.  
  6.  
  7. class pokeman():
  8. name = ""
  9. moves = []
  10. def __init__(self, name, moves):
  11. self.name = name
  12. for move in moves:
  13. self.moves.append(move['move']['name'])
  14.  
  15.  
  16. def talk(self):
  17. print(self.name[:5]+'-'+self.name[:4])
  18.  
  19. def showmeyourmoves(self):
  20. print("{},{},{},{}".format(random.choice(self.moves),random.choice(self.moves),random.choice(self.moves),random.choice(self.moves)))
  21.  
  22. def is_legit_or_has_2_quit(pokemon_data_from_the_internet):
  23. id = pokemon_data_from_the_internet['number']
  24. moves_they_claim_it_has = pokemon_data_from_the_internet['moves']
  25. data = requests.get('http://pokeapi.co/api/v2/pokemon/{}'.format(id))
  26. pokemon_data_from_the_internet = data.json()
  27. move_list_from_the_internet = pokemon_data_from_the_internet['moves']
  28. for move_we_are_checkin_out in moves_they_claim_it_has:
  29. for move_data in move_list_from_the_internet:
  30. move_name = move_data['move']['name']
  31. if move_we_are_checkin_out == move_name:
  32. print(move_we_are_checkin_out, move_name)
  33. break
  34. else:
  35. print("not legit! ", pokemon_data_from_the_internet['name'], "can't learn", move_we_are_checkin_out, 'you dirty, dirty cheating liar! YOU SIT ON A THRONE OF LIES!!!!')
  36. return
  37.  
  38.  
  39. def get_pokedex_data_by_id(id):
  40. data = requests.get('http://pokeapi.co/api/v2/pokemon/{}'.format(id))
  41. pokemon_data_from_the_internet = data.json()
  42. return pokemon_data_from_the_internet
  43.  
  44.  
  45. def get_valid_movelist(data):
  46. results = []
  47. for move in data['moves']:
  48. results.append(move['move']['name'])
  49. return results
  50.  
  51.  
  52.  
  53. def is_legit_or_has_2_quit_the_sequel(pokemon_we_are_checking):
  54. id = pokemon_we_are_checking['number']
  55. pokedex_data = get_pokedex_data_by_id(id)
  56. moves_it_can_know = get_valid_movelist(pokedex_data)
  57.  
  58. print("-"*25)
  59. print("Checking: ", pokedex_data['name'])
  60. print("-"*25)
  61.  
  62. for move in pokemon_we_are_checking['moves']:
  63. if move in moves_it_can_know:
  64. print(pokedex_data['name'], 'can learn', move)
  65. else:
  66. print("not legit! ", pokedex_data['name'], "can't learn", move,
  67. 'you dirty, dirty cheating liar! YOU SIT ON A THRONE OF LIES!!!!')
  68. return
  69. print("Hot diggity doughnuts, that's one legit pokeman you have there, yeee haawwwww!!!")
  70.  
  71. return
  72.  
  73.  
  74. is_legit_or_has_2_quit_the_sequel(
  75. {
  76. 'number': 25,
  77. 'moves': ['quick-attack', 'thunder', 'tail-whip']
  78. }
  79. )
  80. is_legit_or_has_2_quit_the_sequel(
  81. {
  82. 'number': 25,
  83. 'moves': ['quick-attack', 'thunder', 'tail-whip', 'hyper-beam']
  84. }
  85. )
  86. is_legit_or_has_2_quit_the_sequel(
  87. {
  88. 'number': 149,
  89. 'moves': ['slam', 'thunder', 'fly', 'hyper-beam']
  90. }
  91. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement