Exemple #1
0
        public void Jump(Vector3 pos, bool juke = false, bool castq = true)
        {
            Orbwalker.Orbwalk(null, pos);
            if (Math.Abs(Spells[E].Cooldown) < 0.00001)
            {
                var extended = ObjectManager.Player.ServerPosition.To2D().Extend(pos.To2D(), 800f);
                if (!JumpTo.IsValid())
                {
                    JumpTo = pos.To2D();
                }

                if (Spells[W].IsReady() && Helpers.SoldierMgr.ActiveSoldiers.Count == 0)
                {
                    if (juke)
                    {
                        var outRadius = 250 / (float)Math.Cos(2 * Math.PI / 12);

                        for (int i = 1; i <= 12; i++)
                        {
                            var   angle = i * 2 * Math.PI / 12;
                            float x     = ObjectManager.Player.Position.X + outRadius * (float)Math.Cos(angle);
                            float y     = ObjectManager.Player.Position.Y + outRadius * (float)Math.Sin(angle);
                            if (NavMesh.GetCollisionFlags(x, y).HasFlag(CollisionFlags.Wall) && !ObjectManager.Player.ServerPosition.To2D().Extend(new Vector2(x, y), 500f).IsWall())
                            {
                                Spells[W].Cast(ObjectManager.Player.ServerPosition.To2D().Extend(new Vector2(x, y), 800f));
                                return;
                            }
                        }
                    }
                    Spells[W].Cast(extended);
                }

                if (Helpers.SoldierMgr.ActiveSoldiers.Count > 0 && Spells[Q].IsReady())
                {
                    var closestSoldier = Helpers.SoldierMgr.ActiveSoldiers.MinOrDefault(s => s.Position.To2D().Distance(extended, true));
                    CastELocation = closestSoldier.Position.To2D();
                    CastQLocation = closestSoldier.Position.To2D().Extend(JumpTo, 800f);

                    if (CastELocation.Distance(JumpTo) > ObjectManager.Player.ServerPosition.To2D().Distance(JumpTo) && !juke && castq)
                    {
                        CastQLocation = extended;
                        CastET        = Utils.TickCount + 250;
                        Spells[Q].Cast(CastQLocation);
                    }
                    else
                    {
                        Spells[E].Cast(CastELocation, true);
                        if (ObjectManager.Player.ServerPosition.To2D().Distance(CastELocation) < 700 && castq)
                        {
                            LeagueSharp.Common.Utility.DelayAction.Add(250, () => Spells[Q].Cast(CastQLocation, true));
                        }
                    }
                }
            }
            else
            {
                if (Spells[Q].IsReady() && CastELocation.Distance(ObjectManager.Player.ServerPosition) <= 200 && castq)
                {
                    Spells[Q].Cast(CastQLocation, true);
                }

                JumpTo = Vector2.Zero;
            }
        }