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

Method __init__

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

Source from the content-addressed store, hash-verified

786 """
787
788 def __init__(self, data):
789 self._data = data
790 self.id = int(data["Number"])
791 self.name = data['Name'] # type: string
792 self.classification = data['Classification'] # type: string
793
794 # prepare types
795 self.type1 = Types.get(data['Type I'][0])
796 self.type2 = None
797 self.types = [self.type1] # required type
798 for t in data.get('Type II', []):
799 self.type2 = Types.get(t)
800 self.types.append(self.type2) # second type
801 break
802
803 # base chance to capture pokemon
804 self.capture_rate = data['CaptureRate']
805 # chance of the pokemon to flee away
806 self.flee_rate = data['FleeRate']
807
808 # km needed for buddy reward
809 self.buddy_distance_needed = data['BuddyDistanceNeeded']
810
811 # prepare attacks (moves)
812 self.fast_attacks = self._process_attacks()
813 self.charged_attack = self._process_attacks(charged=True)
814
815 # prepare movesets
816 self.movesets = self._process_movesets()
817
818 # Basic Values of the pokemon (identical for all pokemons of one kind)
819 self.base_attack = data['BaseAttack']
820 self.base_defense = data['BaseDefense']
821 self.base_stamina = data['BaseStamina']
822
823 # calculate maximum CP for the pokemon (best IVs, lvl 40)
824 self.max_cp = _calc_cp(self.base_attack, self.base_defense,
825 self.base_stamina)
826
827 #
828 # evolutions info for this pokemon
829
830 # id of the very first level evolution
831 self.first_evolution_id = self.id
832 # id of the previous evolution (one level only)
833 self.prev_evolution_id = None
834 # ids of all available previous evolutions in the family
835 self.prev_evolutions_all = []
836 if 'Previous evolution(s)' in data:
837 ids = [int(e['Number']) for e in data['Previous evolution(s)']]
838 self.first_evolution_id = ids[0]
839 self.prev_evolution_id = ids[-1]
840 self.prev_evolutions_all = ids
841
842 # Number of candies for the next evolution (if possible)
843 self.evolution_cost = 0
844 # Next evolution doesn't need a special item
845 self.evolution_item = None

Callers

nothing calls this directly

Calls 4

_process_attacksMethod · 0.95
_process_movesetsMethod · 0.95
_calc_cpFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected