Beispiel #1
0
        //fluxy
        public static bool WallBangable(this AIHeroClient hero, Vector2 pos = new Vector2())
        {
            if (hero.HasBuffOfType(BuffType.SpellImmunity) || hero.HasBuffOfType(BuffType.SpellShield)) return false;
            var qprediction = SpellManager.Q.GetPrediction(hero);
            var qpredlist = pos.IsValid() ? new List<Vector3> { pos.To3D() } : new List<Vector3>
                        {
                            hero.ServerPosition,
                            hero.Position,
                            qprediction.CastPosition,
                            qprediction.UnitPosition
                        };

            var bangableWalls = 0;
            _points = new List<Vector2>();
            foreach (var position in qpredlist)
            {
                for (var i = 0; i < Config.Modes.Combo.QBindDistance; i += (int)hero.BoundingRadius)
                {
                    var cPos = BardPitt.Position.Extend(position, BardPitt.Distance(position) + i).To3D();
                    _points.Add(cPos.To2D());
                    if (NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Building))
                    {
                        bangableWalls++;
                        break;
                    }
                }
            }
            if (bangableWalls / qpredlist.Count >= Config.Modes.Combo.QAccuracyPercent / 100f)
            {
                return true;
            }

            return false;
        }
Beispiel #2
0
        /// <summary>
        /// This requires a world target point,
        /// tuning parameters, and the time step.
        /// </summary>
        /// <param name="body">The body.</param>
        /// <param name="worldAnchor">The target.</param>
        public FixedMouseJoint(Body body, Vector2 worldAnchor)
            : base(body)
        {
            JointType    = JointType.FixedMouse;
            Frequency    = 5.0f;
            DampingRatio = 0.7f;
            MaxForce     = 1000 * body.Mass;

            Debug.Assert(worldAnchor.IsValid());

            _worldAnchor = worldAnchor;
            LocalAnchorA = MathUtils.MulT(BodyA._xf, worldAnchor);
        }
Beispiel #3
0
        /// <summary>
        /// This requires a world target point,
        /// tuning parameters, and the time step.
        /// </summary>
        /// <param name="body">The body.</param>
        /// <param name="worldAnchor">The target.</param>
        public FixedMouseJoint(Body body, Vector2 worldAnchor)
            : base(body)
        {
            JointType    = JointType.FixedMouse;
            Frequency    = 5.0f;
            DampingRatio = 0.7f;
            MaxForce     = 1000 * body.Mass;

            Debug.Assert(worldAnchor.IsValid());

            _worldAnchor = worldAnchor;
            LocalAnchorA = Transform.Divide(ref worldAnchor, ref BodyA._xf);
        }
Beispiel #4
0
        public static bool IsCondemable(AIHeroClient unit, Vector2 pos = new Vector2())
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) ||
                LastCheck + 50 > Environment.TickCount || Variables._Player.IsDashing())
            {
                return(false);
            }
            var prediction      = Program.E2.GetPrediction(unit);
            var predictionsList = pos.IsValid()
                ? new List <Vector3>()
            {
                pos.To3D()
            }
                : new List <Vector3>
            {
                unit.ServerPosition,
                unit.Position,
                prediction.CastPosition,
                prediction.UnitPosition
            };

            var wallsFound = 0;

            Variables.Points = new List <Vector2>();
            foreach (var position in predictionsList)
            {
                for (var i = 0;
                     i < MenuManager.CondemnMenu["pushDistance"].Cast <Slider>().CurrentValue;
                     i += (int)unit.BoundingRadius)
                {
                    var cPos =
                        Variables._Player.Position.Extend(position, Variables._Player.Distance(position) + i)
                        .To3D();
                    Variables.Points.Add(cPos.To2D());
                    if (NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Wall) ||
                        NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Building))
                    {
                        wallsFound++;
                        break;
                    }
                }
            }
            if ((wallsFound / predictionsList.Count) >=
                MenuManager.CondemnMenu["condemnPercent"].Cast <Slider>().CurrentValue / 100f)
            {
                return(true);
            }

            return(false);
        }
Beispiel #5
0
        public static AIHeroClient GetTarget(float range, DamageType type, Vector2 secondaryPos = new Vector2())
        {
            if (_target == null || _target.IsDead || _target.Health <= 0 || !_target.IsValidTarget())
            {
                _target = null;
            }

            if (secondaryPos.IsValid() && _target.Distance(secondaryPos) < range || _target.IsValidTarget(range))
            {
                return(_target);
            }

            return(TargetSelector.GetTarget(range, type));
        }
Beispiel #6
0
        private void LockROnTarget(Obj_AI_Hero Target)
        {
            var PredR = R.GetPrediction(Target).CastPosition.To2D();
            var Pos   = new Vector2((float)(PredR.X + REndPos.X * R.Range * 0.98), (float)(PredR.Y + REndPos.Y * R.Range * 0.98));

            if (PredR.IsValid() && Pos.IsValid() && !Utility.IsWall(Pos.To3D()) && PredR.Distance(Pos) <= R.Range && PredR.Distance(Pos) > 100)
            {
                Player.IssueOrder(GameObjectOrder.MoveTo, Pos.To3D());
            }
            else
            {
                Player.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos);
            }
        }
        private static void Game_OnUpdate(EventArgs args)
        {
            if (!OrbwalkLastClickActive)
            {
                return;
            }
            Combo();
            var target = GetTarget();

            Orbwalking.Orbwalk(
                Orbwalking.InAutoAttackRange(target) ? target : null,
                LastClickPoint.IsValid() ? LastClickPoint.To3D() : Game.CursorPos,
                80,
                50, false, false, false);
        }
        /// <summary>
        /// This requires a world target point,
        /// tuning parameters, and the time step.
        /// </summary>
        /// <param name="body">The body.</param>
        /// <param name="worldAnchor">The target.</param>
        public FixedMouseJoint(Body body, Vector2 worldAnchor)
            : base(body)
        {
            JointType = JointType.FixedMouse;
            Frequency = 5.0f;
            DampingRatio = 0.7f;

            Debug.Assert(worldAnchor.IsValid());

            Transform xf1;
            BodyA.GetTransform(out xf1);

            _worldAnchor = worldAnchor;
            LocalAnchorA = BodyA.GetLocalPoint(worldAnchor);
        }
Beispiel #9
0
        public static bool IsWall(this Vector2 pos)
        {
            if (!pos.IsValid())
            {
                return(false);
            }

            var ipos = pos.ToNavMeshCell().CollFlags;

            if (ipos.HasFlag(CollisionFlags.Wall) || ipos.HasFlag(CollisionFlags.Building))
            {
                return(true);
            }
            return(false);
        }
