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)
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)
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)