def ciclo(self): if self.team == 'team_player': self.inhibidor = self.mygame.bot_inhibidor self.hero = self.mygame.hero self.targets = self.mygame.team_bot else: self.inhibidor = self.mygame.inhibidor self.hero = self.mygame.hero_bot self.targets = self.mygame.team_player if not self.mygame.pause: self.target = self.get_target() if self.target: if (int(self.i % (self.nro_ciclos / self.attack_speed)) == 0): self.attack(self.target) vangle = angle_mouse(self.target.center, self.center) self.attack_graphic.emit(self.target.center, degrees(vangle), 0, self.tipo, self.id) self.stack_img_attack.append((self.id, 0)) # remover de imagen de ataque if len(self.stack_img_attack) != 0 and self.i % 30 == 0: self.r_attack_graphic.emit(*self.stack_img_attack.pop(0)) self.i += 1 if not self.alive: self.mygame.dead_id(self, False) self.stop()
def left_click(self, target): if target: if self.sa_target != target: self.waiting_sa = False self.target = target self.d, self.angle = get_angle(self.target.vertices, self.vertices) self.vangle = angle_mouse(self.target.center, self.center) if self.waiting_sa and self.d <= self.attack_range: self.mygame.sa_request(self) self.right_click(self.target) self.target = None self.waiting_sa = False
def ciclo(self): # habilidad chau if not self.mygame.pause: if self.freeze > 0: self.freeze -= self.refresh_rate else: # habilidad franky if self.downlife > 0: self.downlife -= self.refresh_rate self.dano_recibido += 1.5 self.dx, self.dy = 0, 0 self.target = self.get_target() d, angle = get_angle(self.target.vertices, self.vertices) vangle = angle_mouse(self.target.center, self.center) if d >= self.attack_range: self.dx = -self.move_speed * self.refresh_rate * cos(angle) self.dy = self.move_speed * self.refresh_rate * sin(angle) else: if (int(self.i % (self.nro_ciclos / self.attack_speed)) == 0): self.attack(self.target) self.atacando = True self.pos = (self.pos[0] + self.dx, self.pos[1] + self.dy) # imagenes if self.i % 2 == 0: if self.dx != 0 and self.dy != 0: self.change_img_signal.emit(self.nro_img, self.id, self.tipo, degrees(vangle), self.team + '_move') self.nro_img += 1 if self.nro_img > 6: self.nro_img = 0 elif not self.atacando or self.img_attack > 3: self.nro_img = 0 self.img_attack = 0 self.atacando = False self.change_img_signal.emit(self.nro_img, self.id, self.tipo, degrees(vangle), self.team + '_move') else: x, y = self.target.center pos = (x - 35, y - 35) if self.tipo == 'MinionN': if self.img_attack == 2: self.attack_graphic.emit( pos, degrees(vangle), 0, self.tipo, self.id) self.stack_img_attack.append((self.id, 0)) text = self.team + '_attack' self.change_img_signal.emit( self.img_attack, self.id, self.tipo, degrees(vangle), text) elif self.tipo == 'MinionG': if self.img_attack == 0: pos = proyectile_pos(self.target.center, self.center, 70) self.attack_graphic.emit(pos, degrees(vangle), self.img_attack, self.tipo, self.id) self.stack_img_attack.append( (self.id, self.img_attack)) self.img_attack += 1 # remover de imagen de ataque if len(self.stack_img_attack) != 0 and self.i % 5 == 0: self.r_attack_graphic.emit(*self.stack_img_attack.pop(0)) self.i += 1 if not self.alive: self.mygame.dead_id(self, False) self.stop()
def set_angle(self, center_obj): if not self.target: self.angle = angle_mouse(center_obj, self.center)
def ciclo(self): self.targets = self.mygame.team_player self.target_hero = self.mygame.hero self.inhibidor = self.mygame.inhibidor if not self.mygame.pause: # habilidad chau if self.freeze > 0: self.freeze -= self.refresh_rate else: # habilidad de franky if self.uplife > 0: self.uplife -= self.refresh_rate self.dano_recibido -= 1.5 self.mod_life_signal.emit(self.id, self.life, self.tot_life) # habilidad de franky if self.downlife > 0: self.downlife -= self.refresh_rate self.dano_recibido += 1.5 self.mod_life_signal.emit(self.id, self.life, self.tot_life) # barra mana self.cooldown_recovery() # eliminar agresores muertos self.elim_dead_attackers() # eliminar target nexo si hay inhibidor self.elim_target_nexo() # revisar quitter if (isinstance(self, RageBot) and self.deaths - self.kills > 3): self.target = None else: if self.escapar > 0: self.escapar -= self.refresh_rate else: self.target = self.get_target() # ataque especial de bot self.sa() self.d, self.angle = get_angle(self.target.vertices, self.vertices) self.vangle = angle_mouse(self.target.center, self.center) if self.d >= self.attack_range: self.dx = -self.move_speed * \ self.refresh_rate*cos(self.angle) self.dy = self.move_speed * self.refresh_rate * sin( self.angle) elif (int(self.i % (self.nro_ciclos / self.attack_speed)) == 0): if self.target != self.mygame.bot_inhibidor: self.atacando = True self.attack(self.target) # aumentar kills if not self.target.alive: if isinstance(self.target, Hero): self.kills += 1 self.pos = (self.pos[0] + self.dx, self.pos[1] + self.dy) # imagenes if self.i % 2 == 0: if self.dx != 0 and self.dy != 0: self.change_img_signal.emit(self.nro_img, self.id, self.tipo, degrees(self.vangle), self.team + '_move') self.nro_img += 1 if self.nro_img > 6: self.nro_img = 0 elif not self.atacando: self.nro_img = 0 self.change_img_signal.emit(self.nro_img, self.id, self.tipo, degrees(self.vangle), self.team + '_move') else: self.change_img_signal.emit(self.img_attack, self.id, self.tipo, degrees(self.vangle), self.team + '_attack') self.img_attack += 1 if self.img_attack > 3: self.img_attack = 0 self.atacando = False # termino imagenes self.dx, self.dy = 0, 0 self.i += 1 if not self.alive: self.mygame.dead_id(self, True) self.deaths += 1 self.stop()