def champ_near_obj(game, champ): soldier_target = skills.soldier_near_obj(game, champ) atk_range = game.player.base_atk_range + game.player.gameplay_radius if soldier_target is not None: return True else: return game.distance(game.player, champ) < atk_range
def find_soldier_minion_target(game): min_health = 9999999999 soldier_target = None for minion in game.minions: soldier = skills.soldier_near_obj(game, minion) if minion.is_visible and minion.is_enemy_to( game.player ) and minion.is_alive and minion.health < min_health and soldier is not None: if skills.is_last_hitable(game, game.player, minion): soldier_target = minion min_health = minion.health return soldier_target
def find_target(self, game, array, range, value_extractor): target = None min = 99999999 val = 0 for obj in array: if not obj.is_alive or not obj.is_visible or obj.is_ally_to( game.player): continue range_calc = (game.distance(game.player, obj) - game.player.gameplay_radius - obj.gameplay_radius) #check if our champ is one of special_orbwalk_champs if game.player.name in self.special_targeting_champs: if game.player.name == "azir": soldier = skills.soldier_near_obj(game, obj) if soldier is not None: range_calc = (game.distance(soldier, obj)) if range_calc > self.special_targeting_champs[ game.player.name]: continue else: if range_calc > range: continue elif game.player.name == "cassiopeia": skillQ = getattr(game.player, 'Q') skillE = getattr(game.player, 'E') useQ = False #TODO: Move Cass Q range value into a data structure if skillQ.get_current_cooldown( game.time) == 0.0 and range_calc < 850.0: useQ = True pass if not useQ and ( skillE.get_current_cooldown(game.time) > 0 or range_calc > self.special_targeting_champs[game.player.name]): continue val = value_extractor(game.player, obj) if val < min: min = val target = obj return target
def find_soldier_minion_target(game): soldier_affect_range = 650.0 soldier_radius = 325.0 min_health = 9999999999 soldier_target = None for minion in game.minions: soldier = skills.soldier_near_obj(game, minion) if minion.is_visible and minion.is_enemy_to( game.player ) and minion.is_alive and minion.health < min_health and soldier is not None: #game.draw_circle_world(minion.pos, 48.0, 16, 3, Color.BLUE) if skills.is_last_hitable(game, game.player, minion): soldier_target = minion min_health = minion.health return soldier_target
def get_target(game, last_hit_prio): global auto_last_hit global target global special_orbwalk_champs atk_range = game.player.base_atk_range + game.player.gameplay_radius if target is not None and ( not target.is_visible or not target.is_alive or (skills.soldier_near_obj(game, target) is None and game.distance(game.player, target) > atk_range)): target = None if target is not None: if not last_hit_prio: if not target.has_tags(UnitTag.Unit_Champion): #since last target is valid but it isn't a champion and we're focusing on harass then we're allowed to overwrite target only if we can find a champion in range for champ in game.champs: if champ_near_obj(game, champ): target = targeting.get_target(game, atk_range) else: target = None elif not last_hit_prio: target = targeting.get_target(game, atk_range) if not target and auto_last_hit: if game.player.name in special_orbwalk_champs: if game.player.name == "azir": soldier = skills.is_soldier_alive(game) #only need to know if > 0 soldiers are up if soldier is not None: target = find_soldier_minion_target(game) elif game.player.name == "cassiopeia": target = find_minion_target(game, 711.0) if not target: target = find_minion_target( game, game.player.base_atk_range + game.player.gameplay_radius) #Unused for now, only use V for last hitting, don't expect V to harass champs # if not target and last_hit_prio: # target = targeting.get_target(game, atk_range) return target
def lview_update(game, ui): global last_attacked, last_cass_q, alternate, last_moved global key_attack_move, key_orbwalk, key_lasthit, max_atk_speed global toggle_mode, toggled global target global special_orbwalk_champs if toggle_mode: if game.was_key_pressed(key_orbwalk): toggled = not toggled if not toggled: return elif not game.is_key_down(key_orbwalk) and not game.is_key_down( key_lasthit): return last_hit_priority = False if game.is_key_down(key_lasthit): last_hit_priority = True #Show orbwalk target if target is not None: game.draw_circle_world(target.pos, 24.0, 16, 3, Color.WHITE) #Use if you need to prevent orbwalker from interrupting your key presses: # for key in key_whitelist.items(): # if game.was_key_pressed(key): # last_attacked = time.time() self = game.player #Handle basic attacks atk_speed = self.base_atk_speed * self.atk_speed_multi b_windup_time = ((1.0 / self.base_atk_speed) * game.player.basic_atk_windup) c_atk_time = (1.0 / atk_speed) max_atk_time = 1.0 / max_atk_speed t = time.time() soldier_hitting = False #NEWWY DEWWY target = get_target(game, last_hit_priority) if game.player.name in special_orbwalk_champs: if game.player.name == "azir": if target: soldier = skills.soldier_near_obj(game, target) if soldier is not None: soldier_hitting = True elif game.player.name == "cassiopeia": if target: skillQ = getattr(game.player, 'Q') skillE = getattr(game.player, 'E') abilityHastePercent = (100 - 100 / ( (1 / 100) * game.player.ability_haste + 1)) / 100 if t - last_cass_q >= ( 3.50 - (3.50 * abilityHastePercent) ) and skillQ.get_current_cooldown( game.time) == 0 and game.player.mana > (50.0 + (10 * ( skillQ.level - 1))) and target and target.has_tags( UnitTag.Unit_Champion) and game.distance( game.player, target) < 850.0: last_cass_q = t cassQ(game, target) if t - last_attacked >= ( 0.75 - (0.75 * abilityHastePercent) ) and skillE.get_current_cooldown( game.time ) == 0 and game.player.mana > 50.0 and target and game.distance( game.player, target) < 711.0: last_attacked = t cassE(game, target) if t - last_attacked >= max(c_atk_time, max_atk_time) and target and ( (game.distance(game.player, target) < self.base_atk_range + self.gameplay_radius - target.gameplay_radius) or soldier_hitting): last_attacked = t cast_point = game.world_to_screen(target.pos) cursor_pos = game.get_cursor() game.move_cursor(cast_point) game.press_right_click() time.sleep(0.01) game.move_cursor(cursor_pos) elif t - last_attacked >= b_windup_time and t - last_moved > 0.08: last_moved = t game.press_right_click()