Example #1
0
        private void Interrupter2_OnInterruptableTarget(Obj_AI_Hero sender, Interrupter2.InterruptableTargetEventArgs args)
        {
            var Rint = MenuProvider.Champion.Misc.getBoolValue("UseInterrupter");

            if (!MenuProvider.Champion.Misc.getBoolValue("UseInterrupter") || Player.IsDead)
                return;

            if (Rint && args.DangerLevel >= Interrupter2.DangerLevel.High && sender.IsValidTarget(R.Range) && sender.IsFacing(Player))
                R.CastOnBestTarget(0f, false, true);
        }
Example #2
0
 public static void Insec(Obj_AI_Hero target)
 {
     Rpos = Player.Position.To2D().Extend(target.Position.To2D(), Player.Distance(target) + 250);
     if (Rpos.Distance(Player.Position) <= R.Range)
     {
         if (Player.Distance(Rpos.Extend(target.Position.To2D(), 700 - target.Distance(Rpos))) < E.Range && !IsWall(Rpos.To3D()) && target.IsFacing(Player))
         {
             R.Cast(Rpos);
         }
     }
 }
Example #3
0
        /// <summary>
        ///     Called on interruptable spell.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="Interrupter2.InterruptableTargetEventArgs" /> instance containing the event data.</param>
        public static void OnInterruptableTarget(Obj_AI_Hero sender, Interrupter2.InterruptableTargetEventArgs args)
        {
            if (ObjectManager.Player.IsDead
                || TargetSelector.IsInvulnerable(sender, TargetSelector.DamageType.Magical, false))
            {
                return;
            }

            if (Variables.R.IsReady() && sender.IsValidTarget(Variables.R.Range)
                && sender.IsFacing(ObjectManager.Player) && Variables.RMenu.Item("interrupter").IsActive())
            {
                Variables.R.Cast(sender.ServerPosition);
            }
        }
Example #4
0
        public static bool CastQ(Obj_AI_Hero target)
        {
            var qPrediction = Q.GetPrediction(target);

            if(qPrediction.Hitchance < HitChance.VeryHigh)
            {
                return false;
            }

            if(EIsReady)
            {
                var directTravelTime = BallManager.BallPosition.Distance(qPrediction.CastPosition) / Q.Speed;
                var bestEQTravelTime = float.MaxValue;

                Obj_AI_Hero eqTarget = null;

                foreach (var ally in HeroManager.Allies.Where(h => h.IsValidTarget(E.Range, false)))
                {
                    var t = BallManager.BallPosition.Distance(ally.ServerPosition) / E.Speed + ally.Distance(qPrediction.CastPosition) / Q.Speed;
                    if(t < bestEQTravelTime)
                    {
                        eqTarget = ally;
                        bestEQTravelTime = t;
                    }
                }

                if (eqTarget != null && bestEQTravelTime < directTravelTime * 1.3f && (BallManager.BallPosition.Distance(eqTarget.ServerPosition, true) > 10000))
                {
                    E.CastOnUnit(eqTarget, true);
                    return true;
                }
            }

            if (!target.IsFacing(Player) && target.Path.Count() >= 1) // target is running
            {
                var targetBehind = Q.GetPrediction(target).CastPosition +
                                   Vector3.Normalize(target.ServerPosition - BallManager.BallPosition) * target.MoveSpeed / 2;
                Q.Cast(targetBehind, true);
                return true;
            }

            Q.Cast(qPrediction.CastPosition, true);
            return true;
        }
Example #5
0
        private float CalcComboDamage(Obj_AI_Hero target, bool q, bool w, bool e, bool r)
        {
            try
            {
                if (target == null)
                {
                    return 0;
                }
                var manaCost = (w && W.IsReady() ? W.Instance.ManaCost : (q ? Q.Instance.ManaCost : 0)) * 2;
                var damage = (w && W.IsReady() ? W.GetDamage(target) : (q ? Q.GetDamage(target) : 0)) * 2;

                if (e)
                {
                    var eMana = E.Instance.ManaCost;
                    var eDamage = E.GetDamage(target);
                    var count = target.IsNearTurret() && !target.IsFacing(Player) ||
                                target.IsNearTurret() && Player.HealthPercent <= 35 || !R.IsReady()
                        ? 5
                        : 10;
                    for (var i = 0; i < count; i++)
                    {
                        if (manaCost + eMana > Player.Mana)
                        {
                            break;
                        }
                        manaCost += eMana;
                        damage += eDamage;
                    }
                }
                if (r)
                {
                    if (manaCost + R.Instance.ManaCost - 10 > Player.Mana)
                    {
                        return damage;
                    }
                    return damage + (R.IsReady() ? R.GetDamage(target) : 0);
                }
                damage += ItemManager.CalculateComboDamage(target);
                damage += SummonerManager.CalculateComboDamage(target);
                return damage;
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return 0;
        }
Example #6
0
        private static void CastSpell(Spell QWER, Obj_AI_Hero target, int HitChanceNum)
        {
            //HitChance 0 - 2
            // example CastSpell(Q, ts, 2);
            var poutput = QWER.GetPrediction(target);
            var col = poutput.CollisionObjects.Count(ColObj => ColObj.IsEnemy && ColObj.IsMinion && !ColObj.IsDead);
            if (QWER.Collision && col > 0)
                return;
            if (HitChanceNum == 0)
                QWER.Cast(target, true);
            else if (HitChanceNum == 1)
            {
                if ((int)poutput.Hitchance > 4)
                    QWER.Cast(poutput.CastPosition);
            }
            else if (HitChanceNum == 2)
            {
                if ((target.IsFacing(ObjectManager.Player) && (int)poutput.Hitchance == 5) || (target.Path.Count() == 0 && target.Position == target.ServerPosition))
                {
                    if (ObjectManager.Player.Distance(target.Position) < QWER.Range - ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.Position) / QWER.Speed) + (target.BoundingRadius * 2)))
                    {
                        QWER.Cast(poutput.CastPosition);
                    }
                }
                else if ((int)poutput.Hitchance == 5)
                {
                    QWER.Cast(poutput.CastPosition);
                }
            }
            else if (HitChanceNum == 3)
            {
                List<Vector2> waypoints = target.GetWaypoints();
                float SiteToSite = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed)) * 6 - QWER.Width;
                float BackToFront = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed));
                if (ObjectManager.Player.Distance(waypoints.Last<Vector2>().To3D()) < SiteToSite || ObjectManager.Player.Distance(target.Position) < SiteToSite)
                    QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                else if (target.Path.Count() < 2
                    && (target.ServerPosition.Distance(waypoints.Last<Vector2>().To3D()) > SiteToSite
                    || Math.Abs(ObjectManager.Player.Distance(waypoints.Last<Vector2>().To3D()) - ObjectManager.Player.Distance(target.Position)) > BackToFront
                    || target.HasBuffOfType(BuffType.Slow) || target.HasBuff("Recall")
                    || (target.Path.Count() == 0 && target.Position == target.ServerPosition)
                    ))
                {
                    if (target.IsFacing(ObjectManager.Player) || target.Path.Count() == 0)
                    {
                        if (ObjectManager.Player.Distance(target.Position) < QWER.Range - ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.Position) / QWER.Speed) + (target.BoundingRadius * 2)))
                            QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                    }
                    else
                    {
                        QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                    }
                }
            }
            else if (HitChanceNum == 4 && (int)poutput.Hitchance > 4)
            {

                List<Vector2> waypoints = target.GetWaypoints();
                float SiteToSite = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed)) * 6 - QWER.Width;
                float BackToFront = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed));
                if (ObjectManager.Player.Distance(waypoints.Last<Vector2>().To3D()) < SiteToSite || ObjectManager.Player.Distance(target.Position) < SiteToSite)
                    QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                else if (target.Path.Count() < 2
                    && (target.ServerPosition.Distance(waypoints.Last<Vector2>().To3D()) > SiteToSite
                    || Math.Abs(ObjectManager.Player.Distance(waypoints.Last<Vector2>().To3D()) - ObjectManager.Player.Distance(target.Position)) > BackToFront
                    || target.HasBuffOfType(BuffType.Slow) || target.HasBuff("Recall")
                    || (target.Path.Count() == 0 && target.Position == target.ServerPosition)
                    ))
                {
                    // max range fix
                    if (target.IsFacing(ObjectManager.Player) || target.Path.Count() == 0)
                    {
                        if (ObjectManager.Player.Distance(target.Position) < QWER.Range - ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.Position) / QWER.Speed) + (target.BoundingRadius * 2)))
                            QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                    }
                    else
                    {
                        QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                    }
                }
            }
        }
