public static void RPrediction(Vector2 CastPos, Obj_AI_Base TargetToCheck, out Vector2 CenterPolar, out Vector2 CenterEnd, out Vector2 x1, out Vector2 x2)
        {
            //changeable
            float goc = 36f;
            //process
            float goc1rad  = (float)Math.PI * (90f - goc / 2f) / 180f;
            float backward = TargetToCheck.BoundingRadius / (float)Math.Cos(goc1rad);

            CenterPolar = ObjectManager.Player.Position.To2D().Extend(CastPos, -backward);
            CenterEnd   = ObjectManager.Player.Position.To2D().Extend(CastPos, 1400);
            Vector2 Rangestraight = ObjectManager.Player.Position.To2D().Extend(CastPos, ObjectManager.Player.BoundingRadius
                                                                                + ObjectManager.Player.AttackRange + TargetToCheck.BoundingRadius);
            float goc2rad = (float)Math.PI * (goc / 2f + 90f) / 180f - (float)Math.Acos(TargetToCheck.BoundingRadius /
                                                                                        (ObjectManager.Player.BoundingRadius + ObjectManager.Player.AttackRange + TargetToCheck.BoundingRadius));

            x1 = BadaoChecker.BadaoRotateAround(Rangestraight, ObjectManager.Player.Position.To2D(), goc2rad);
            x2 = BadaoChecker.BadaoRotateAround(Rangestraight, ObjectManager.Player.Position.To2D(), -goc2rad);
        }
Beispiel #2
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);
            }
        }