Example #1
0
        private void OnAttack(
            Object sender,
            OrbwalkerActionArgs args
            ) //(AttackableUnit unit, AttackableUnit target)
        {
            if (!menu.Item("ComboActive").GetValue <MenuKeyBind>().Active || !W.IsReady())
            {
                return;
            }
            if (args.Type != OrbwalkerType.OnAttack)
            {
                return;
            }
            var target = args.Target;
            var unit   = sender;

            if (target == null || unit == null)
            {
                return;
            }

            if (unit is AIHeroClient && target is AIBaseClient)
            {
                if (Player.Distance(Prediction.GetFastUnitPosition((AIHeroClient)target, W.Delay)) <
                    W2.Range)
                {
                    W.Cast(Prediction.GetFastUnitPosition((AIHeroClient)target, W.Delay));
                }
            }
        }
Example #2
0
        /// <summary>
        /// Gets Aoe Prediction result
        /// </summary>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.AoeResult"/></returns>
        public static Prediction.AoeResult GetAoePrediction(float width, float delay, float missileSpeed, float range, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AoeResult result = new Prediction.AoeResult();
            var enemies = HeroManager.Enemies.Where(p => p.IsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, from).Distance(rangeCheckFrom) < range);

            foreach (Obj_AI_Hero enemy in enemies)
            {
                Prediction.Result prediction = GetPrediction(enemy, width, delay, missileSpeed, range, false, enemy.GetWaypoints(), enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), from, rangeCheckFrom);
                if (prediction.HitChance > HitChance.Medium)
                {
                    float multp = (result.CastPosition.Distance(from) / 875.0f);

                    var spellHitBox = new SPrediction.Geometry.Polygon(
                        ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), result.CastPosition, (float)Math.PI * multp, 410, 200 * multp),
                        ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), result.CastPosition, (float)Math.PI * multp, 410, 320 * multp));

                    var collidedEnemies = HeroManager.Enemies.AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), ClipperWrapper.MakePaths(spellHitBox)));
                    int collisionCount  = collidedEnemies.Count();
                    if (collisionCount > result.HitCount)
                    {
                        result = prediction.ToAoeResult(collisionCount, new Collision.Result(collidedEnemies.ToList <Obj_AI_Base>(), Collision.Flags.EnemyChampions));
                    }
                }
            }

            return(result);
        }
Example #3
0
        /// <summary>
        /// Gets Prediction result
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="collisionable">Spell collisionable</param>
        /// <param name="type">Spell skillshot type</param>
        /// <param name="path">Waypoints of target</param>
        /// <param name="avgt">Average reaction time (in ms)</param>
        /// <param name="movt">Passed time from last movement change (in ms)</param>
        /// <param name="avgp">Average Path Lenght</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
        public static Prediction.Result GetPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, List <Vector2> path, float avgt, float movt, float avgp, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AssertInitializationMode();

            Prediction.Result result = Prediction.GetPrediction(target, width, delay, missileSpeed, range, collisionable, SkillshotType.SkillshotCircle, path, avgt, movt, avgp, from, rangeCheckFrom);

            if (result.HitChance >= HitChance.Low && result.HitChance < HitChance.VeryHigh)
            {
                if (result.CastPosition.Distance(from) < 875.0f)
                {
                    Vector2 direction = (result.CastPosition - from).Normalized();

                    result.CastPosition = from + direction * (875f + width / 2f);

                    var targetHitBox = ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(target, delay, missileSpeed, from), target.BoundingRadius);

                    float multp = (result.CastPosition.Distance(from) / 875.0f);

                    var arcHitBox = new SPrediction.Geometry.Polygon(
                        ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), result.CastPosition, (float)Math.PI * multp, 410, 200 * multp),
                        ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), result.CastPosition, (float)Math.PI * multp, 410, 320 * multp));

                    if (ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(targetHitBox), ClipperWrapper.MakePaths(arcHitBox)))
                    {
                        result.HitChance = (HitChance)(result.HitChance + 1);
                    }
                }
            }

            return(result);
        }