Beispiel #10
0
        public static void SetPosition(Vector2 position = new Vector2())
        {
            position = position.IsValid() ? position : Cursor.ScreenPosition;

            if (position == Vector2.Zero)
            {
                return;
            }

            if (Position.Distance(position) < 100)
            {
                CursorSprite.Position = position.GetRelativePosition();
            }

            //MouseManager.StartPath(position);
        }
        private Mat22 _mass; // effective mass for point-to-point constraint.

        /// <summary>
        /// This requires a world target point,
        /// tuning parameters, and the time step.
        /// </summary>
        /// <param name="body">The body.</param>
        /// <param name="target">The target.</param>
        public FixedMouseJoint(Body body, Vector2 target)
            : base(body)
        {
            JointType    = JointType.FixedMouse;
            Frequency    = 5.0f;
            DampingRatio = 0.7f;

            Debug.Assert(target.IsValid());

            Transform xf1;

            BodyA.GetTransform(out xf1);

            LocalAnchorB = target;
            LocalAnchorA = MathUtils.MultiplyT(ref xf1, LocalAnchorB);
        }
        /// <summary>
        /// This requires a world target point,
        /// tuning parameters, and the time step.
        /// </summary>
        /// <param name="body">The body.</param>
        /// <param name="worldAnchor">The target.</param>
        public FixedMouseJoint(Body body, Vector2 worldAnchor)
            : base(body)
        {
            JointType    = JointType.FixedMouse;
            Frequency    = 5.0f;
            DampingRatio = 0.7f;

            Debug.Assert(worldAnchor.IsValid());

            Transform xf1;

            BodyA.GetTransform(out xf1);

            _worldAnchor = worldAnchor;
            LocalAnchorA = BodyA.GetLocalPoint(worldAnchor);
        }
Beispiel #13
0
        public static bool ExtençãodeObjeto(this AIHeroClient OlhaSó, Vector2 VejaBem = new Vector2())
        {
            if (OlhaSó.HasBuffOfType(BuffType.SpellImmunity) || OlhaSó.HasBuffOfType(BuffType.SpellShield) ||
                UtimiHitemverificação + 50 > Environment.TickCount || jogadorJoob.IsDashing())
            {
                return(false);
            }
            var PrevisãodoMeuRabo = EextençãodaSpell.GetPrediction(OlhaSó);
            var previsão          = VejaBem.IsValid()
                ? new List <Vector3>()
            {
                VejaBem.To3D()
            }
                : new List <Vector3>
            {
                OlhaSó.ServerPosition,
                OlhaSó.Position,
                PrevisãodoMeuRabo.CastPosition,
                PrevisãodoMeuRabo.UnitPosition
            };

            var Cordenação = 0;

            VayneTy.PosiçãoDoInimigo = new List <Vector2>();
            foreach (var position in previsão)
            {
                for (var terounãotero = 0;
                     terounãotero < VayneTy.vKil["GoodPush"].Cast <Slider>().CurrentValue;
                     terounãotero += (int)OlhaSó.BoundingRadius)
                {
                    var cPos = jogadorJoob.Position.Extend(position, jogadorJoob.Distance(position) + terounãotero).To3D();
                    VayneTy.PosiçãoDoInimigo.Add(cPos.To2D());
                    if (NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Wall) ||
                        NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Building))
                    {
                        Cordenação++;
                        break;
                    }
                }
            }
            if ((Cordenação / previsão.Count) >= VayneTy.vKil["Precentir"].Cast <Slider>().CurrentValue / 100f)
            {
                return(true);
            }

            return(false);
        }
Beispiel #14
0
        public static void Obj_AI_Base_OnIssueOrder(Obj_AI_Base sender, PlayerIssueOrderEventArgs args)
        {
            if (!BurstKey.GetValue <KeyBind>().Active)
            {
                return;
            }
            if (!sender.IsMe)
            {
                return;
            }
            if (args.Order != GameObjectOrder.AttackUnit)
            {
                return;
            }
            if (args.Target == null)
            {
                return;
            }
            if (!(args.Target is Obj_AI_Base))
            {
                return;
            }
            if (Player.Distance(args.Target.Position) > Player.BoundingRadius + Player.AttackRange + args.Target.BoundingRadius - 20)
            {
                return;
            }
            var target = args.Target;

            LeagueSharp.Common.Utility.DelayAction.Add(Game.Ping - Game.Ping, () =>
            {
                if (E.IsReady() && !R.IsReady())
                {
                    List <Vector2> positions = new List <Vector2>();
                    for (int i = 250; i <= 425; i += 5)
                    {
                        positions.Add(Player.Position.To2D().Extend(Game.CursorPos.To2D(), 250));
                    }
                    Vector2 position = positions.OrderBy(x => x.Distance(target.Position)).FirstOrDefault();
                    if (position.IsValid() && target.Position.To2D().Distance(position) <= Player.AttackRange + Player.BoundingRadius)
                    {
                        E.Cast(position);
                    }
                }
            }
                                                       );
        }
Beispiel #15
0
        public static bool Condemn360(Obj_AI_Hero unit, int push, Vector2 pos = new Vector2())
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) ||
                _lastCheck + 50 > Environment.TickCount || ObjectManager.Player.IsDashing())
            {
                return(false);
            }

            var prediction      = E.GetPrediction(unit);
            var predictionsList = pos.IsValid() ? new List <Vector3>()
            {
                pos.ToVector3()
            } : new List <Vector3>
            {
                unit.ServerPosition,
                unit.Position,
                prediction.CastPosition,
                prediction.UnitPosition
            };

            var wallsFound = 0;

            _points = new List <Vector2>();
            foreach (var position in predictionsList)
            {
                for (var i = 0; i < push; i += (int)unit.BoundingRadius) // 420 = push distance
                {
                    var cPos = ObjectManager.Player.Position.Extend(position, ObjectManager.Player.Distance(position) + i).ToVector2();
                    _points.Add(cPos);
                    if (NavMesh.GetCollisionFlags(cPos.ToVector3()).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos.ToVector3()).HasFlag(CollisionFlags.Building))
                    {
                        wallsFound++;
                        break;
                    }
                }
            }

            // ReSharper disable once PossibleLossOfFraction
            if ((wallsFound / predictionsList.Count) >= 33 / 100f)
            {
                return(true);
            }

            return(false);
        }
