def create_trainer(): tc = trainer_class(pokemon_trainer_dict) pokedex_dict = {'creator': "The Professor", 'version': "1.0", 'mode': "Local", 'max entries': 150, 'seen': 0, 'obtained': 0, 'local entries': dict(), 'national entries': dict()} player_dict = {'name': 'Stefan', 'gender': 'Male', 'age': 23, 'region': 'Orre', 'hometown': 'Gateon Port', 'height': "{}\'{}\"".format(5,11),'weight': "{} lbs.".format(185), 'trainer class': trainer_class(pokemon_trainer_dict), 'trainer id': generate_id(), 'pokedex': None, 'party': [], 'badges': {}, 'money': 3000, 'is player': True, 'wins': 0, 'losses': 0, 'draws': 0 } player = trainer(trainer_dict=player_dict) player.pokedex = pokedex(dex_dict=pokedex_dict, trainer=player) player.inventory = set_inventory(player) return player
def create_trainer_2(): tc = trainer_class(pokemon_trainer_dict) pokedex_dict = { 'creator': "The Professor", 'version': "1.0", 'mode': "Local", 'max entries': 150, 'seen': 0, 'obtained': 0, 'local entries': dict(), 'national entries': dict() } player_dict = { 'name': 'Karl', 'gender': 'Male', 'age': 21, 'region': 'Orre', 'hometown': 'Gateon Port', 'height': "{}\'{}\"".format(6, 1), 'weight': "{} lbs.".format(175), 'trainer class': trainer_class(pokemon_trainer_dict), 'trainer id': generate_id(), 'pokedex': None, 'party': [], 'badges': {}, 'money': 3000, 'is player': True, 'wins': 0, 'losses': 0, 'draws': 0 } player = trainer(trainer_dict=player_dict) player.pokedex = pokedex(dex_dict=pokedex_dict, trainer=player) inv = inventory(inv_dict=test_inv_dict) inv.set_owner(player) player.inventory = set_inventory(trainer=player) #player.capture_pokemon(pokemon(gd=squirtle_d)._randomize_vital_statistics(set_level=5)) return player
def create_trainer_2(): tc = trainer_class(pokemon_trainer_dict) pokedex_dict = {'creator': "The Professor", 'version': "1.0", 'mode': "Local", 'max entries': 150, 'seen': 0, 'obtained': 0, 'local entries': dict(), 'national entries': dict()} player_dict = {'name': 'Karl', 'gender': 'Male', 'age': 21, 'region': 'Orre', 'hometown': 'Gateon Port', 'height': "{}\'{}\"".format(6,1),'weight': "{} lbs.".format(175), 'trainer class': trainer_class(pokemon_trainer_dict), 'trainer id': generate_id(), 'pokedex': None, 'party': [], 'badges': {}, 'money': 3000, 'is player': True, 'wins': 0, 'losses': 0, 'draws': 0 } player = trainer(trainer_dict=player_dict) player.pokedex = pokedex(dex_dict=pokedex_dict, trainer=player) inv = inventory(inv_dict=test_inv_dict) inv.set_owner(player) player.inventory = set_inventory(trainer=player) #player.capture_pokemon(pokemon(gd=squirtle_d)._randomize_vital_statistics(set_level=5)) return player
def create_trainer(): tc = trainer_class(pokemon_trainer_dict) pokedex_dict = { 'creator': "The Professor", 'version': "1.0", 'mode': "Local", 'max entries': 150, 'seen': 0, 'obtained': 0, 'local entries': dict(), 'national entries': dict() } player_dict = { 'name': 'Stefan', 'gender': 'Male', 'age': 23, 'region': 'Orre', 'hometown': 'Gateon Port', 'height': "{}\'{}\"".format(5, 11), 'weight': "{} lbs.".format(185), 'trainer class': trainer_class(pokemon_trainer_dict), 'trainer id': generate_id(), 'pokedex': None, 'party': [], 'badges': {}, 'money': 3000, 'is player': True, 'wins': 0, 'losses': 0, 'draws': 0 } player = trainer(trainer_dict=player_dict) player.pokedex = pokedex(dex_dict=pokedex_dict, trainer=player) player.inventory = set_inventory(player) return player
def set_trainer_from_dict(self,trainer_dict=None): if trainer_dict is None: return False # mandatory information self.name = trainer_dict.get('name') self.trainer_class = trainer_dict.get('trainer class') self.trainer_id = trainer_dict.get('trainer id') self.money = trainer_dict.get('money') # safe to assume information if trainer_dict.get('gender') is not None: self.gender = trainer_dict.get('gender') else: # RANDOM GENDER roll = randint(0,1) if roll == 0: self.gender = constants.male else: self.gender = constants.female if trainer_dict.get('is player') is not None: self.is_player = True else: # ELSE ASSUME IS NPC self.is_player = False if trainer_dict.get('party') is not None: self.party = trainer_dict.get('party') else: # SET AS EMPTY self.party = [] if trainer_dict.get('inventory') is not None: self.inventory = trainer_dict.get('inventory') else: # SET AS NEW self.inventory = inventory() self.inventory.set_owner(self) if trainer_dict.get('pokedex') is not None: self.pokedex = trainer_dict.get('pokedex') self.pokedex.set_license(self) else: # SET AS NEW self.pokedex = pokedex() self.pokedex.set_license(self) if trainer_dict.get('storage') is not None: self.storage = trainer_dict.get('storage') else: # SET AS NEW self.storage = inventory() # Non key information if trainer_dict.get('region') is not None: self.region_of_origin = trainer_dict.get('region') else: self.region_of_origin = "" if trainer_dict.get('hometown') is not None: self.hometown = trainer_dict.get('hometown') else: self.hometown = None if trainer_dict.get('age') is not None: self.age = trainer_dict.get('age') else: self.age = randint(10,30) if trainer_dict.get('height') is not None: self.height = trainer_dict.get('height') else: self.height = "" if trainer_dict.get('weight') is not None: self.weight = trainer_dict.get('weight') else: self.weight = "" if trainer_dict.get('badges') is not None: self.badges = trainer_dict.get('badges') else: self.badges = {1:None} if trainer_dict.get('wins') is not None: self.wins = trainer_dict.get('wins') else: self.wins = 0 if trainer_dict.get('losses') is not None: self.losses = trainer_dict.get('losses') else: self.losses = 0 if trainer_dict.get('draws') is not None: self.draws = trainer_dict.get('draws') else: self.draws = 0