MCPcopy
hub / github.com/PokemonGoF/PokemonGo-Bot / __init__

Method __init__

pokemongo_bot/inventory.py:955–1037  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

953
954class Pokemon(object):
955 def __init__(self, data):
956 self._data = data
957 # Unique ID for this particular Pokemon
958 self.unique_id = data.get('id', 0)
959 # Let's try this
960 self.encounter_id = data.get('encounter_id')
961 # Id of the such pokemons in pokedex
962 self.pokemon_id = data['pokemon_id']
963 # Static information
964 self.static = Pokemons.data_for(self.pokemon_id)
965
966 # Shiny information
967 self.display_data = data.get('pokemon_display')
968 self.shiny = self.display_data.get('shiny', False)
969 # self.form = self.display_data.get('form', )
970
971 # Combat points value
972 self.cp = data['cp']
973 # Base CP multiplier, fixed at the catch time
974 self.cp_bm = data['cp_multiplier']
975 # Changeable part of the CP multiplier, increasing at power up
976 self.cp_am = data.get('additional_cp_multiplier', .0)
977 # Resulting CP multiplier
978 self.cp_m = self.cp_bm + self.cp_am
979
980 # Current pokemon level (half of level is a normal value)
981 self.level = LevelToCPm.level_from_cpm(self.cp_m)
982
983 if 'level' not in self._data:
984 self._data['level'] = self.level
985
986 # Maximum health points
987 self.hp_max = data['stamina_max']
988 # Current health points
989 self.hp = data.get('stamina', 0) #self.hp_max)
990 assert 0 <= self.hp <= self.hp_max
991
992 # Individial Values of the current specific pokemon (different for each)
993 self.iv_attack = data.get('individual_attack', 0)
994 self.iv_defense = data.get('individual_defense', 0)
995 self.iv_stamina = data.get('individual_stamina', 0)
996
997 # Basic Values of the pokemon (identical for all pokemons of one kind)
998 base_attack = self.static.base_attack
999 base_defense = self.static.base_defense
1000 base_stamina = self.static.base_stamina
1001
1002 self.name = self.static.name
1003 self.nickname_raw = data.get('nickname', '')
1004 self.nickname = self.nickname_raw or self.name
1005
1006 self.in_fort = 'deployed_fort_id' in data
1007 if 'deployed_fort_id' in data:
1008 self.fort_id = data['deployed_fort_id']
1009
1010 self.is_favorite = data.get('favorite', 0) is 1
1011 self.buddy_candy = data.get('buddy_candy_awarded', 0)
1012 self.is_bad = data.get('is_bad', False)

Callers

nothing calls this directly

Calls 7

_get_movesetMethod · 0.95
_calc_cpFunction · 0.85
level_from_cpmMethod · 0.80
getMethod · 0.45
data_forMethod · 0.45

Tested by

no test coverage detected