Beispiel #16
0
 private static void AfterAttackCombo(AIHeroClient target)
 {
     canCast = false;
     if (E.IsReady())
     {
         var posPlayer = Player.ServerPosition.ToVector2();
         var posTarget = target.ServerPosition.ToVector2();
         var posDashTo = new Vector2();
         var posAfterE =
             CheckDashPos(posPlayer.CircleCircleIntersection(posTarget, E.Range, 500 + Player.BoundingRadius));
         if (posAfterE.IsValid())
         {
             posDashTo = posAfterE;
         }
         else
         {
             posAfterE = posPlayer.Extend(posTarget, -E.Range);
             if (Player.HealthPercent >= 80 || !posAfterE.IsUnderEnemyTurret() ||
                 posAfterE.CountEnemyHeroesInRange(E.Range, target)
                 < posAfterE.CountAllyHeroesInRange(E.Range, Player))
             {
                 posDashTo = posAfterE;
             }
         }
         if (!posDashTo.IsValid())
         {
             posDashTo = Game.CursorPos.ToVector2();
         }
         if (E.Cast(posDashTo))
         {
             lastE = Variables.TickCount;
             return;
         }
     }
     if (Q.CastOnUnit(target))
     {
         return;
     }
     if (W.Cast(W.GetPredPosition(target)))
     {
         return;
     }
     canCast = true;
 }
Beispiel #17
0
        private void LockROnTarget(Obj_AI_Hero Target)
        {
            var PredR    = R.GetPrediction(Target).CastPosition;
            var Pos      = new Vector2(PredR.X + REndPos.X * R.Range * 0.98f, PredR.Y + REndPos.Y * R.Range * 0.98f).To3D();
            var ClosePos = Player.Position.To2D().Closest(new Vector2[] { PredR.To2D(), Pos.To2D() }.ToList()).To3D();

            if (ClosePos.IsValid() && !ClosePos.IsWall() && PredR.Distance(ClosePos) > E.Range)
            {
                Player.IssueOrder(GameObjectOrder.MoveTo, ClosePos);
            }
            else if (Pos.IsValid() && !Pos.IsWall() && PredR.Distance(Pos) < R.Range && PredR.Distance(Pos) > 100)
            {
                Player.IssueOrder(GameObjectOrder.MoveTo, Pos);
            }
            else
            {
                Player.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos);
            }
        }
Beispiel #18
0
        /// <summary>
        /// This requires a world target point,
        /// tuning parameters, and the time step.
        /// </summary>
        /// <param name="def"></param>
        public MouseJoint(Body bodyA, Body bodyB, Vector2 target)
            : base(bodyA, bodyB)
        {
            JointType    = JointType.Mouse;
            Frequency    = 5.0f;
            DampingRatio = 0.7f;

            Debug.Assert(target.IsValid());
            //Debug.Assert(MathUtils.IsValid(def.MaxForce) && def.MaxForce >= 0.0f);
            //Debug.Assert(MathUtils.IsValid(def.FrequencyHz) && def.FrequencyHz >= 0.0f);
            //Debug.Assert(MathUtils.IsValid(def.DampingRatio) && def.DampingRatio >= 0.0f);

            Transform xf1;

            BodyB.GetTransform(out xf1);

            LocalAnchorB = target;
            LocalAnchorA = MathUtils.MultiplyT(ref xf1, LocalAnchorB);
        }
Beispiel #19
0
        public bool IsCondemable(Obj_AI_Hero unit, Vector2 pos = new Vector2())
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || LastCheck + 50 > Environment.TickCount || ObjectManager.Player.IsDashing())
            {
                return(false);
            }
            var prediction      = Spells[E].GetPrediction(unit);
            var predictionsList = pos.IsValid() ? new List <Vector3>()
            {
                pos.To3D()
            } : new List <Vector3>
            {
                unit.ServerPosition,
                unit.Position,
                prediction.CastPosition,
                prediction.UnitPosition
            };

            var wallsFound = 0;

            Points = new List <Vector2>();
            foreach (var position in predictionsList)
            {
                for (var i = 0; i < Config.Item("condemn.distance").GetValue <Slider>().Value; i += (int)unit.BoundingRadius) // 420 = push distance
                {
                    var cPos = ObjectManager.Player.Position.Extend(position, ObjectManager.Player.Distance(position) + i).To2D();
                    Points.Add(cPos);
                    if (NavMesh.GetCollisionFlags(cPos.To3D()).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos.To3D()).HasFlag(CollisionFlags.Building))
                    {
                        wallsFound++;
                        break;
                    }
                }
            }
            if ((wallsFound / predictionsList.Count) >= 33 / 100f)
            {
                return(true);
            }

            return(false);
        }
Beispiel #20
0
        protected virtual void Drawing_OnEndScene(EventArgs args)
        {
            if (config.Item("WaypointActive").GetValue <bool>())
            {
                foreach (Obj_AI_Hero enemy in ObjectManager.Get <Obj_AI_Hero>())
                {
                    if (enemy.IsEnemy && !enemy.IsDead && enemy.IsValid && enemy.IsVisible)
                    {
                        List <Vector2> waypoints = enemy.GetWaypoints();

                        Vector2 waypoint  = Drawing.WorldToMinimap(waypoints[0].To3D());
                        Vector2 waypoint2 = Drawing.WorldToMinimap(waypoints[waypoints.Count - 1].To3D());

                        if (waypoint2.IsValid())
                        {
                            Drawing.DrawLine(waypoint[0], waypoint[1], waypoint2[0], waypoint2[1], 2, System.Drawing.Color.Red);
                        }
                    }
                }
            }
        }
Beispiel #21
0
        public static void Condemn360(AIHeroClient hero, Vector2 pos = new Vector2())
        {
            if (hero.HasBuffOfType(BuffType.SpellImmunity) || hero.HasBuffOfType(BuffType.SpellShield) ||
                LastCheck + 50 > Environment.TickCount || ObjectManager.Player.IsDashing())
            {
                return;
            }
            var prediction      = VayneSpells.E.GetPrediction(hero);
            var predictionsList = pos.IsValid() ? new List <Vector3>()
            {
                pos.To3D()
            } : new List <Vector3>
            {
                hero.ServerPosition,
                hero.Position,
                prediction.CastPosition,
                prediction.UnitPosition
            };

            var wallsFound = 0;

            Points = new List <Vector2>();
            foreach (var position in predictionsList)
            {
                for (var i = 0; i < PushDistance; i += (int)hero.BoundingRadius) // 420 = push distance
                {
                    var cPos = ObjectManager.Player.Position.Extend(position, ObjectManager.Player.Distance(position) + i).To2D();
                    Points.Add(cPos);
                    if (NavMesh.GetCollisionFlags(cPos.To3D()).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos.To3D()).HasFlag(CollisionFlags.Building))
                    {
                        wallsFound++;
                        break;
                    }
                }
            }
            if ((wallsFound / predictionsList.Count) >= 33 / 100f)
            {
                VayneSpells.E.Cast(hero);
            }
        }
