예제 #1
0
    def choose_target_enemy(self, targets):
        if len(targets) == 0:
            raise Exception("No targets")

        if not self.current_trade:
            return Util.rand_el(targets)
            # raise Exception("No current trade")

        for target in targets:
            if self.current_trade.opp_minion == target:
                return target

        # raise Exception("Could not find target {}".format(target))
        return Util.rand_el(targets)
예제 #2
0
    def choose_target_enemy(self, all_targets):
        if len(all_targets) == 0:
            raise Exception("No targets")

        targets = self.prune_targets(all_targets, False)
        if len(targets) == 0:
            return Util.rand_el(all_targets)

        if not self.current_trade:
            return Util.rand_prefer_minion(targets)
            # raise Exception("No current trade")

        for target in targets:
            if self.current_trade.opp_minion == target:
                return target

        # raise Exception("Could not find target {}".format(target))
        return Util.rand_prefer_minion(targets)
예제 #3
0
    def choose_target_friendly(self, targets):
        pruned = self.prune_targets(targets, True)
        if len(pruned) == 0:
            return Util.rand_el(targets)

        return Util.rand_el(pruned)
예제 #4
0
    def choose_target_friendly(self, targets):
        pruned = self.prune_targets(targets, True)
        if len(pruned) == 0:
            return Util.rand_el(targets)

        return Util.rand_el(pruned)