Example #4
0
 static void MagnetQ(AIBaseClient target)
 {
     if (target.Distance(WAA) <= Q.Range + 15)
     {
         var pos = Prediction.GetFastUnitPosition(target, Game.Ping / 2000f).Extend(WAA.Position, Q.Range - 100);
         WAA.IssueOrder(GameObjectOrder.MoveTo, pos.ToVector3(), false);
     }
 }
        private static void SolvingWaitList()
        {
            if (!Q.IsReady(1000))
            {
                Qstate = 1;
            }
            if (waitQ == true && TTTar.IsValidTarget())
            {
                //if (Variables.GameTimeTickCount - cQ >= 350 + Player.AttackCastDelay - Game.Ping / 2) //"Lock Target", "To Mouse"
                if (Orbwalker.ActiveMode != OrbwalkerMode.LaneClear)
                {
                    if (Qmode == "Lock Target")
                    {
                        Q.Cast(Prediction.GetFastUnitPosition((AIBaseClient)TTTar, 300));
                    }
                    else
                    {
                        Q.Cast(Game.CursorPosRaw);
                    }

                    return;
                }
                else
                {
                    if (Qmode == "Lock Target")
                    {
                        Q.Cast(Prediction.GetFastUnitPosition((AIBaseClient)TTTar, 300));
                    }
                    else
                    {
                        Q.Cast(Game.CursorPosRaw);
                    }
                    return;
                }
                if (Environment.TickCount - waitQTick >= 500 + Game.Ping / 2)
                {
                    waitQ = false;
                }
            }
            if (waitR2 == true && TTTar.IsValidTarget())
            {
                R.Cast(TTTar as AIBaseClient);
                return;

                if (Environment.TickCount - waitQTick >= 500 + Game.Ping / 2)
                {
                    waitQ = false;
                }
            }
            if (Q.IsReady() && UseQBeforeExpiry && !Player.IsRecalling())
            {
                if (Qstate != 1 && Variables.GameTimeTickCount - cQ <= 3800 - Game.Ping / 2 && Variables.GameTimeTickCount - cQ >= 3300 - Game.Ping / 2)
                {
                    Q.Cast(Game.CursorPosRaw);
                    return;
                }
            }
        }
Example #6
0
        private void CastW(AIHeroClient target)
        {
            if (target == null || Player.Distance(Prediction.GetFastUnitPosition(target, W.Delay)) < W2.Range)
            {
                return;
            }

            if (Q.IsReady())
            {
                W.Cast(Player.Position.ToVector2().Extend(target.Position.ToVector2(), W.Range));
            }
        }
Example #7
0
        /// <summary>
        /// Gets Aoe Prediction result
        /// </summary>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.AoeResult"/></returns>
        public static Prediction.AoeResult GetAoePrediction(float width, float delay, float missileSpeed, float range, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AoeResult result = new Prediction.AoeResult();
            result.HitCount = 0;
            var enemies = HeroManager.Enemies.Where(p => p.IsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, from).Distance(rangeCheckFrom) < range);

            if (enemies.Count() > 0)
            {
                Vector2 posSummary = Vector2.Zero;
                enemies.AsParallel().ForAll(p => posSummary += Prediction.GetFastUnitPosition(p, delay, missileSpeed, from));
                Vector2 center  = posSummary / enemies.Count();
                float   flyTime = 0;
                if (missileSpeed != 0)
                {
                    flyTime = from.Distance(center) / missileSpeed;
                }

                posSummary = Vector2.Zero;
                List <Tuple <Prediction.Result, float> > predictionResults = new List <Tuple <Prediction.Result, float> >();

                foreach (Obj_AI_Hero enemy in enemies)
                {
                    Prediction.Result prediction = GetPrediction(enemy, width, delay + flyTime, 0, range, false, enemy.GetWaypoints(), enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), from, rangeCheckFrom);
                    if (prediction.HitChance > HitChance.Medium)
                    {
                        posSummary += prediction.UnitPosition;
                        predictionResults.Add(new Tuple <Prediction.Result, float>(prediction, enemy.BoundingRadius));
                    }
                }

                if (predictionResults.Count > 0)
                {
                    center = posSummary / predictionResults.Count;
                    result.CastPosition = center;
                    foreach (Tuple <Prediction.Result, float> res in predictionResults)
                    {
                        if (LeagueSharp.Common.Geometry.CircleCircleIntersection(center, res.Item1.UnitPosition, width, res.Item2).Length > 1)
                        {
                            result.HitCount++;
                        }
                    }
                }

                predictionResults.Clear();
                GC.Collect(GC.GetGeneration(predictionResults));
            }

            return(result);
        }
