def handle_incoming_challenge(self, user, generation, n, team_length): #too lazy to handle n > 1 or non 6 challenges if n > 1 or team_length != 6: self.reject_challenge(user) else: file = TEAM_DIR + TEAMS[random.randint(0, len(TEAMS) - 1)] file = os.path.normpath(file) team = parsers.parse_team_file(file) self.challenges[user] = file self.accept_challenge(user, team)
def __init__(self, fid, handler, party, opponent, team): self.fid = fid self.handler = handler self.party = party self.opponent = opponent self.teams = [[], []] self.teams[party] = parsers.parse_team_file(team) for i in range(6): self.teams[party - 1].append(Pokemon(moves=[])) self.active = [0, 0]
def handle_finalise_challenge(self, user, accepted): if accepted == 1: self.client.isInBattle = 1 msg = OutMessage(8) msg.write_string(user) file = TEAM_DIR + TEAMS[random.randint(0, len(TEAMS) - 1)] file = os.path.normpath(file) team = parsers.parse_team_file(file) self.challenges[user] = file self.write_team(msg, team) self.client.send(msg)
def __init__(self, fid, handler, party, opponent, team): self.fid = fid self.handler = handler self.party = party self.opponent = opponent self.teams = [[], []] self.teams[party] = parsers.parse_team_file(team) for i in range(6): self.teams[party - 1].append(Pokemon(moves=[])) self.active = [0, 0] #For use with the Expert System AI. self.moves_used = [0, 0, [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]
def handle_incoming_challenge(self, user, generation, n, team_length): file = TEAM_DIR + TEAMS[random.randint(0, len(TEAMS) - 1)] file = os.path.normpath(file) team = parsers.parse_team_file(file) self.challenges[user] = file self.accept_challenge(user, team)