Beispiel #22
0
        public static bool canBeCondemned(AIHeroClient unit, Vector2 pos = new Vector2())
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || Check + 50 > Environment.TickCount || ObjectManager.Player.IsDashing())
            {
                return(false);
            }
            var pred = pos.IsValid() ? new List <Vector3>()
            {
                pos.To3D()
            } : new List <Vector3>
            {
                unit.ServerPosition,
                unit.Position,
                Vayne.E.GetPrediction(unit).CastPosition,
                Vayne.E.GetPrediction(unit).UnitPosition
            };

            var walls = 0;

            Points = new List <Vector2>();
            foreach (var position in pred)
            {
                for (var i = 0; i < Vayne.emenu.Item("PushDistance").GetValue <Slider>().Value; i += (int)unit.BoundingRadius)
                {
                    var Pos = ObjectManager.Player.Position.Extend(position, ObjectManager.Player.Distance(position) + i).To2D();
                    Points.Add(Pos);
                    if (NavMesh.GetCollisionFlags(Pos.To3D()).
                        HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(Pos.To3D()).HasFlag(CollisionFlags.Building))
                    {
                        walls++;
                        break;
                    }
                }
            }
            if ((walls / pred.Count) >= 33 / 100f)
            {
                return(true);
            }
            return(false);
        }
Beispiel #23
0
        //fluxy
        public static bool WallBangable(this AIHeroClient hero, Vector2 pos = new Vector2())
        {
            if (hero.HasBuffOfType(BuffType.SpellImmunity) || hero.HasBuffOfType(BuffType.SpellShield))
            {
                return(false);
            }
            var qprediction = SpellManager.Q.GetPrediction(hero);
            var qpredlist   = pos.IsValid() ? new List <Vector3> {
                pos.To3D()
            } : new List <Vector3>
            {
                hero.ServerPosition,
                hero.Position,
                qprediction.CastPosition,
                qprediction.UnitPosition
            };

            var bangableWalls = 0;

            _points = new List <Vector2>();
            foreach (var position in qpredlist)
            {
                for (var i = 0; i < Config.Modes.Combo.QBindDistance; i += (int)hero.BoundingRadius)
                {
                    var cPos = BardPitt.Position.Extend(position, BardPitt.Distance(position) + i).To3D();
                    _points.Add(cPos.To2D());
                    if (NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Building))
                    {
                        bangableWalls++;
                        break;
                    }
                }
            }
            if (bangableWalls / qpredlist.Count >= Config.Modes.Combo.QAccuracyPercent / 100f)
            {
                return(true);
            }

            return(false);
        }
Beispiel #24
0
        public static void LucianRLock()
        {
            var currentTarget = Variables.spells[SpellSlot.R].GetTarget();

            if (currentTarget.IsValidTarget())
            {
                var predictedPosition    = Variables.spells[SpellSlot.R].GetPrediction(currentTarget).UnitPosition;
                var directionVector      = (currentTarget.ServerPosition - ObjectManager.Player.ServerPosition).Normalized();
                var RRangeCoefficient    = 0.95f;
                var RRangeAdjusted       = Variables.spells[SpellSlot.R].Range * RRangeCoefficient;
                var REndPointXCoordinate = predictedPosition.X + directionVector.X * RRangeAdjusted;
                var REndPointYCoordinate = predictedPosition.Y + directionVector.Y * RRangeAdjusted;
                var REndPoint            = new Vector2(REndPointXCoordinate, REndPointYCoordinate).To3D();

                if (REndPoint.IsValid() &&
                    REndPoint.Distance(ObjectManager.Player.ServerPosition) < Variables.spells[SpellSlot.R].Range &&
                    !REndPoint.IsWall())
                {
                    Variables.Orbwalker.SetOrbwalkingPoint(REndPoint);
                }
            }
        }
        private static void Orbwalking_OnAttack(AttackableUnit unit, AttackableUnit target)
        {
            if (BadaoMainVariables.Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Combo)
            {
                return;
            }
            if (!unit.IsMe)
            {
                return;
            }
            int delay2 = 200;

            Utility.DelayAction.Add(Game.Ping - Game.Ping, () =>
            {
                if (BadaoMainVariables.E.IsReady() && BadaoGravesVariables.ComboE.GetValue <bool>())
                {
                    List <Vector2> positions = new List <Vector2>();
                    for (int i = 250; i <= 425; i += 5)
                    {
                        positions.Add(Player.Position.To2D().Extend(Game.CursorPos.To2D(), 250 /*i*/));
                    }
                    Vector2 position = positions.OrderBy(x => x.Distance(target.Position)).FirstOrDefault();
                    if (position.IsValid() && target.Position.To2D().Distance(position) <= Player.AttackRange + Player.BoundingRadius)
                    {
                        BadaoMainVariables.E.Cast(position);
                        //for (int i = 0; i < delay2; i = i + 5)
                        //{
                        //    Utility.DelayAction.Add(i, () =>
                        //    {
                        //        Game.SendEmote(Emote.Dance);
                        //        Player.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos);
                        //        Player.IssueOrder(GameObjectOrder.AttackUnit, target);
                        //    });
                        //}
                    }
                }
            }
                                    );
        }
Beispiel #26
0
        public static void CastETarget(AIHeroClient target, int extraDistance = 50)
        {
            var     pred        = Prediction.GetPrediction(target, 1.25f + (float)Game.Ping / 1000f);
            Vector2 UnitPredPos = pred.UnitPosition.To2D();

            if (target.IsChannelingImportantSpell() && pred.UnitPosition.Distance(target.Position) <= 50)
            {
                UnitPredPos = target.Position.To2D();
            }
            else if (pred.UnitPosition.Distance(target.Position) <= 20)
            {
                return;
            }
            else
            {
                UnitPredPos = pred.UnitPosition.To2D().Extend(target.Position.To2D(), 0);
            }
            List <Vector2> extraPoses = new List <Vector2>();
            List <Vector2> CastPoses  = new List <Vector2>();
            Vector2        direction  = UnitPredPos.Extend(target.Direction.To2D(), extraDistance);

            for (int i = 0; i < 360; i = i + 5)
            {
                extraPoses.Add(BadaoChecker.BadaoRotateAround(direction, UnitPredPos, BadaoChecker.AngleToRadian(i)));
            }
            foreach (var pos in extraPoses)
            {
                CastPoses.Add(pos.Extend(UnitPredPos, 300));
            }
            Vector2 CastPos = CastPoses.Where(x => BadaoMainVariables.E.IsInRange(x)).OrderByDescending(x => x.Distance(target.Position) <= 300)
                              .ThenByDescending(x => LeagueSharp.Common.Utility.CountEnemiesInRange(x.To3D(), 300)).FirstOrDefault();

            if (CastPos != null && CastPos.IsValid())
            {
                BadaoMainVariables.E.Cast(CastPos);
            }
        }
