Exemple #1
0
        public static void CastW()
        {
            if (!W.IsReady())
            {
                return;
            }

            Obj_AI_Hero target = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Magical);

            if (target.IsValidTarget())
            {
                if (E.IsReady())
                {
                    W.Cast(target.Position);
                }
                else
                if (target.HasBuffOfType(BuffType.Stun) || target.HasBuffOfType(BuffType.Snare) || target.HasBuffOfType(BuffType.Knockup))
                {
                    W.Cast(target.Position);
                }

                //Check if dashing, and if is dashing, cast on dashing end position
                else if (target.IsDashing())
                {
                    W.Cast(target.GetDashInfo().EndPos);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Gets Predicted position while target is dashing
        /// </summary>
        private static Vector2 GetDashingPrediction(Obj_AI_Hero target, Spell s, out HitChance hc, Vector3 rangeCheckFrom)
        {
            if (target.IsDashing())
            {
                var dashInfo = target.GetDashInfo();

                float   dashPassedDistance = (Utils.TickCount - dashInfo.StartTick) / 1000f * dashInfo.Speed;
                Vector2 currentDashPos     = dashInfo.StartPos + (dashInfo.EndPos - dashInfo.StartPos).Normalized() * dashPassedDistance;

                float targetDistance = rangeCheckFrom.To2D().Distance(currentDashPos);
                float flyTime        = 0f;

                if (s.Speed != 0) //skillshot with a missile
                {
                    Vector2 Vt = (dashInfo.Path[dashInfo.Path.Count - 1] - dashInfo.Path[0]).Normalized() * dashInfo.Speed;
                    Vector2 Vs = (target.ServerPosition.To2D() - rangeCheckFrom.To2D()).Normalized() * s.Speed;
                    Vector2 Vr = Vs - Vt;

                    flyTime = targetDistance / Vr.Length();
                }
                int   dashLeftTime = dashInfo.EndTick - Utils.TickCount;
                float t            = flyTime + s.Delay + Game.Ping / 1000f;

                if (dashLeftTime >= t * 1000f)
                {
                    float distance = t * dashInfo.Speed;
                    hc = HitChance.Dashing;

                    for (int i = 0; i < dashInfo.Path.Count - 1; i++)
                    {
                        float d = dashInfo.Path[i + 1].Distance(dashInfo.Path[i]);
                        if (distance == d)
                        {
                            return(dashInfo.Path[i + 1]);
                        }
                        else if (distance < d)
                        {
                            return(dashInfo.Path[i] + distance * (dashInfo.Path[i + 1] - dashInfo.Path[i]).Normalized());
                        }
                        else
                        {
                            distance -= d;
                        }
                    }
                }
            }

            hc = HitChance.Impossible;
            return(rangeCheckFrom.To2D());
        }
Exemple #3
0
        public static void goFullIn(Obj_AI_Hero target)
        {
            //R logic here!

            try
            {
                if (!R.IsReady() && target.IsDashing())
                {
                    if (W.IsReady())
                    {
                        summonSolider(target.GetDashInfo().EndPos.To3D());
                    }
                }

                if (E.IsReady())
                {
                    castETarget(target);
                }
                var dist = Player.Distance(target);
                if (R.IsReady())
                {
                    Obj_AI_Base tower = ObjectManager.Get <Obj_AI_Turret>().Where(tur => tur.IsAlly && tur.Health > 0).OrderBy(tur => Player.Distance(tur)).First();
                    if (tower != null)
                    {
                        var pol = DeathMath.getPolygonOn(Player.Position.Extend(tower.Position, -155).To2D(), tower.Position.To2D(), 300 + R.Level * 100, 270);
                        if (
                            DeathWalker.AllEnemys.Any(
                                ene => ene.IsValid && !ene.IsDead && pol.pointInside(ene.Position.To2D())))
                        {
                            R.Cast(tower.Position);
                        }
                        //if(pol.pointInside(target.Position.To2D()))
                    }
                }

                var aprTime = dist / E.Speed;
                var output  = Prediction.GetPrediction(target, aprTime);
                if (Player.Distance(output.UnitPosition, true) < 1050 * 1050)
                {
                    doFlyToMouse(output.UnitPosition.Extend(Player.Position, -75));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Exemple #4
0
        public static Vector3 getDashEndPos()
        {
            Vector2 dashPos2 = Player.GetDashInfo().EndPos;

            return(new Vector3(dashPos2, Player.ServerPosition.Z));
        }
Exemple #5
0
        public void HandleQ(Obj_AI_Hero comboTarget)
        {
            var QPrediction = Variables.Spells[SpellSlot.Q].GetPrediction(comboTarget);

            if (QPrediction.Hitchance >= HitChance.High)
            {
                var QPushDistance = 250;
                var QAccuracy = 20;
                var PlayerPosition = ObjectManager.Player.ServerPosition;

                var BeamStartPositions = new List<Vector3>()
                    {
                        QPrediction.CastPosition,
                        QPrediction.UnitPosition,
                        comboTarget.ServerPosition,
                        comboTarget.Position
                    };

                if (comboTarget.IsDashing())
                {
                    BeamStartPositions.Add(comboTarget.GetDashInfo().EndPos.To3D());
                }

                var PositionsList = new List<Vector3>();
                var CollisionPositions = new List<Vector3>();

                foreach (var position in BeamStartPositions)
                {
                    var collisionableObjects = Variables.Spells[SpellSlot.Q].GetCollision(position.To2D(),
                        new List<Vector2>() { position.Extend(PlayerPosition, -QPushDistance).To2D() });

                    if (collisionableObjects.Any())
                    {
                        if (collisionableObjects.Any(h => h is Obj_AI_Hero) &&
                            (collisionableObjects.All(h => h.IsValidTarget())))
                        {
                            Variables.Spells[SpellSlot.Q].Cast(QPrediction.CastPosition);
                            break;
                        }

                        for (var i = 0; i < QPushDistance; i += (int)comboTarget.BoundingRadius)
                        {
                            CollisionPositions.Add(position.Extend(PlayerPosition, -i));
                        }
                    }

                    for (var i = 0; i < QPushDistance; i += (int)comboTarget.BoundingRadius)
                    {
                        PositionsList.Add(position.Extend(PlayerPosition, -i));
                    }
                }

                if (PositionsList.Any())
                {
                    //We don't want to divide by 0 Kappa
                    var WallNumber = PositionsList.Count(p => p.IsWall()) * 1.3f;
                    var CollisionPositionCount = CollisionPositions.Count;
                    var Percent = (WallNumber + CollisionPositionCount) / PositionsList.Count;
                    var AccuracyEx = QAccuracy / 100f;
                    if (Percent >= AccuracyEx)
                    {
                        Variables.Spells[SpellSlot.Q].Cast(QPrediction.CastPosition);
                    }

                }
            }
            else if (QPrediction.Hitchance == HitChance.Collision)
            {
                var QCollision = QPrediction.CollisionObjects;
                if (QCollision.Count == 1)
                {
                    Variables.Spells[SpellSlot.Q].Cast(QPrediction.CastPosition);
                }
            }
        }
Exemple #6
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-40;
            var dister = target.Position.Extend(target.GetWaypoints()[1].To3D(), target.GetWaypoints()[1].To3D().Distance(target.Position) + 50);
              //  var pos1 = LeagueSharp.Common.Prediction.GetPrediction(target, dist / spell.Speed).UnitPosition - 40;
            var wts = Drawing.WorldToScreen(target.Position);
            var wtsx = target.GetWaypoints()[1];
            Drawing.DrawLine(wts[0], wts[1], wtsx[0], wtsx[1], 2f, System.Drawing.Color.Red);
            var e = pos1.Distance(target.GetWaypoints()[1].To3D());

            pos1.Extend(target.GetWaypoints()[1].To3D(), -e);
            Render.Circle.DrawCircle(dister, 10, System.Drawing.Color.GreenYellow, 2);
            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;

                    {
                        Game.PrintChat("Casteando por inface");
                       spell.Cast(target.Position);

                        return true;
                    }

                }*/
                // code of dashes
                if (target.IsDashing())
                {
                    float timeforArrive=(target.Position.Distance(target.GetDashInfo().EndPos.To3D()))/target.GetDashInfo().Speed;
                    float grabtime =( ObjectManager.Player.Position.Distance(target.GetDashInfo().EndPos.To3D())
                                     / spell.Speed)+spell.Delay;
                    if (timeforArrive<grabtime)
                    {
                        spell.Cast(target.GetDashInfo().EndPos);
                        return true;
                    }
                }
               /* 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;
        }
        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 - 40;
            var dister = target.Position.Extend(target.GetWaypoints()[1].To3D(), target.GetWaypoints()[1].To3D().Distance(target.Position) + 50);
            //  var pos1 = LeagueSharp.Common.Prediction.GetPrediction(target, dist / spell.Speed).UnitPosition - 40;
            var wts  = Drawing.WorldToScreen(target.Position);
            var wtsx = target.GetWaypoints()[1];

            Drawing.DrawLine(wts[0], wts[1], wtsx[0], wtsx[1], 2f, System.Drawing.Color.Red);
            var e = pos1.Distance(target.GetWaypoints()[1].To3D());

            pos1.Extend(target.GetWaypoints()[1].To3D(), -e);
            Render.Circle.DrawCircle(dister, 10, System.Drawing.Color.GreenYellow, 2);
            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;
                 *
                 *  {
                 *      Game.PrintChat("Casteando por inface");
                 *     spell.Cast(target.Position);
                 *
                 *      return true;
                 *  }
                 *
                 * }*/
                // code of dashes
                if (target.IsDashing())
                {
                    float timeforArrive = (target.Position.Distance(target.GetDashInfo().EndPos.To3D())) / target.GetDashInfo().Speed;
                    float grabtime      = (ObjectManager.Player.Position.Distance(target.GetDashInfo().EndPos.To3D())
                                           / spell.Speed) + spell.Delay;
                    if (timeforArrive < grabtime)
                    {
                        spell.Cast(target.GetDashInfo().EndPos);
                        return(true);
                    }
                }

                /* 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);
        }
Exemple #8
0
        private static void HandleQ(Obj_AI_Hero comboTarget)
        {
            var QPrediction = spells[SpellSlot.Q].GetPrediction(comboTarget);

            if (QPrediction.Hitchance >= HitChance.High)
            {
                if (spells[SpellSlot.Q].GetDamage(comboTarget) > comboTarget.Health + 15 && GetItemValue <bool>("dz191.bard.combo.qks"))
                {
                    spells[SpellSlot.Q].Cast(QPrediction.CastPosition);
                    return;
                }

                var QPushDistance  = GetItemValue <Slider>("dz191.bard.misc.distance").Value;
                var QAccuracy      = GetItemValue <Slider>("dz191.bard.misc.accuracy").Value;
                var PlayerPosition = ObjectManager.Player.ServerPosition;

                var BeamStartPositions = new List <Vector3>()
                {
                    QPrediction.CastPosition,
                    QPrediction.UnitPosition,
                    comboTarget.ServerPosition,
                    comboTarget.Position
                };

                if (comboTarget.IsDashing())
                {
                    BeamStartPositions.Add(comboTarget.GetDashInfo().EndPos.To3D());
                }

                var PositionsList      = new List <Vector3>();
                var CollisionPositions = new List <Vector3>();

                foreach (var position in BeamStartPositions)
                {
                    var collisionableObjects = spells[SpellSlot.Q].GetCollision(position.To2D(),
                                                                                new List <Vector2>()
                    {
                        position.Extend(PlayerPosition, -QPushDistance).To2D()
                    });

                    if (collisionableObjects.Any())
                    {
                        if (collisionableObjects.Any(h => h is Obj_AI_Hero) &&
                            (collisionableObjects.All(h => h.IsValidTarget())))
                        {
                            spells[SpellSlot.Q].Cast(QPrediction.CastPosition);
                            break;
                        }

                        for (var i = 0; i < QPushDistance; i += (int)comboTarget.BoundingRadius)
                        {
                            CollisionPositions.Add(position.Extend(PlayerPosition, -i));
                        }
                    }

                    for (var i = 0; i < QPushDistance; i += (int)comboTarget.BoundingRadius)
                    {
                        PositionsList.Add(position.Extend(PlayerPosition, -i));
                    }
                }

                if (PositionsList.Any())
                {
                    //We don't want to divide by 0 Kappa
                    var WallNumber             = PositionsList.Count(p => p.IsWall()) * 1.3f;
                    var CollisionPositionCount = CollisionPositions.Count;
                    var Percent    = (WallNumber + CollisionPositionCount) / PositionsList.Count;
                    var AccuracyEx = QAccuracy / 100f;
                    if (Percent >= AccuracyEx)
                    {
                        spells[SpellSlot.Q].Cast(QPrediction.CastPosition);
                    }
                }
            }
            else if (QPrediction.Hitchance == HitChance.Collision)
            {
                var QCollision = QPrediction.CollisionObjects;
                if (QCollision.Count == 1)
                {
                    spells[SpellSlot.Q].Cast(QPrediction.CastPosition);
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// Gets Predicted position while target is dashing
        /// </summary>
        private static Vector2 GetDashingPrediction(Obj_AI_Hero target, Spell s, out HitChance hc, Vector3 rangeCheckFrom)
        {
            if (target.IsDashing())
            {
                var dashInfo = target.GetDashInfo();

                float dashPassedDistance = (Utils.TickCount - dashInfo.StartTick) / 1000f * dashInfo.Speed;
                Vector2 currentDashPos = dashInfo.StartPos + (dashInfo.EndPos - dashInfo.StartPos).Normalized() * dashPassedDistance;

                float targetDistance = rangeCheckFrom.To2D().Distance(currentDashPos);
                float flyTime = 0f;

                if (s.Speed != 0) //skillshot with a missile
                {
                    Vector2 Vt = (dashInfo.Path[dashInfo.Path.Count - 1] - dashInfo.Path[0]).Normalized() * dashInfo.Speed;
                    Vector2 Vs = (target.ServerPosition.To2D() - rangeCheckFrom.To2D()).Normalized() * s.Speed;
                    Vector2 Vr = Vs - Vt;

                    flyTime = targetDistance / Vr.Length();
                }
                int dashLeftTime = dashInfo.EndTick - Utils.TickCount;
                float t = flyTime + s.Delay + Game.Ping / 1000f;

                if (dashLeftTime >= t * 1000f)
                {
                    float distance = t * dashInfo.Speed;
                    hc = HitChance.Dashing;

                    for (int i = 0; i < dashInfo.Path.Count - 1; i++)
                    {
                        float d = dashInfo.Path[i + 1].Distance(dashInfo.Path[i]);
                        if (distance == d)
                            return dashInfo.Path[i + 1];
                        else if (distance < d)
                            return dashInfo.Path[i] + distance * (dashInfo.Path[i + 1] - dashInfo.Path[i]).Normalized();
                        else distance -= d;
                    }
                }
            }

            hc = HitChance.Impossible;
            return rangeCheckFrom.To2D();
        }