Example #8
0
        void CastQ()
        {
            if (!_spellQ.IsReady())
            {
                return;
            }

            var target = TargetSelector.GetTarget(_spellQ.Range);

            if (target != null)
            {
                Vector2 predictedPos = Prediction.GetFastUnitPosition(target, _spellQ.Delay); //correct pos currently not possible with spell acceleration
                _spellQ.Speed = GetDynamicQSpeed(ObjectManager.Player.Distance(predictedPos));
                _spellQ.CastIfHitchanceEquals(target, HitChance.High);
            }
        }
        public static void walljump()
        {
            var x = Player.Position.Extend(Game.CursorPosRaw, 100);
            var y = Player.Position.Extend(Game.CursorPosRaw, 30);

            if (!x.IsWall() && !y.IsWall())
            {
                Player.IssueOrder(GameObjectOrder.MoveTo, x);
            }
            if (x.IsWall() && !y.IsWall())
            {
                Player.IssueOrder(GameObjectOrder.MoveTo, y);
            }
            if (Prediction.GetFastUnitPosition(Player, 500).Distance(Player.Position) <= 10)
            {
                Q.Cast(Game.CursorPosRaw);
            }
        }
Example #10
0
        /// <summary>
        /// Gets Aoe Prediction result
        /// </summary>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.AoeResult"/></returns>
        public static Prediction.AoeResult GetAoePrediction(float width, float delay, float missileSpeed, float range, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AoeResult result = new Prediction.AoeResult();
            var enemies = HeroManager.Enemies.Where(p => p.IsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, from).Distance(rangeCheckFrom) < range);

            foreach (AIHeroClient enemy in enemies)
            {
                Prediction.Result prediction = GetPrediction(enemy, width, delay, missileSpeed, range, false, enemy.GetWaypoints(), enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), from, rangeCheckFrom);
                if (prediction.HitChance > HitChance.Medium)
                {
                    Vector2          to        = from + (prediction.CastPosition - from).Normalized() * range;
                    Collision.Result colResult = Collision.GetCollisions(from, to, width, delay, missileSpeed, false);
                    if (colResult.Objects.HasFlag(Collision.Flags.EnemyChampions))
                    {
                        int collisionCount = colResult.Units.Count(p => p.IsEnemy && p.IsChampion());
                        if (collisionCount > result.HitCount)
                        {
                            result = prediction.ToAoeResult(collisionCount, colResult);
                        }
                    }
                }
            }
            return(result);
        }
Example #11
0
        /// <summary>
        /// Gets Aoe Prediction result
        /// </summary>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.AoeResult"/></returns>
        public static Prediction.AoeResult GetAoePrediction(float width, float delay, float missileSpeed, float range, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AoeResult result = new Prediction.AoeResult();
            result.HitCount = 0;
            var enemies = HeroManager.Enemies.Where(p => p.IsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, from).Distance(rangeCheckFrom) < range);

            foreach (Obj_AI_Hero enemy in enemies)
            {
                Prediction.Result prediction = GetPrediction(enemy, width, delay, missileSpeed, range, false, enemy.GetWaypoints(), enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), from, rangeCheckFrom);
                if (prediction.HitChance > HitChance.Medium)
                {
                    Vector2 to              = from + (prediction.CastPosition - from).Normalized() * range;
                    var     spellHitBox     = ClipperWrapper.DefineSector(from, to, width, range);
                    var     collidedEnemies = HeroManager.Enemies.AsParallel().Where(p => !ClipperWrapper.IsOutside(spellHitBox, Prediction.GetFastUnitPosition(p, delay, missileSpeed, from)));
                    int     collisionCount  = collidedEnemies.Count();
                    if (collisionCount > result.HitCount)
                    {
                        result = prediction.ToAoeResult(collisionCount, new Collision.Result(collidedEnemies.ToList <Obj_AI_Base>(), Collision.Flags.EnemyChampions));
                    }
                }
            }

            return(result);
        }
Example #12
0
 public static Vector3 GetPositionAfter(this AIBaseClient target, int milliseconds = 250)
 {
     return(Prediction.GetFastUnitPosition(target, milliseconds).ToVector3());
 }
Example #13
0
        private void LogicQ()
        {
            var torb = Orbwalker.GetTarget();

            if (torb == null || torb.Type != GameObjectType.AIHeroClient)
            {
                if (Config["QConfig"].GetValue <MenuBool>("Qminion"))
                {
                    var t = TargetSelector.GetTarget(Q.Range + 300);
                    if (t.IsValidTarget())
                    {
                        var pos = Prediction.GetFastUnitPosition(t, 0.1f);
                        //GameObjects.EnemyMinions.Where(m => m.Distance(pos) <= 300 && m.IsValidTarget(Q.Range)).OrderBy(x => x.Distance(t)).FirstOrDefault();
                        var minion = GameObjects.EnemyMinions.Where(m => m.Distance(pos) <= 300 && m.IsValidTarget(Q.Range)).OrderBy(x => x.Distance(t)).FirstOrDefault();
                        if (minion.IsValidTarget())
                        {
                            if (t.Health < GetQdmg(t))
                            {
                                Q.CastOnUnit(minion);
                            }
                            if (Combo && Player.Mana > RMANA + EMANA)
                            {
                                Q.CastOnUnit(minion);
                            }
                            else if (Farm && Config["QConfig"].GetValue <MenuBool>("harrasQ") && Player.Mana > RMANA + EMANA + WMANA + EMANA)
                            {
                                Q.CastOnUnit(minion);
                            }
                        }
                    }
                }
            }
            else if (!Orbwalker.CanAttack() && !Player.Spellbook.IsAutoAttack)
            {
                var t = torb as AIHeroClient;
                if (t.Health < GetQdmg(t) + GetWdmg(t))
                {
                    Q.CastOnUnit(t);
                }
                if (Combo && Player.Mana > RMANA + QMANA)
                {
                    Q.CastOnUnit(t);
                }
                else if (Farm && Config["QConfig"].GetValue <MenuBool>("harrasQ") && Player.Mana > RMANA + QMANA + WMANA + EMANA)
                {
                    Q.CastOnUnit(t);
                }
            }
            if (LaneClear && Player.ManaPercent > Config["Farm"].GetValue <MenuSlider>("Mana").Value&& Config["Farm"].GetValue <MenuBool>("farmQ"))
            {
                var minionList = MinionManager.GetMinions(Player.Position, Q.Range);

                if (minionList.Count >= Config["Farm"].GetValue <MenuSlider>("LCminions").Value)
                {
                    var minionAttack = minionList.FirstOrDefault(x => Q.GetDamage(x) > HealthPrediction.GetPrediction(x, 300));
                    if (minionAttack.IsValidTarget())
                    {
                        Q.CastOnUnit(minionAttack);
                    }
                }
            }
        }
 private static void Combo()
 {
     if (Q.IsReady() && Orbwalker.CanMove() && QGap && !Player.IsDashing())
     {
         var target = GameObjects.EnemyHeroes.Where(x => x.IsValidTarget()).OrderByDescending(x => 1 - x.Distance(Player.Position)).FirstOrDefault();
         if (!Player.IsDashing() && Variables.GameTimeTickCount - cQ >= 1000 && target.IsValidTarget())
         {
             if (Prediction.GetFastUnitPosition(Player, 100).Distance(target.Position) <= Player.Distance(target.Position))
             {
                 Q.Cast(Game.CursorPosRaw);
             }
             return;
         }
     }
     if (W.IsReady() && Orbwalker.CanMove())
     {
         var targets = GameObjects.EnemyHeroes.Where(x => x.IsValidTarget() && !x.IsZombie && InWRange(x));
         if (targets.Any())
         {
             W.Cast();
             return;
         }
     }
     if (E.IsReady() && Orbwalker.CanMove() && Ecombo)
     {
         var target = TargetSelector.GetTarget(325 + Player.AttackRange + 70);
         if (target.IsValidTarget() && !target.IsZombie)
         {
             E.Cast(target.Position);
             return;
         }
     }
     if (R.IsReady())
     {
         if (R.Instance.Name == R1name)
         {
             if (Rcomboalways)
             {
                 var target = TargetSelector.GetTarget(325 + Player.AttackRange + 70);
                 if (target.IsValidTarget() && !target.IsZombie && E.IsReady())
                 {
                     R.Cast();
                     return;
                 }
                 else
                 {
                     var targetR = TargetSelector.GetTarget(200 + Player.BoundingRadius + 70);
                     if (targetR.IsValidTarget() && !targetR.IsZombie)
                     {
                         R.Cast();
                         return;
                     }
                 }
             }
             if (RcomboKillable)
             {
                 var targetR = TargetSelector.GetTarget(200 + Player.BoundingRadius + 70);
                 if (targetR.IsValidTarget() && !targetR.IsZombie && basicdmg(targetR) <= targetR.Health && totaldame(targetR) >= targetR.Health)
                 {
                     R.Cast();
                     return;
                 }
                 if (targetR.IsValidTarget() && !targetR.IsZombie && Player.CountEnemyHeroesInRange(800) >= 2)
                 {
                     R.Cast();
                     return;
                 }
             }
         }
         else if (R.Instance.Name == R2name)
         {
             if (R2comboKS)
             {
                 var targets = GameObjects.EnemyHeroes.Where(x => x.IsValidTarget(R.Range) && !x.IsZombie);
                 foreach (var target in targets)
                 {
                     if (target.Health < Rdame(target, target.Health))
                     {
                         R.Cast(target);
                     }
                     return;
                 }
             }
             if (R2comboMaxdmg)
             {
                 var targets = GameObjects.EnemyHeroes.Where(x => x.IsValidTarget(R.Range) && !x.IsZombie);
                 foreach (var target in targets)
                 {
                     if (target.Health / target.MaxHealth <= 0.25)
                     {
                         R.Cast(target);
                     }
                     return;
                 }
             }
             //if (R2BadaoStyle && !Q.IsReady())
             //{
             //    var target = TargetSelector.GetTarget(R.Range);
             //    if (target.IsValidTarget() && !target.IsZombie)
             //    {
             //        R.Cast(target);
             //        return;
             //    }
             //}
             var targethits = TargetSelector.GetTarget(R.Range);
             if (targethits.IsValidTarget() && !targethits.IsZombie)
             {
                 R.CastIfWillHit(targethits, 4);
             }
             return;
         }
     }
 }
Example #15
0
        private void Combo()
        {
            AIHeroClient target = TargetSelector.GetTarget(1100);

            if (target == null || target.IsInvulnerable || target.IsMagicalImmune == 1)
            {
                return;
            }
            //if (config.Item("useItems"))
            //{
            //    ItemHandler.UseItems(target, config, ComboDamage(target));
            //}
            var  ignitedmg = (float)player.GetSummonerSpellDamage(target, SummonerSpell.Ignite);
            bool hasIgnite = player.Spellbook.CanUseSpell(player.GetSpellSlot("SummonerDot")) == SpellState.Ready;

            if (config["csettings"].GetValue <MenuBool>("useIgnite") && ignitedmg > target.Health && hasIgnite &&
                !DaoHungAIO.Helpers.Extensions.CheckCriticalBuffs(target) &&
                ((target.Distance(player) > player.GetRealAutoAttackRange() &&
                  (!Q.IsReady() || Q.Mana < player.Mana)) || player.HealthPercent < 35))
            {
                player.Spellbook.CastSpell(player.GetSpellSlot("SummonerDot"), target);
            }
            if (Q.CanCast(target))
            {
                if (config["csettings"].GetValue <MenuBool>("useqLimit"))
                {
                    if (player.CountEnemyHeroesInRange(Q.Range) == 1 && config["csettings"].GetValue <MenuBool>("useq") &&
                        (target.Distance(player) > player.GetRealAutoAttackRange() ||
                         (Q.GetDamage(target) > target.Health) &&
                         (player.HealthPercent < 50 || player.CountAllyHeroesInRange(900) > 0)))
                    {
                        if (Q.CastOnUnit(target))
                        {
                            HandleECombo();
                        }
                    }
                    if ((player.CountEnemyHeroesInRange(Q.Range) > 1 && config["csettings"].GetValue <MenuBool>("useqSec") &&
                         Q.GetDamage(target) > target.Health) || player.HealthPercent <35f ||
                                                                                       target.Distance(player)> player.GetRealAutoAttackRange())
                    {
                        if (Q.CastOnUnit(target))
                        {
                            HandleECombo();
                        }
                    }
                }
                else
                {
                    if (Q.CastOnUnit(target))
                    {
                        HandleECombo();
                    }
                }
            }
            if (R.IsReady() && config["csettings"].GetValue <MenuBool>("user"))
            {
                if (player.CountEnemyHeroesInRange(Q.Range) >= config["csettings"].GetValue <MenuSlider>("userMin").Value)
                {
                    R.Cast();
                }
                //if (config["csettings"].GetValue<MenuBool>("userDmg") &&
                //    HealthPrediction.GetPrediction(player, 100, 70, HealthPrediction.HealthPredictionType.Simulated)  <= player.Health * 0.3f &&
                //    player.Distance(target) < 450f)
                //{
                //    R.Cast();
                //}
            }
            if (config["csettings"].GetValue <MenuBool>("useeAA") && !Eactive &&
                HealthPrediction.GetPrediction(player, 100, 70, HealthPrediction.HealthPredictionType.Simulated) < player.Health - target.GetAutoAttackDamage(player))
            {
                E.Cast();
            }
            if (Eactive)
            {
                if (E.IsReady() && target.IsValidTarget() && target.IsMagicalImmune != 1 &&
                    ((Prediction.GetFastUnitPosition(target, 0.1f).Distance(player.Position) >
                      player.GetRealAutoAttackRange() && target.Distance(player.Position) <= E.Range) ||
                     config["csettings"].GetValue <MenuBool>("useeStun")))
                {
                    E.Cast();
                }
            }
            else
            {
                if (config["csettings"].GetValue <MenuBool>("useeStun") &&
                    Prediction.GetFastUnitPosition(target, 0.1f).Distance(player.Position) <
                    player.GetRealAutoAttackRange() && player.Distance(player.Position) <= E.Range)
                {
                    E.Cast();
                }
            }
        }
Example #16
0
        /// <summary>
        /// Gets Aoe Prediction result
        /// </summary>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="vectorSpeed">Vector speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="vectorLenght">Vector lenght</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.AoeResult"/></returns>
        public static AoeResult GetAoePrediction(float width, float delay, float vectorSpeed, float range, float vectorLenght, Vector2 rangeCheckFrom)
        {
            AoeResult result  = new AoeResult();
            var       enemies = HeroManager.Enemies.Where(p => p.IsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, rangeCheckFrom).Distance(rangeCheckFrom) < range);

            foreach (Obj_AI_Hero enemy in enemies)
            {
                List <Vector2> path = enemy.GetWaypoints();
                if (path.Count <= 1)
                {
                    Vector2          from      = rangeCheckFrom + (enemy.ServerPosition.To2D() - rangeCheckFrom).Normalized() * range;
                    Vector2          to        = from + (enemy.ServerPosition.To2D() - from).Normalized() * vectorLenght;
                    Collision.Result colResult = Collision.GetCollisions(from, to, width, delay, vectorSpeed);

                    if (colResult.Objects.HasFlag(Collision.Flags.EnemyChampions))
                    {
                        int collisionCount = colResult.Units.Count(p => p.IsEnemy && p.IsChampion());
                        if (collisionCount > result.HitCount)
                        {
                            result = new AoeResult
                            {
                                CastSourcePosition = from,
                                CastTargetPosition = enemy.ServerPosition.To2D(),
                                HitCount           = collisionCount,
                                CollisionResult    = colResult
                            };
                        }
                    }
                }
                else
                {
                    if (!enemy.IsDashing())
                    {
                        for (int i = 0; i < path.Count - 1; i++)
                        {
                            Vector2           point      = Geometry.ClosestCirclePoint(rangeCheckFrom, range, path[i], path[i + 1]);
                            Prediction.Result prediction = Prediction.GetPrediction(enemy, width, delay, vectorSpeed, vectorLenght, false, SkillshotType.SkillshotLine, path, enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), point, rangeCheckFrom);
                            if (prediction.HitChance > HitChance.Medium)
                            {
                                Vector2          to        = point + (prediction.CastPosition - point).Normalized() * vectorLenght;
                                Collision.Result colResult = Collision.GetCollisions(point, to, width, delay, vectorSpeed, false);
                                if (colResult.Objects.HasFlag(Collision.Flags.EnemyChampions))
                                {
                                    int collisionCount = colResult.Units.Count(p => p.IsEnemy && p.IsChampion());
                                    if (collisionCount > result.HitCount)
                                    {
                                        result = new AoeResult
                                        {
                                            CastSourcePosition = point,
                                            CastTargetPosition = prediction.CastPosition,
                                            HitCount           = collisionCount,
                                            CollisionResult    = colResult
                                        };
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
Example #17
0
        /// <summary>
        /// Gets collided units & flags
        /// </summary>
        /// <param name="from">Start position</param>
        /// <param name="to">End position</param>
        /// <param name="width">Rectangle scale</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <returns>Collision result as <see cref="Collision.Result"/></returns>
        public static Result GetCollisions(Vector2 from, Vector2 to, float width, float delay, float missileSpeed = 0, bool isArc = false)
        {
            List <Obj_AI_Base> collidedUnits = new List <Obj_AI_Base>();
            var spellHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(from, to, width));
            var spellBBox   = new BoundingBox(from.To3D(), to.To3D());

            if (isArc)
            {
                spellHitBox = ClipperWrapper.MakePaths(new SPrediction.Geometry.Polygon(
                                                           ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 875f), 410, 200 * (to.Distance(from) / 875f)),
                                                           ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 875f), 410, 320 * (to.Distance(from) / 875f))));
            }
            Flags _colFlags = Flags.None;

            //var collidedMinions = MinionManager.GetMinions(from.Distance(to) + 250, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None).AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius + 10)), spellHitBox));
            var collidedMinions = MinionManager.GetMinions(from.Distance(to) + 250, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None).AsParallel().Where(p => spellBBox.Intersects(new BoundingSphere(Prediction.GetFastUnitPosition(p, delay, missileSpeed).To3D(), p.BoundingRadius)));
            var collidedEnemies = HeroManager.Enemies.AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox));
            var collidedAllies  = HeroManager.Allies.AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox));

            if (collidedMinions != null && collidedMinions.Count() != 0)
            {
                collidedUnits.AddRange(collidedMinions);
                _colFlags |= Flags.Minions;
            }

            if (collidedEnemies != null && collidedEnemies.Count() != 0)
            {
                collidedUnits.AddRange(collidedEnemies);
                _colFlags |= Flags.EnemyChampions;
            }

            if (collidedAllies != null && collidedAllies.Count() != 0)
            {
                collidedUnits.AddRange(collidedAllies);
                _colFlags |= Flags.AllyChampions;
            }

            if (CheckWallCollision(from, to))
            {
                _colFlags |= Flags.Wall;
            }

            if (CheckYasuoWallCollision(from, to, width))
            {
                _colFlags |= Flags.YasuoWall;
            }

            return(new Result(collidedUnits, _colFlags));
        }