Beispiel #27
0
        private static void LockQOnTarget()
        {
            var target = SpellManager.Q.GetTarget();

            if (target == null)
            {
                return;
            }
            var endPos       = (Player.ServerPosition - target.ServerPosition).Normalized();
            var predPos      = SpellManager.E.GetPrediction(target).CastPosition.To2D();
            var fullPoint    = new Vector2(predPos.X + endPos.X * SpellManager.Q.Range, predPos.Y + endPos.Y * SpellManager.Q.Range);
            var closestPoint = Player.ServerPosition.To2D().Closest(new List <Vector2> {
                predPos, fullPoint
            });

            if (closestPoint.IsValid() && !closestPoint.IsWall() && predPos.Distance(closestPoint) > SpellManager.Q.Range)
            {
                EloBuddy.Player.IssueOrder(GameObjectOrder.MoveTo, closestPoint.To3D());
            }
            else if (fullPoint.IsValid() && !fullPoint.IsWall() && predPos.Distance(fullPoint) < SpellManager.Q.Range && predPos.Distance(fullPoint) > 100)
            {
                EloBuddy.Player.IssueOrder(GameObjectOrder.MoveTo, fullPoint.To3D());
            }
        }
Beispiel #28
0
        private static void OnDetectSkillshot(Skillshot skillshot)
        {
            try
            {
                //Check if the skillshot is already added.
                var alreadyAdded = false;

                // Integration disabled
                if (!Menu.Item("SkillshotsActive").GetValue <bool>())
                {
                    return;
                }

                foreach (var item in DetectedSkillshots)
                {
                    if (item.SpellData.SpellName == skillshot.SpellData.SpellName &&
                        (item.Unit.NetworkId == skillshot.Unit.NetworkId &&
                         (skillshot.Direction).AngleBetween(item.Direction) < 5 &&
                         (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0)))
                    {
                        alreadyAdded = true;
                    }
                }

                //Check if the skillshot is from an ally.
                if (skillshot.Unit.IsAlly)
                {
                    return;
                }

                //Check if the skillshot is too far away.
                if (skillshot.Start.Distance(ObjectManager.Player.ServerPosition.To2D()) >
                    (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
                {
                    return;
                }


                //Add the skillshot to the detected skillshot list.
                if (!alreadyAdded)
                {
                    //Multiple skillshots like twisted fate Q.
                    if (skillshot.DetectionType == DetectionType.ProcessSpell)
                    {
                        if (skillshot.SpellData.MultipleNumber != -1)
                        {
                            var originalDirection = skillshot.Direction;

                            for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                                 i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                                 i++)
                            {
                                var end = skillshot.Start +
                                          skillshot.SpellData.Range *
                                          originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i);
                                var skillshotToAdd = new Skillshot(
                                    skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start,
                                    end, skillshot.Unit);

                                DetectedSkillshots.Add(skillshotToAdd);
                            }
                            return;
                        }

                        if (skillshot.SpellData.SpellName == "UFSlash")
                        {
                            skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed;
                        }

                        if (skillshot.SpellData.Invert)
                        {
                            var newDirection   = -(skillshot.End - skillshot.Start).Normalized();
                            var end            = skillshot.Start + newDirection * skillshot.Start.Distance(skillshot.End);
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end,
                                skillshot.Unit);
                            DetectedSkillshots.Add(skillshotToAdd);
                            return;
                        }

                        if (skillshot.SpellData.Centered)
                        {
                            var start          = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range;
                            var end            = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range;
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                                skillshot.Unit);
                            DetectedSkillshots.Add(skillshotToAdd);
                            return;
                        }

                        if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
                        {
                            var angle = 60;
                            var edge1 =
                                (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated(
                                    -angle / 2 * (float)Math.PI / 180);
                            var edge2 = edge1.Rotated(angle * (float)Math.PI / 180);

                            foreach (var minion in ObjectManager.Get <Obj_AI_Minion>())
                            {
                                var v = minion.ServerPosition.To2D() - skillshot.Unit.ServerPosition.To2D();
                                if (minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 &&
                                    minion.Distance(skillshot.Unit, false) < 800 && (minion.Team != ObjectManager.Player.Team))
                                {
                                    var start = minion.ServerPosition.To2D();
                                    var end   = skillshot.Unit.ServerPosition.To2D()
                                                .Extend(
                                        minion.ServerPosition.To2D(),
                                        skillshot.Unit.Distance(minion, false) > 200 ? 1300 : 1000);

                                    var skillshotToAdd = new Skillshot(
                                        skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                                        skillshot.Unit);
                                    DetectedSkillshots.Add(skillshotToAdd);
                                }
                            }
                            return;
                        }

                        if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid")
                        {
                            var start          = skillshot.End - skillshot.Direction.Perpendicular() * 400;
                            var end            = skillshot.End + skillshot.Direction.Perpendicular() * 400;
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                                skillshot.Unit);
                            DetectedSkillshots.Add(skillshotToAdd);
                            return;
                        }

                        if (skillshot.SpellData.SpellName == "ZiggsQ")
                        {
                            var d1 = skillshot.Start.Distance(skillshot.End);
                            var d2 = d1 * 0.4f;
                            var d3 = d2 * 0.69f;


                            var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                            var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");

                            var bounce1Pos = skillshot.End + skillshot.Direction * d2;
                            var bounce2Pos = bounce1Pos + skillshot.Direction * d3;

                            bounce1SpellData.Delay =
                                (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                            bounce2SpellData.Delay =
                                (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);

                            var bounce1 = new Skillshot(
                                skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End,
                                bounce1Pos, skillshot.Unit);
                            var bounce2 = new Skillshot(
                                skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos,
                                skillshot.Unit);

                            DetectedSkillshots.Add(bounce1);
                            DetectedSkillshots.Add(bounce2);
                        }

                        if (skillshot.SpellData.SpellName == "ZiggsR")
                        {
                            skillshot.SpellData.Delay =
                                (int)
                                (1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
                        }

                        if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
                        {
                            var endPos = new Vector2();

                            foreach (var s in DetectedSkillshots)
                            {
                                if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E)
                                {
                                    endPos = s.End;
                                }
                            }

                            foreach (var m in ObjectManager.Get <Obj_AI_Minion>())
                            {
                                if (m.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team &&
                                    skillshot.IsDanger(m.Position.To2D()))
                                {
                                    endPos = m.Position.To2D();
                                }
                            }

                            if (!endPos.IsValid())
                            {
                                return;
                            }

                            skillshot.End       = endPos + 200 * (endPos - skillshot.Start).Normalized();
                            skillshot.Direction = (skillshot.End - skillshot.Start).Normalized();
                        }
                    }

                    if (skillshot.SpellData.SpellName == "OriannasQ")
                    {
                        var endCSpellData = SpellDatabase.GetByName("OriannaQend");

                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, endCSpellData, skillshot.StartTick, skillshot.Start, skillshot.End,
                            skillshot.Unit);

                        DetectedSkillshots.Add(skillshotToAdd);
                    }


                    //Dont allow fow detection.
                    if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
                    {
                        return;
                    }

                    DetectedSkillshots.Add(skillshot);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #29
0
        /// <summary>
        ///     Gets triggered when a unit casts a spell and the unit is visible.
        /// </summary>
        private static void ObjAiHeroOnOnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (args.SData.Name == "dravenrdoublecast")
            {
                detectedSkillShots.RemoveAll(
                    s => s.Unit.NetworkId == sender.NetworkId && s.SpellData.SpellName == "DravenRCast");
            }

            if (!sender.IsValid || sender.Team == ObjectManager.Player.Team)
            {
                return;
            }
            //Get the skillshot data.
            var spellData = SpellDatabase.GetByName(args.SData.Name);

            //Skillshot not added in the database.
            if (spellData == null)
            {
                return;
            }

            var startPos = new Vector2();

            if (spellData.FromObject != "")
            {
                foreach (var o in ObjectManager.Get <GameObject>())
                {
                    if (o.Name.Contains(spellData.FromObject))
                    {
                        startPos = o.Position.To2D();
                    }
                }
            }
            else
            {
                startPos = sender.ServerPosition.To2D();
            }

            //For now only zed support.
            if (spellData.FromObjects != null && spellData.FromObjects.Length > 0)
            {
                foreach (var obj in ObjectManager.Get <GameObject>())
                {
                    if (obj.IsEnemy && spellData.FromObjects.Contains(obj.Name))
                    {
                        var start = obj.Position.To2D();
                        var end   = start + spellData.Range * (args.End.To2D() - obj.Position.To2D()).Normalized();
                        TriggerOnDetectSkillshot(
                            DetectionType.ProcessSpell, spellData, Environment.TickCount - Game.Ping / 2, start, end,
                            sender);
                    }
                }
            }

            if (!startPos.IsValid())
            {
                return;
            }

            var endPos = args.End.To2D();

            if (spellData.SpellName == "LucianQ" && args.Target != null &&
                args.Target.NetworkId == ObjectManager.Player.NetworkId)
            {
                return;
            }

            //Calculate the real end Point:
            var direction = (endPos - startPos).Normalized();

            if (startPos.Distance(endPos) > spellData.Range || spellData.FixedRange)
            {
                endPos = startPos + direction * spellData.Range;
            }

            if (spellData.ExtraRange != -1)
            {
                endPos = endPos +
                         Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(startPos)) * direction;
            }


            //Trigger the skillshot detection callbacks.
            TriggerOnDetectSkillshot(
                DetectionType.ProcessSpell, spellData, Environment.TickCount - Game.Ping / 2, startPos, endPos, sender);
        }
Beispiel #30
0
        private static void OnProcessSpellCast(AIBaseClient sender, AIBaseClientProcessSpellCastEventArgs args)
        {
            if (sender == null || !sender.IsValid)
            {
                return;
            }

            if (args.SData.Name == "dravenrdoublecast")
            {
                EvadeManager.DetectedSkillshots.RemoveAll(
                    s => s.Unit.NetworkId == sender.NetworkId && s.SpellData.SpellName == "DravenRCast");
            }

            if (!sender.IsValid || sender.Team == ObjectManager.Player.Team)
            {
                return;
            }

            var spellData = SpellDatabase.GetByName(args.SData.Name);

            if (spellData == null)
            {
                return;
            }

            var startPos = new Vector2();

            if (spellData.FromObject != "")
            {
                foreach (var o in ObjectManager.Get <GameObject>())
                {
                    if (o.Name.Contains(spellData.FromObject))
                    {
                        startPos = o.Position.ToVector2();
                    }
                }
            }
            else
            {
                startPos = sender.Position.ToVector2();
            }

            if (spellData.FromObjects != null && spellData.FromObjects.Length > 0)
            {
                foreach (var obj in ObjectManager.Get <GameObject>())
                {
                    if (obj.IsEnemy && spellData.FromObjects.Contains(obj.Name))
                    {
                        var start = obj.Position.ToVector2();
                        var end   = start + spellData.Range * (args.End.ToVector2() - obj.Position.ToVector2()).Normalized();

                        TriggerOnDetectSkillshot(
                            DetectionType.ProcessSpell, spellData, Utils.GameTimeTickCount - Game.Ping / 2, start, end,
                            end,
                            sender);
                    }
                }
            }

            if (!startPos.IsValid())
            {
                return;
            }

            var endPos = args.End.ToVector2();

            if (ObjectManager.Player.CharacterName == "Janna" ||
                ObjectManager.Player.CharacterName == "Rakan" ||
                ObjectManager.Player.CharacterName == "Lulu" || ObjectManager.Player.CharacterName == "Ivern" ||
                ObjectManager.Player.CharacterName == "Karma")
            {
                bestAllies = GameObjects.AllyHeroes
                             .Where(t =>
                                    t.Distance(ObjectManager.Player) < SupportAIO.Common.Champion.E.Range)
                             .OrderBy(x => x.Health);
            }
            if (ObjectManager.Player.CharacterName == "Lux" || ObjectManager.Player.CharacterName == "Sona" ||
                ObjectManager.Player.CharacterName == "Taric")

            {
                bestAllies = GameObjects.AllyHeroes
                             .Where(t =>
                                    t.Distance(ObjectManager.Player) < SupportAIO.Common.Champion.W.Range)
                             .OrderBy(x => x.Health);
            }
            foreach (var ally in bestAllies)
            {
                if (spellData.SpellName == "LucianQ" && args.Target != null &&
                    args.Target.NetworkId == ally.NetworkId)
                {
                    return;
                }


                var direction = (endPos - startPos).Normalized();

                if (startPos.Distance(endPos) > spellData.Range || spellData.FixedRange)
                {
                    endPos = startPos + direction * spellData.Range;
                }

                if (spellData.ExtraRange != -1)
                {
                    endPos = endPos +
                             Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(startPos)) * direction;
                }

                TriggerOnDetectSkillshot(
                    DetectionType.ProcessSpell, spellData, Utils.GameTimeTickCount - Game.Ping / 2, startPos, endPos,
                    args.End.ToVector2(), sender);
            }
        }