Example #7
0
        Vector3 GetTumblePos(Obj_AI_Hero target)
        {
            //if the target is not a melee and he's alone he's not really a danger to us, proceed to 1v1 him :^ )
            if (!target.IsMelee && Heroes.Player.CountEnemiesInRange(800) == 1) return Game.CursorPos;

            var aRC = new Utils.Geometry.Circle(Heroes.Player.ServerPosition.To2D(), 300).ToPolygon().ToClipperPath();
            var cP = Game.CursorPos;
            var tP = target.ServerPosition;
            var pList = new List<Vector3>();
            var additionalDistance = (0.106 + Game.Ping / 2000f) * target.MoveSpeed;

            if ((!cP.IsWall() && !cP.UnderTurret(true) && cP.Distance(tP) > 325 && cP.Distance(tP) < 550 &&
                 (cP.CountEnemiesInRange(425) <= cP.CountAlliesInRange(325)))) return cP;

            foreach (var p in aRC)
            {
                var v3 = new Vector2(p.X, p.Y).To3D();

                if (target.IsFacing(Heroes.Player))
                {
                    if (!v3.IsWall() && !v3.UnderTurret(true) && v3.Distance(tP) > 325 && v3.Distance(tP) < 550 &&
                        (v3.CountEnemiesInRange(425) <= v3.CountAlliesInRange(325))) pList.Add(v3);
                }
                else
                {
                    if (!v3.IsWall() && !v3.UnderTurret(true) && v3.Distance(tP) > 325 &&
                        v3.Distance(tP) < (550 - additionalDistance) &&
                        (v3.CountEnemiesInRange(425) <= v3.CountAlliesInRange(325))) pList.Add(v3);
                }
            }
            if (Heroes.Player.UnderTurret() || Heroes.Player.CountEnemiesInRange(800) == 1)
            {
                return pList.Count > 1 ? pList.OrderBy(el => el.Distance(cP)).FirstOrDefault() : Vector3.Zero;
            }
            return pList.Count > 1 ? pList.OrderByDescending(el => el.Distance(tP)).FirstOrDefault() : Vector3.Zero;
        }
Example #8
0
        private static void CastSpell(Spell QWER, Obj_AI_Hero target, int HitChanceNum)
        {
            //HitChance 0 - 2
            // example CastSpell(Q, ts, 2);
            if (HitChanceNum == 0)
                QWER.Cast(target, true);
            else if (HitChanceNum == 1)
                QWER.CastIfHitchanceEquals(target, HitChance.VeryHigh, true);
            else if (HitChanceNum == 2)
            {
                if (QWER.Delay < 0.3)
                    QWER.CastIfHitchanceEquals(target, HitChance.Dashing, true);
                QWER.CastIfHitchanceEquals(target, HitChance.Immobile, true);
                QWER.CastIfWillHit(target, 2, true);
                if (target.Path.Count() < 2)
                    QWER.CastIfHitchanceEquals(target, HitChance.VeryHigh, true);
            }
            else if (HitChanceNum == 3)
            {
                List<Vector2> waypoints = target.GetWaypoints();
                //debug("" + target.Path.Count() + " " + (target.Position == target.ServerPosition) + (waypoints.Last<Vector2>().To3D() == target.ServerPosition));
                if (QWER.Delay < 0.3)
                    QWER.CastIfHitchanceEquals(target, HitChance.Dashing, true);
                QWER.CastIfHitchanceEquals(target, HitChance.Immobile, true);
                QWER.CastIfWillHit(target, 2, true);

                float SiteToSite = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed)) * 6 - QWER.Width;
                float BackToFront = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed));
                if (ObjectManager.Player.Distance(waypoints.Last<Vector2>().To3D()) < SiteToSite || ObjectManager.Player.Distance(target.Position) < SiteToSite)
                    QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                else if (target.Path.Count() < 2
                    && (target.ServerPosition.Distance(waypoints.Last<Vector2>().To3D()) > SiteToSite
                    || Math.Abs(ObjectManager.Player.Distance(waypoints.Last<Vector2>().To3D()) - ObjectManager.Player.Distance(target.Position)) > BackToFront
                    || target.HasBuffOfType(BuffType.Slow) || target.HasBuff("Recall")
                    || (target.Path.Count() == 0 && target.Position == target.ServerPosition)
                    ))
                {
                    if (target.IsFacing(ObjectManager.Player) || target.Path.Count() == 0)
                    {
                        if (ObjectManager.Player.Distance(target.Position) < QWER.Range - ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.Position) / QWER.Speed)))
                            QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                    }
                    else
                    {
                        QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                    }
                }
            }
            else if (HitChanceNum == 4 && (int)QWER.GetPrediction(target).Hitchance > 4)
            {
                List<Vector2> waypoints = target.GetWaypoints();
                //debug("" + target.Path.Count() + " " + (target.Position == target.ServerPosition) + (waypoints.Last<Vector2>().To3D() == target.ServerPosition));
                if (QWER.Delay < 0.3)
                    QWER.CastIfHitchanceEquals(target, HitChance.Dashing, true);
                QWER.CastIfHitchanceEquals(target, HitChance.Immobile, true);
                QWER.CastIfWillHit(target, 2, true);

                float SiteToSite = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed)) * 6 - QWER.Width;
                float BackToFront = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed));
                if (ObjectManager.Player.Distance(waypoints.Last<Vector2>().To3D()) < SiteToSite || ObjectManager.Player.Distance(target.Position) < SiteToSite)
                    QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                else if (target.Path.Count() < 2
                    && (target.ServerPosition.Distance(waypoints.Last<Vector2>().To3D()) > SiteToSite
                    || Math.Abs(ObjectManager.Player.Distance(waypoints.Last<Vector2>().To3D()) - ObjectManager.Player.Distance(target.Position)) > BackToFront
                    || target.HasBuffOfType(BuffType.Slow) || target.HasBuff("Recall")
                    || (target.Path.Count() == 0 && target.Position == target.ServerPosition)
                    ))
                {
                    if (target.IsFacing(ObjectManager.Player) || target.Path.Count() == 0)
                    {
                        if (ObjectManager.Player.Distance(target.Position) < QWER.Range - ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.Position) / QWER.Speed)))
                            QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                    }
                    else
                    {
                        QWER.CastIfHitchanceEquals(target, HitChance.High, true);
                    }
                }
            }
        }
 private bool ELogicHero(Obj_AI_Hero mainTarget, HitChance hitChance)
 {
     try
     {
         if (mainTarget == null)
         {
             return false;
         }
         var input = new PredictionInput
         {
             Range = ELength,
             Delay = E.Delay,
             Radius = E.Width,
             Speed = E.Speed,
             Type = E.Type,
             UseBoundingRadius = true
         };
         var input2 = new PredictionInput
         {
             Range = E.Range + ELength,
             Delay = E.Delay,
             Radius = E.Width,
             Speed = E.Speed,
             Type = E.Type,
             UseBoundingRadius = true
         };
         var startPosition = Vector3.Zero;
         var endPosition = Vector3.Zero;
         var targets =
             GameObjects.EnemyHeroes.Where(t => t.IsValidTarget((E.Range + ELength + E.Width) * 1.25f)).ToList();
         if (mainTarget.ServerPosition.Distance(Player.ServerPosition) <= E.Range)
         {
             var castPosition = mainTarget.ServerPosition;
             var maxAdditionalHits = 0;
             foreach (var target in targets.Where(t => t.NetworkId != mainTarget.NetworkId))
             {
                 var lTarget = target;
                 var additionalHits = 0;
                 input.Unit = lTarget;
                 input.From = castPosition;
                 input.RangeCheckFrom = castPosition;
                 var pred = Prediction.GetPrediction(input);
                 if (pred.Hitchance >= HitChance.High)
                 {
                     additionalHits++;
                     var rect = new Geometry.Polygon.Rectangle(
                         castPosition, castPosition.Extend(pred.CastPosition, ELength), E.Width);
                     foreach (var target2 in
                         targets.Where(
                             t => t.NetworkId != mainTarget.NetworkId && t.NetworkId != lTarget.NetworkId))
                     {
                         input.Unit = target2;
                         var pred2 = Prediction.GetPrediction(input);
                         if (!pred2.UnitPosition.Equals(Vector3.Zero) &&
                             new Geometry.Polygon.Circle(pred2.UnitPosition, target2.BoundingRadius * 0.9f)
                                 .Points.Any(p => rect.IsInside(p)))
                         {
                             additionalHits++;
                         }
                     }
                 }
                 if (additionalHits > maxAdditionalHits)
                 {
                     maxAdditionalHits = additionalHits;
                     endPosition = pred.CastPosition;
                 }
             }
             startPosition = castPosition;
             if (endPosition.Equals(Vector3.Zero))
             {
                 if (startPosition.Distance(Player.ServerPosition) > E.Range)
                 {
                     startPosition = Player.ServerPosition.Extend(startPosition, E.Range);
                 }
                 if (mainTarget.Path.Length > 0)
                 {
                     var newPos = mainTarget.Path[0];
                     if (mainTarget.Path.Length > 1 &&
                         newPos.Distance(mainTarget.ServerPosition) <= mainTarget.BoundingRadius * 4f)
                     {
                         var nnPos = newPos.Extend(
                             mainTarget.Path[1],
                             Math.Min(mainTarget.BoundingRadius * 1.5f, newPos.Distance(mainTarget.Path[1])));
                         if (startPosition.To2D().AngleBetween(nnPos.To2D()) < 30)
                         {
                             newPos = nnPos;
                         }
                     }
                     endPosition = startPosition.Extend(newPos, ELength);
                 }
                 else if (mainTarget.IsFacing(Player))
                 {
                     endPosition = startPosition.Extend(Player.ServerPosition, ELength);
                 }
                 else
                 {
                     endPosition = Player.ServerPosition.Extend(
                         startPosition, startPosition.Distance(Player.ServerPosition) + ELength);
                 }
             }
         }
         else
         {
             var totalHits = 0;
             input2.Unit = mainTarget;
             var pred = Prediction.GetPrediction(input2);
             if (!pred.UnitPosition.Equals(Vector3.Zero) && !pred.CastPosition.Equals(Vector3.Zero))
             {
                 var ranges =
                     new[] { E.Range }.Concat(
                         targets.Where(
                             t =>
                                 t.ServerPosition.Distance(Player.ServerPosition) < E.Range &&
                                 t.ServerPosition.Distance(mainTarget.ServerPosition) < ELength * 1.25f)
                             .Select(t => t.ServerPosition.Distance(Player.ServerPosition)));
                 var maxDistance = (ELength + E.Width + mainTarget.BoundingRadius) * 1.1f;
                 foreach (var range in ranges)
                 {
                     var circle =
                         new Geometry.Polygon.Circle(Player.ServerPosition, Math.Min(E.Range, range), 50).Points
                             .Where(p => p.Distance(pred.UnitPosition) <= maxDistance)
                             .Select(p => p.To3D())
                             .OrderBy(p => p.Distance(pred.CastPosition));
                     foreach (var point in circle)
                     {
                         var hits = 0;
                         input.From = point;
                         input.RangeCheckFrom = point;
                         input.Unit = mainTarget;
                         var pred2 = Prediction.GetPrediction(input);
                         if (pred2.Hitchance >= hitChance)
                         {
                             hits++;
                             var rect = new Geometry.Polygon.Rectangle(
                                 point, point.Extend(pred2.CastPosition, ELength), E.Width);
                             foreach (var target in targets.Where(t => t.NetworkId != mainTarget.NetworkId))
                             {
                                 input.Unit = target;
                                 var pred3 = Prediction.GetPrediction(input);
                                 if (!pred3.UnitPosition.Equals(Vector3.Zero) &&
                                     new Geometry.Polygon.Circle(
                                         pred3.UnitPosition, target.BoundingRadius * 0.9f).Points.Any(
                                             p => rect.IsInside(p)))
                                 {
                                     hits++;
                                 }
                             }
                             if (hits > totalHits ||
                                 hits > 0 && hits == totalHits &&
                                 point.Distance(mainTarget.ServerPosition) <
                                 startPosition.Distance(mainTarget.ServerPosition))
                             {
                                 totalHits = hits;
                                 startPosition = point;
                                 endPosition = point.Extend(pred2.CastPosition, ELength);
                             }
                             if (totalHits == targets.Count)
                             {
                                 break;
                             }
                         }
                     }
                     if (totalHits == targets.Count)
                     {
                         break;
                     }
                 }
             }
         }
         if (!startPosition.Equals(Vector3.Zero) && !endPosition.Equals(Vector3.Zero))
         {
             if (startPosition.Distance(Player.ServerPosition) > E.Range)
             {
                 startPosition = Player.ServerPosition.Extend(startPosition, E.Range);
             }
             if (endPosition.Distance(startPosition) > ELength)
             {
                 endPosition = startPosition.Extend(endPosition, ELength);
             }
             E.Cast(startPosition, endPosition);
             return true;
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return false;
 }
 private void OnInterruptableTarget(Obj_AI_Hero sender, Interrupter2.InterruptableTargetEventArgs args)
 {
     try
     {
         if (sender.IsEnemy && args.DangerLevel == Interrupter2.DangerLevel.High &&
             Ultimate.IsActive(UltimateModeType.Interrupt, sender) && sender.IsFacing(Player))
         {
             Casting.SkillShot(sender, R, HitChance.High);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
Example #11
0
        protected override void Interrupter_OnPosibleToInterrupt(Obj_AI_Hero sender, Interrupter2.InterruptableTargetEventArgs spell)
        {
            if (!menu.Item("UseInt", true).GetValue<bool>()) return;

            if (sender.IsValidTarget())
            {
                if (Player.Distance(sender) <= R.Range && sender.IsFacing(Player))
                {
                    var pred = R.GetPrediction(sender);
                    if (pred.Hitchance >= HitChance.VeryHigh && sender.IsFacing(Player))
                    {
                        R.Cast(pred.CastPosition);
                    }
                }
            }
        }
Example #12
0
 void Interrupter2_OnInterruptableTarget(Obj_AI_Hero sender, Interrupter2.InterruptableTargetEventArgs args)
 {
     if (MenuHelper.isMenuEnabled("dzaio.cassiopeia.misc.antigp") && _spells[SpellSlot.R].IsReady())
     {
         if (args.DangerLevel >= Interrupter2.DangerLevel.High && sender.IsFacing(ObjectManager.Player))
         {
             _spells[SpellSlot.R].CastIfHitchanceEquals(sender, MenuHelper.GetHitchance());
         }
     }
 }
Example #13
0
 private static bool TargetRunningAway(Obj_AI_Hero hero)
 {
     var isfacingplayer = hero.IsFacing(_player);
     var ismoving = hero.IsMoving;
     return !isfacingplayer && ismoving && !hero.IsMovementImpaired();
 }
Example #14
0
        internal static bool CanE(Obj_AI_Hero target)
        {
            if (Config.Item("eeee").GetValue<StringList>().SelectedIndex == 0)
                return true;

            var t = KL.TurretCache.Values.FirstOrDefault(x => x.IsEnemy && x.Distance(KL.Player.ServerPosition) <= 1500);
            if (t == null || t.IsDead || !t.IsValid)
                return true;

            if (KL.Player.Distance(t) <= 1200 && target.Distance(t) <= 1200)
            {
                if (target.Distance(t) > KL.Player.Distance(t))
                {
                    if (target.IsFacing(t))
                        return false;
                }
            }

            return true;
        }
Example #15
0
        static void Interrupter2_OnInterruptableTarget(Obj_AI_Hero sender, Interrupter2.InterruptableTargetEventArgs args)
        {
            if (!AIO_Menu.Champion.Misc.UseInterrupter || Player.IsDead)
                return;

            if (R.CanCast(sender) && sender.IsFacing(Player))
                R.Cast(sender);
        }
Example #16
0
 private static void OnPossibleToInterrupt(Obj_AI_Hero unit, InterruptableSpell spell)
 {
     if (Player.IsDead || !GetValue<bool>("Interrupt", "EQ") ||
         !GetValue<bool>("Interrupt", unit.ChampionName + "_" + spell.Slot) || !Q.IsReady())
     {
         return;
     }
     if (E.CanCast(unit) && Player.Mana >= Q.Instance.ManaCost + E.Instance.ManaCost)
     {
         var predE = E.GetPrediction(unit);
         if (predE.Hitchance >= E.MinHitChance &&
             E.Cast(
                 predE.UnitPosition.Extend(Player.ServerPosition, -E.Width / (unit.IsFacing(Player) ? 2 : 1)),
                 PacketCast) && Q.Cast(predE.UnitPosition, PacketCast))
         {
             return;
         }
     }
     foreach (var flag in
         Flag.Where(i => Q2.WillHit(unit, i.ServerPosition)))
     {
         Q.Cast(flag.ServerPosition, PacketCast);
     }
 }
        private float CalcComboDamage(Obj_AI_Hero target,
            float resMulti,
            bool rangeCheck,
            bool q,
            bool w,
            bool e,
            bool r)
        {
            try
            {
                if (target == null)
                {
                    return 0;
                }

                var damage = 0f;
                var totalMana = 0f;

                if (r && R.IsReady() && (!rangeCheck || R.IsInRange(target)))
                {
                    var rMana = R.ManaCost * resMulti;
                    if (totalMana + rMana <= Player.Mana)
                    {
                        totalMana += rMana;
                        damage += R.GetDamage(target);
                    }
                }

                if (q && Q.IsReady() && (!rangeCheck || Q.IsInRange(target)))
                {
                    var qMana = Q.ManaCost * resMulti;
                    if (totalMana + qMana <= Player.Mana)
                    {
                        totalMana += qMana;
                        damage += Q.GetDamage(target);
                    }
                }
                else if (w && W.IsReady() && (!rangeCheck || W.IsInRange(target)))
                {
                    var wMana = W.ManaCost * resMulti;
                    if (totalMana + wMana <= Player.Mana)
                    {
                        totalMana += wMana;
                        damage += W.GetDamage(target);
                    }
                }
                if (e && E.IsReady(3000) && (!rangeCheck || E.IsInRange(target)))
                {
                    var eMana = E.ManaCost * resMulti;
                    var eDamage = E.GetDamage(target);
                    var count = target.IsNearTurret() && !target.IsFacing(Player) ||
                                target.IsNearTurret() && Player.HealthPercent <= 35 || !R.IsReady()
                        ? 5
                        : 8;
                    for (var i = 0; i < count; i++)
                    {
                        if (totalMana + eMana > Player.Mana)
                        {
                            break;
                        }
                        totalMana += eMana;
                        damage += eDamage;
                    }
                }

                damage += ItemManager.CalculateComboDamage(target, rangeCheck);
                damage += SummonerManager.CalculateComboDamage(target, rangeCheck);
                return damage;
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return 0;
        }
Example #18
0
 private bool ShouldR(Obj_AI_Hero target)
 {
     return !menu.Item("faceCheck", true).GetValue<bool>() || target.IsFacing(Player);
 }
Example #19
0
        static void OnInterruptableTarget(Obj_AI_Hero sender, Interrupter2.InterruptableTargetEventArgs args)
        {
            if (Player.IsDead)
            {
                return;
            }
            if (sender.IsValidTarget())
            {
                if (CassioUtils.Active("Interrupter.UseR") && Vector3.Distance(sender.ServerPosition, Player.ServerPosition) <= Spells[SpellSlot.R].Range && sender.IsFacing(Player))
                {
					Spells[SpellSlot.R].SPredictionCast(sender, CassioUtils.GetHitChance("Hitchance.R"));
					/*
                    var pred = Spells[SpellSlot.R].GetPrediction(sender);
                    if (pred.Hitchance >= HitChance.VeryHigh && sender.IsFacing(Player))
                    {
                        Spells[SpellSlot.R].Cast(pred.CastPosition);
                    }
					*/
				}
            }
        }
Example #20
0
        public static bool SpellPrediction(Spell spell, Obj_AI_Hero target,bool collisionable)
        {
            //
            var dist = ObjectManager.Player.Distance(target.Position);
            var pos1 = LeagueSharp.Common.Prediction.GetPrediction(target, dist / spell.Speed).UnitPosition;
            var e = pos1.Distance(target.GetWaypoints()[1].To3D());

            pos1.Extend(target.GetWaypoints()[1].To3D(), -e);
            Render.Circle.DrawCircle(pos1, 10, System.Drawing.Color.BlueViolet, 2);
            //
            var point = PointsAroundTheTarget(target.Position, target.BoundingRadius + 50).FirstOrDefault(t => t.IsWall());
            if (point.X != 0 && point.Y != 0 && point.Z != 0)
            {
                if (MinionCollideLine(ObjectManager.Player.Position, ExtendWallpos(target, point), spell,collisionable)) return false;

                Render.Circle.DrawCircle(ExtendWallpos(target, point), 10, System.Drawing.Color.Brown, 2);
                spell.Cast(ExtendWallpos(target, point));
                return true;
            }
            else
            {
                var range = spell.Range;
                if (target.Position.Distance(ObjectManager.Player.Position) < target.GetWaypoints()[1].Distance(ObjectManager.Player.Position))
                {
                    range -= 100;
                }

                if (!spell.IsInRange(target, range)) return false;

                if (target.IsFacing(ObjectManager.Player) && target.Position.Distance(ObjectManager.Player.Position) > target.GetWaypoints()[1].Distance(ObjectManager.Player.Position))
                {
                  if (MinionCollideLine(ObjectManager.Player.Position, target.Position, spell,collisionable)) return false;
                        spell.Cast(target.Position);
                        return true;

                }
               // float speed =
                if (target.IsImmovable) // check for cc guys
                {
                    if (MinionCollideLine(ObjectManager.Player.Position, target.Position, spell,collisionable)) return false;
                    spell.Cast(target.Position);
                    return true;
                }

              //  if(target.IsChannelingImportantSpell())
                if (target.IsWindingUp && !target.IsMelee())
                {
                    if (MinionCollideLine(ObjectManager.Player.Position, target.Position, spell,collisionable)) return false;
                    spell.Cast(target.Position);
                    return true;
                }

                if (target.Position.Distance(ObjectManager.Player.Position) <= 300)
                {
                    CastToDirection( target, spell,collisionable);
                }
                else
                {
                    var oldPos = target.GetWaypoints()[0].To3D();
                   var h = false;
                    Utility.DelayAction.Add(Game.Ping + 1000, () => h = Next(target, oldPos, spell,collisionable));
                    return h;
                }
            }
            return false;
        }
Example #21
0
        private static Vector3 PreCastPos(Obj_AI_Hero Hero ,float Delay)
        {
            float value = 0f;
            if (Hero.IsFacing(Player))
            {
                value = (10f - Hero.BoundingRadius);
            }
            else
            {
                value = -(120f - Hero.BoundingRadius);
            }
            var distance = Delay * Hero.MoveSpeed + value;
            var path = Hero.GetWaypoints();

            for (var i = 0; i < path.Count - 1; i++)
            {
                var a = path[i];
                var b = path[i + 1];
                var d = a.Distance(b);

                if (d < distance)
                {
                    distance -= d;
                }
                else
                {
                    return (a + distance * (b - a).Normalized()).To3D();
                }
            }

            return (path[path.Count - 1]).To3D();
        }
Example #22
0
        static void Interrupter2_OnInterruptableTarget(Obj_AI_Hero sender, Interrupter2.InterruptableTargetEventArgs args)
        {
            if (!menu.Item("interruptR").GetValue<bool>()) return;

            if (sender.IsValidTarget(R.Range) && args.DangerLevel >= Interrupter2.DangerLevel.High && menu.Item(sender.ChampionName + "interrupt").GetValue<bool>() && sender.IsFacing(player))
                R.CastIfHitchanceEquals(sender, HitChance.High, menu.Item("PacketCast").GetValue<bool>());
        }
Example #23
0
 public static bool IsHeRunAway(Obj_AI_Hero target)
 {
     return (!target.IsFacing(player) &&
             Prediction.GetPrediction(target, 600, 100f).CastPosition.Distance(player.Position) >
             target.Position.Distance(player.Position));
 }
Example #24
0
 private void OnInterruptableTarget(Obj_AI_Hero sender, Interrupter2.InterruptableTargetEventArgs args)
 {
     try
     {
         if (sender.IsEnemy && args.DangerLevel == Interrupter2.DangerLevel.High &&
             Menu.Item(Menu.Name + ".ultimate.auto.enabled").GetValue<bool>() &&
             Menu.Item(Menu.Name + ".ultimate.auto.interrupt." + sender.ChampionName).GetValue<bool>() &&
             sender.IsFacing(Player))
         {
             Casting.SkillShot(sender, R, R.GetHitChance("combo"));
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }