public static bool enemIsOnMe(Obj_AI_Base target) { if (target.IsAlly || target.IsDead || !target.IsValidTarget()) { return(false); } float distTo = target.Distance(player, true); bool dangerousAround = (balance < -player.HealthPercent); float targetReack = (!dangerousAround)?player.AttackRange + 150:MapControl.getByObj(target).getReach(); if (distTo > targetReack * targetReack) { return(false); } var per = target.Direction.To2D().Perpendicular(); var dir = new Vector3(per, 0); var enemDir = target.Position + dir * 40; if (target.Distance(fromNex.Position, true) < enemDir.Distance(fromNex.Position, true)) { return(false); } return(true); }
public static bool enemIsOnMe(MapControl.ChampControl targetChamp) { var target = targetChamp.hero; if (target.IsAlly || target.IsDead || !target.IsValidTarget()) { return(false); } if (player.HealthPercent > 40 && !target.IsFacing(player)) { return(false); } if (player.HealthPercent > 50 && targetChamp.lastAttackedUnitId != player.NetworkId) { return(false); } float distTo = target.Distance(player, true); bool dangerousAround = (balance < -player.HealthPercent); float targetReack = (!dangerousAround)?player.AttackRange + 150:MapControl.getByObj(target).getReach(); if (distTo > targetReack * targetReack) { return(false); } var per = target.Direction.To2D().Perpendicular(); var dir = new Vector3(per, 0); var enemDir = target.Position + dir * 40; if (target.Distance(fromNex.Position, true) < enemDir.Distance(fromNex.Position, true)) { return(false); } return(true); }