Beispiel #31
0
        private static void OnUpdate(EventArgs args)
        {
            PlayerPosition = ObjectManager.Player.ServerPosition.To2D();

            if (prevPos.IsValid() && PlayerPosition.Distance(prevPos) > 200)
            {
                Evading     = false;
                evadePoint2 = Vector2.Zero;
            }

            prevPos = PlayerPosition;
            UpdateSpells();

            if (!Configs.Enabled || Util.CommonCheck)
            {
                Evading     = false;
                evadePoint2 = Vector2.Zero;

                return;
            }

            if (ObjectManager.Player.Spellbook.IsAutoAttacking && !Orbwalking.IsAutoAttack(ObjectManager.Player.LastCastedSpellName()))
            {
                Evading = false;

                return;
            }

            foreach (var ally in
                     HeroManager.Allies.Where(
                         i =>
                         !i.IsMe && i.IsValidTarget(1000, false) &&
                         Configs.Menu.Item("SA_" + i.ChampionName).GetValue <bool>()))
            {
                var checkSafe = ally.ServerPosition.To2D().IsPointSafe();

                if (checkSafe.IsSafe)
                {
                    continue;
                }

                var dangerLvl =
                    checkSafe.Spells.Select(i => i.GetValue <Slider>("DangerLvl").Value).Concat(new[] { 0 }).Max();

                foreach (var evadeSpell in
                         EvadeSpellDatabase.Spells.Where(
                             i =>
                             i.IsReady && i.IsShield && i.CanShieldAllies && dangerLvl >= i.DangerLevel &&
                             ally.Distance(PlayerPosition) < i.MaxRange && IsAboutToHit(i.Delay, ally)))
                {
                    ObjectManager.Player.Spellbook.CastSpell(evadeSpell.Slot, ally);
                }
            }

            var curPaths  = ObjectManager.Player.GetWaypoints();
            var checkPos  = PlayerPosition.IsPointSafe();
            var checkPath = curPaths.IsPathSafe(100);

            haveSolution = false;

            if (Evading)
            {
                if (evadePoint1.IsPointSafe().IsSafe)
                {
                    if (checkPos.IsSafe)
                    {
                        Evading = false;
                    }
                    else
                    {
                        if (Utils.GameTimeTickCount - lastMoveTick1 > 1000 / 15)
                        {
                            lastMoveTick1 = Utils.GameTimeTickCount;
                            evadePoint1.Move();
                        }

                        return;
                    }
                }
                else
                {
                    Evading = false;
                }
            }

            if (!checkPath.IsSafe && !checkPos.IsSafe)
            {
                TryToEvade(checkPos.Spells, evadePoint2.IsValid() ? evadePoint2 : Game.CursorPos.To2D());
            }

            if (haveSolution || Evading || !evadePoint2.IsValid() || !checkPos.IsSafe ||
                !EvadeSpellDatabase.Spells.Any(i => i.MenuName == "Walking" && i.Enabled) ||
                (checkPath.IsSafe && !forceFollowPath) ||
                (Utils.GameTimeTickCount - lastMoveTick2 <= 1000 / 15 && PathFollow.IsFollowing))
            {
                return;
            }

            lastMoveTick2 = Utils.GameTimeTickCount;

            if (DetectedSpells.Count == 0)
            {
                if (evadePoint2.Distance(PlayerPosition) > 75)
                {
                    evadePoint2.Move();
                }

                return;
            }

            var paths = ObjectManager.Player.GetPath(evadePoint2.To3D()).ToList().To2D();

            if (paths.IsPathSafe(100).IsSafe)
            {
                if (evadePoint2.Distance(PlayerPosition) > 75)
                {
                    evadePoint2.Move();
                }

                return;
            }

            var newPaths = Core.FindPaths(PlayerPosition, evadePoint2);

            if (newPaths.Count == 0)
            {
                if (!checkPath.Intersect.Valid && curPaths.Count <= 1)
                {
                    checkPath = paths.IsPathSafe(100);
                }

                if (checkPath.Intersect.Valid && checkPath.Intersect.Point.Distance(PlayerPosition) > 75)
                {
                    checkPath.Intersect.Point.Move();

                    return;
                }
            }

            PathFollow.Start(newPaths);
            PathFollow.KeepFollowPath();
        }
Beispiel #32
0
        private static void OnDetectSkillshot(Skillshot skillshot)
        {
            var alreadyAdded = false;

            foreach (var item in DetectedSkillshots)
            {
                if (item.SpellData.SpellName == skillshot.SpellData.SpellName &&
                    item.Unit.NetworkId == skillshot.Unit.NetworkId &&
                    skillshot.Direction.AngleBetween(item.Direction) < 5 &&
                    (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0))
                {
                    alreadyAdded = true;
                }
            }

            if (skillshot.Unit.Team == ObjectManager.GetLocalPlayer().Team)
            {
                return;
            }

            if (skillshot.Start.Distance(ObjectManager.GetLocalPlayer().ServerPosition.To2D()) >
                (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
            {
                return;
            }

            if (!alreadyAdded || skillshot.SpellData.DontCheckForDuplicates)
            {
                if (skillshot.DetectionType == DetectionType.ProcessSpell)
                {
                    if (skillshot.SpellData.MultipleNumber != -1)
                    {
                        var originalDirection = skillshot.Direction;

                        for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                             i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                             i++)
                        {
                            var end = skillshot.Start +
                                      skillshot.SpellData.Range *
                                      originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i);
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end,
                                skillshot.Unit);

                            DetectedSkillshots.Add(skillshotToAdd);
                        }
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "UFSlash")
                    {
                        skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed;
                    }



                    if (skillshot.SpellData.Invert)
                    {
                        var newDirection   = -(skillshot.End - skillshot.Start).Normalized();
                        var end            = skillshot.Start + newDirection * skillshot.Start.Distance(skillshot.End);
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end,
                            skillshot.Unit);
                        DetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    if (skillshot.SpellData.Centered)
                    {
                        var start          = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range;
                        var end            = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range;
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                            skillshot.Unit);
                        DetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    var unit = skillshot.Unit as Obj_AI_Hero;

                    if (unit != null && skillshot.SpellData.SpellName == "TaricE" && unit.ChampionName == "Taric")
                    {
                        var target =
                            GameObjects.Heroes.FirstOrDefault(
                                h => h.Team == skillshot.Unit.Team && h.IsVisible && h.HasBuff("taricwleashactive"));

                        if (target != null)
                        {
                            var start          = target.ServerPosition.To2D();
                            var direction      = (skillshot.OriginalEnd - start).Normalized();
                            var end            = start + direction * skillshot.SpellData.Range;
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick,
                                start, end, target)
                            {
                                OriginalEnd = skillshot.OriginalEnd
                            };
                            DetectedSkillshots.Add(skillshotToAdd);
                        }
                    }

                    if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
                    {
                        var angle = 60;
                        var edge1 =
                            (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated(
                                -angle / 2 * (float)Math.PI / 180);
                        var edge2 = edge1.Rotated(angle * (float)Math.PI / 180);

                        var positions = new List <Vector2>();

                        var explodingQ = DetectedSkillshots.FirstOrDefault(s => s.SpellData.SpellName == "SyndraQ");

                        if (explodingQ != null)
                        {
                            positions.Add(explodingQ.End);
                        }

                        foreach (var minion in ObjectManager.Get <Obj_AI_Minion>())
                        {
                            if (minion.Name == "Seed" && !minion.IsDead && minion.Team != ObjectManager.GetLocalPlayer().Team)
                            {
                                positions.Add(minion.ServerPosition.To2D());
                            }
                        }

                        foreach (var position in positions)
                        {
                            var v = position - skillshot.Unit.ServerPosition.To2D();
                            if (edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 &&
                                position.Distance(skillshot.Unit) < 800)
                            {
                                var start = position;
                                var end   = skillshot.Unit.ServerPosition.To2D()
                                            .Extend(
                                    position,
                                    skillshot.Unit.Distance(position) > 200 ? 1300 : 1000);
                                var startTime = skillshot.StartTick;

                                startTime += (int)(150 + skillshot.Unit.Distance(position) / 2.5f);
                                var skillshotToAdd = new Skillshot(
                                    skillshot.DetectionType, skillshot.SpellData, startTime, start, end,
                                    skillshot.Unit);
                                DetectedSkillshots.Add(skillshotToAdd);
                            }
                        }
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "MalzaharQ")
                    {
                        var start          = skillshot.End - skillshot.Direction.Perpendicular() * 400;
                        var end            = skillshot.End + skillshot.Direction.Perpendicular() * 400;
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                            skillshot.Unit);
                        DetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "ZyraQ")
                    {
                        var start          = skillshot.End - skillshot.Direction.Perpendicular() * 450;
                        var end            = skillshot.End + skillshot.Direction.Perpendicular() * 450;
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                            skillshot.Unit);
                        DetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "DianaArc")
                    {
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, SpellDatabase.GetByName("DianaArcArc"), skillshot.StartTick,
                            skillshot.Start, skillshot.End,
                            skillshot.Unit);

                        DetectedSkillshots.Add(skillshotToAdd);
                    }

                    if (skillshot.SpellData.SpellName == "ZiggsQ")
                    {
                        var d1 = skillshot.Start.Distance(skillshot.End);
                        var d2 = d1 * 0.4f;
                        var d3 = d2 * 0.69f;
                        var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                        var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");
                        var bounce1Pos       = skillshot.End + skillshot.Direction * d2;
                        var bounce2Pos       = bounce1Pos + skillshot.Direction * d3;

                        bounce1SpellData.Delay =
                            (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                        bounce2SpellData.Delay =
                            (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);

                        var bounce1 = new Skillshot(
                            skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos,
                            skillshot.Unit);
                        var bounce2 = new Skillshot(
                            skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos,
                            skillshot.Unit);

                        DetectedSkillshots.Add(bounce1);
                        DetectedSkillshots.Add(bounce2);
                    }

                    if (skillshot.SpellData.SpellName == "ZiggsR")
                    {
                        skillshot.SpellData.Delay =
                            (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
                    }

                    if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
                    {
                        var endPos = new Vector2();

                        foreach (var s in DetectedSkillshots)
                        {
                            if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E)
                            {
                                var extendedE = new Skillshot(
                                    skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start,
                                    skillshot.End + skillshot.Direction * 100, skillshot.Unit);

                                if (!extendedE.IsSafe(s.End))
                                {
                                    endPos = s.End;
                                }
                                break;
                            }
                        }

                        foreach (var m in ObjectManager.Get <Obj_AI_Minion>())
                        {
                            if (m.UnitSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team)
                            {
                                var extendedE = new Skillshot(
                                    skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start,
                                    skillshot.End + skillshot.Direction * 100, skillshot.Unit);

                                if (!extendedE.IsSafe(m.Position.To2D()))
                                {
                                    endPos = m.Position.To2D();
                                }
                                break;
                            }
                        }

                        if (endPos.IsValid())
                        {
                            skillshot = new Skillshot(DetectionType.ProcessSpell, SpellDatabase.GetByName("JarvanIVEQ"),
                                                      Utils.GameTimeTickCount, skillshot.Start, endPos, skillshot.Unit);
                            skillshot.End       = endPos + 200 * (endPos - skillshot.Start).Normalized();
                            skillshot.Direction = (skillshot.End - skillshot.Start).Normalized();
                        }
                    }
                }

                if (skillshot.SpellData.SpellName == "OriannasQ")
                {
                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType, SpellDatabase.GetByName("OriannaQend"), skillshot.StartTick,
                        skillshot.Start, skillshot.End,
                        skillshot.Unit);

                    DetectedSkillshots.Add(skillshotToAdd);
                }

                if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
                {
                    return;
                }

                DetectedSkillshots.Add(skillshot);
            }
        }
Beispiel #33
0
        private void HandleLook(float dt)
        {
            Vector2 delta = new Vector2(cms.X - center.X, cms.Y - center.Y);
            if (!delta.IsValid()) // check for NaN & Inf.
                delta = Vector2.Zero;
            Vector2 RightThumb = new Vector2( cgps.ThumbSticks.Right.X, -cgps.ThumbSticks.Right.Y);

            this.Look = (delta / MouseSensitivity) + RightThumb;
            this.Look = Vector2.Clamp(this.Look, -Vector2.One, Vector2.One);

            if (CenterMouse)
            {
                float length = delta.Length();
                if (length > MouseSensitivity)
                    length = MouseSensitivity;
                else if (length < MouseSensitivity * 0.6f)
                    length -= (MouseSensitivity/2) * dt;
                else if (length < 0.01f)
                    length = 0;
                delta = delta.SafeNormalize() * length;
                Mouse.SetPosition((int)Math.Round(center.X + delta.X), (int)Math.Round(center.Y + delta.Y));
            }
        }
        /// <summary>
        /// This requires a world target point,
        /// tuning parameters, and the time step.
        /// </summary>
        /// <param name="body">The body.</param>
        /// <param name="worldAnchor">The target.</param>
        public FixedMouseJoint(Body body, Vector2 worldAnchor)
            : base(body)
        {
            JointType = JointType.FixedMouse;
            Frequency = 5.0f;
            DampingRatio = 0.7f;
            MaxForce = 1000 * body.Mass;

            Debug.Assert(worldAnchor.IsValid());

            _worldAnchor = worldAnchor;
            LocalAnchorA = MathUtils.MulT(BodyA._xf, worldAnchor);
        }