Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import random
- import pprint
- class pokeman():
- name = ""
- moves = []
- def __init__(self, name, moves):
- self.name = name
- for move in moves:
- self.moves.append(move['move']['name'])
- def talk(self):
- print(self.name[:5]+'-'+self.name[:4])
- def showmeyourmoves(self):
- print("{},{},{},{}".format(random.choice(self.moves),random.choice(self.moves),random.choice(self.moves),random.choice(self.moves)))
- def is_legit_or_has_2_quit(pokemon_data_from_the_internet):
- id = pokemon_data_from_the_internet['number']
- moves_they_claim_it_has = pokemon_data_from_the_internet['moves']
- data = requests.get('http://pokeapi.co/api/v2/pokemon/{}'.format(id))
- pokemon_data_from_the_internet = data.json()
- move_list_from_the_internet = pokemon_data_from_the_internet['moves']
- for move_we_are_checkin_out in moves_they_claim_it_has:
- for move_data in move_list_from_the_internet:
- move_name = move_data['move']['name']
- if move_we_are_checkin_out == move_name:
- print(move_we_are_checkin_out, move_name)
- break
- else:
- 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!!!!')
- return
- def get_pokedex_data_by_id(id):
- data = requests.get('http://pokeapi.co/api/v2/pokemon/{}'.format(id))
- pokemon_data_from_the_internet = data.json()
- return pokemon_data_from_the_internet
- def get_valid_movelist(data):
- results = []
- for move in data['moves']:
- results.append(move['move']['name'])
- return results
- def is_legit_or_has_2_quit_the_sequel(pokemon_we_are_checking):
- id = pokemon_we_are_checking['number']
- pokedex_data = get_pokedex_data_by_id(id)
- moves_it_can_know = get_valid_movelist(pokedex_data)
- print("-"*25)
- print("Checking: ", pokedex_data['name'])
- print("-"*25)
- for move in pokemon_we_are_checking['moves']:
- if move in moves_it_can_know:
- print(pokedex_data['name'], 'can learn', move)
- else:
- print("not legit! ", pokedex_data['name'], "can't learn", move,
- 'you dirty, dirty cheating liar! YOU SIT ON A THRONE OF LIES!!!!')
- return
- print("Hot diggity doughnuts, that's one legit pokeman you have there, yeee haawwwww!!!")
- return
- is_legit_or_has_2_quit_the_sequel(
- {
- 'number': 25,
- 'moves': ['quick-attack', 'thunder', 'tail-whip']
- }
- )
- is_legit_or_has_2_quit_the_sequel(
- {
- 'number': 25,
- 'moves': ['quick-attack', 'thunder', 'tail-whip', 'hyper-beam']
- }
- )
- is_legit_or_has_2_quit_the_sequel(
- {
- 'number': 149,
- 'moves': ['slam', 'thunder', 'fly', 'hyper-beam']
- }
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement