Esempio n. 1
0
    def get_target(self):
        # defender heroe
        if len(self.hero.attackers) > 0 and (self.target
                                             not in self.hero.attackers):
            for posible in self.hero.attackers:
                if (closest_distance(self.vertices, posible.vertices) <
                        self.attack_range):
                    return posible

        # atacar minionG, minionN, hero
        posibleN = None
        posibleHero = None
        for obj in self.targets:
            if (closest_distance(self.vertices, obj.vertices) <
                    self.attack_range):
                if obj.tipo == 'MinionG':
                    return obj
                elif obj.tipo == 'MinionN':
                    posibleN = obj
                else:
                    posibleHero = obj

        if posibleN:
            return posibleN
        elif posibleHero:
            return posibleHero

        return None
Esempio n. 2
0
    def get_target(self):

        if len(self.targets) != 0:
            attack_inhi = True
            ordenados = nearest(self.targets, self.vertices)

            for x in ordenados:
                posible = self.targets[x[0]]

                if isinstance(posible, Tower):
                    attack_inhi = False
                    for thread in self.mygame.team_bot:
                        if isinstance(thread, Minion):
                            if thread.target == posible:
                                return posible
                else:
                    if isinstance(posible, Inhibidor) and not attack_inhi:
                        continue

                    for thread in self.mygame.team_bot:
                        if (closest_distance(self.vertices, thread.vertices) <
                                self.attack_range) and thread.id != self.id:
                            return posible

                    if self.life >= 0.2 * self.tot_life:
                        return posible
                    if (self.damage > posible.damage
                            and self.life > posible.life):
                        return posible

        return self.mygame.nexo
Esempio n. 3
0
 def ciclo(self):
     d = closest_distance(self.player.vertices, self.vertices)
     if d <= self.buy_range or not self.player.alive:
         self.allowed = True
         self.avisar_signal.emit(True)
     else:
         self.allowed = False
         self.avisar_signal.emit(False)
Esempio n. 4
0
def lifesteal(target, hero):
    d = closest_distance(hero.vertices, target.vertices)
    if d <= hero.attack_range:
        target.downlife = 5
        hero.uplife = 5
        hero.sa_time = 0
        hero.mygame.sa_request(hero)
    else:
        hero.waiting_sa = True
        hero.left_click(target)
Esempio n. 5
0
    def get_target(self):
        # defender heroe
        if len(self.hero.attackers) > 0:
            for attacker in self.hero.attackers:
                if (closest_distance(self.vertices, attacker.vertices) <
                        self.attack_range):
                    return attacker

        # atacar mas cercano
        if len(self.targets) != 0:
            nro, dist = nearest(self.targets, self.vertices)[0]

            if dist < self.attack_range + 100:
                return self.targets[nro]
            elif self.inhi.alive:
                return self.inhi

        return self.nexo
Esempio n. 6
0
def earthquake(team_enemigo, hero):
    for thread in team_enemigo:
        d = closest_distance(hero.vertices, thread.vertices)
        if d <= 70:
            if thread.tipo in ['Tower', 'Nexo', 'Inhibidor']:
                thread.receive_dmg(thread)

            elif d <= 30:
                pos_t = thread.center
                pos_h = hero.center
                dist = (30 * 5 / 2) / (2**0.5)
                if pos_t[0] >= pos_h[0] and pos_t[1] >= pos_h[1]:
                    thread.pos = (pos_t[0] + dist, pos_t[1] + dist)
                elif pos_t[0] >= pos_h[0] and pos_t[1] < pos_h[1]:
                    thread.pos = (pos_t[0] + dist, pos_t[1] - dist)
                elif pos_t[0] < pos_h[0] and pos_t[1] < pos_h[1]:
                    thread.pos = (pos_t[0] - dist, pos_t[1] - dist)
                else:
                    thread.pos = (pos_t[0] - dist, pos_t[1] + dist)
    hero.mygame.sa_request(hero)
    hero.sa_time = 0