Example #18
0
        /// <summary>
        /// Checks enemy hero collisions
        /// </summary>
        /// <param name="from">Start position</param>
        /// <param name="to">End position</param>
        /// <param name="width">Rectangle scale</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="isArc">Checks collision for arc spell</param>
        /// <returns>true if collision found</returns>
        public static bool CheckAllyHeroCollision(Vector2 from, Vector2 to, float width, float delay, float missileSpeed = 0, bool isArc = false)
        {
            var spellHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(from, to, width));

            if (isArc)
            {
                spellHitBox = ClipperWrapper.MakePaths(new SPrediction.Geometry.Polygon(
                                                           ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 875f), 410, 200 * (to.Distance(from) / 875f)),
                                                           ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 875f), 410, 320 * (to.Distance(from) / 875f))));
            }
            return(HeroManager.Allies.AsParallel().Any(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox)));
        }
Example #19
0
        /// <summary>
        /// Checks minion collisions
        /// </summary>
        /// <param name="from">Start position</param>
        /// <param name="to">End position</param>
        /// <param name="width">Rectangle scale</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="isArc">Checks collision for arc spell</param>
        /// <returns>true if collision found</returns>
        public static bool CheckMinionCollision(Vector2 from, Vector2 to, float width, float delay, float missileSpeed = 0, bool isArc = false)
        {
            var spellBBox = new BoundingBox(from.To3D(), to.To3D());

            if (isArc)
            {
                var spellHitBox = ClipperWrapper.MakePaths(new SPrediction.Geometry.Polygon(
                                                               ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 875f), 410, 200 * (to.Distance(from) / 875f)),
                                                               ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 875f), 410, 320 * (to.Distance(from) / 875f))));

                return(MinionManager.GetMinions(from.Distance(to) + 100, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None).AsParallel().Any(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox)));
            }

            return(MinionManager.GetMinions(from.Distance(to) + 100, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None).AsParallel().Any(p => spellBBox.Intersects(new BoundingSphere(Prediction.GetFastUnitPosition(p, delay, missileSpeed).To3D(), p.BoundingRadius))));
        }