Exemplo n.º 1
0
        public virtual PredictionResult GetPrediction(Obj_AI_Base target)
        {
            if (!IsSkillshot)
            {
                return(null);
            }

            switch (SkillShotTypeType)
            {
            case SkillShotType.Circular:
                var predDataCircular = new Prediction.Position.PredictionData(Prediction.Position.PredictionData.PredictionType.Circular, Range, Width, 0, Delay, Speed, AllowedCollisionCount, From);
                return(Prediction.Position.GetPrediction(target, predDataCircular));

            case SkillShotType.Linear:
                var predDataLinear = new Prediction.Position.PredictionData(Prediction.Position.PredictionData.PredictionType.Linear, Range, Width, 0, Delay, Speed, AllowedCollisionCount, From);
                return(Prediction.Position.GetPrediction(target, predDataLinear));

            case SkillShotType.Cone:
                var predDataCone = new Prediction.Position.PredictionData(Prediction.Position.PredictionData.PredictionType.Linear, Range, 0, Width, Delay, Speed, AllowedCollisionCount, From);
                return(Prediction.Position.GetPrediction(target, predDataCone));

            default:
                Logger.Log(LogLevel.Warn, "Skillshot type '{0}' not implemented yet!", SkillShotTypeType);
                break;
            }
            return(null);
        }
Exemplo n.º 2
0
        private static PredictionResult QPred(Obj_AI_Base target)
        {
            var data = new Prediction.Position.PredictionData(Prediction.Position.PredictionData.PredictionType.Linear,
                                                              (int)Q.Range, Q.SetSkillshot().Width, Q.SetSkillshot().ConeAngleDegrees, Q.CastDelay, Q.SetSkillshot().Speed, int.MaxValue, MyBall?.ServerPosition);
            var qpred = Prediction.Position.GetPrediction(target, data);

            return(qpred);
        }
Exemplo n.º 3
0
        public Vector3 GetPrediction(Obj_AI_Base target)
        {
            var data = new Prediction.Position.PredictionData(
                Prediction.Position.PredictionData.PredictionType.Circular,
                (int)Range,
                (int)Radius,
                0,
                (int)this.CastDelay,
                (int)this.Speed,
                int.MaxValue);

            return(Prediction.Position.GetPrediction(target, data).CastPosition);
        }
Exemplo n.º 4
0
        public static Vector3 GetPos()
        {
            var AARange        = Player.Instance.GetAutoAttackRange(Nearest);
            var TargetPosition = new Vector2();

            if (Nearest != null)
            {
                TargetPosition = Config.EPath.CurrentValue ? Prediction.Position.PredictUnitPosition(Nearest, 200) : Nearest.Position.To2D();
            }
            var Location = new Vector3();

            if (Config.EQ.CurrentValue && Player.Instance.CountEnemiesInRange(Spells.Q2.Range + Spells.E.Range) > Config.EQHit.CurrentValue)
            {
                var Champs = EntityManager.Heroes.Enemies.Where(x => !x.IsDead && x.IsValid && x.Distance(Player.Instance) <= Spells.E.Range + Spells.Q2.Range).ToArray();
                if (Champs != null)
                {
                    Prediction.Position.PredictionData data = new Prediction.Position.PredictionData(Prediction.Position.PredictionData.PredictionType.Linear, (int)Spells.Q2.Range, Spells.Q2.Width, 0, 450, int.MaxValue, int.MaxValue, Player.Instance.Position);
                    var preds = Prediction.Position.GetPredictionAoe(Champs, data).OrderByDescending(x => x.CastPosition.Distance(Player.Instance)).ToArray();
                    if (preds.Count() >= Config.EQHit.CurrentValue)
                    {
                        for (var i = 1; i <= preds.Count(); i++)
                        {
                            var Rectangle = new Geometry.Polygon.Rectangle(preds[0].CastPosition, preds[i].CastPosition, 75f);
                            var count     = preds.Count(x => Rectangle.IsInside(x.CastPosition));
                            if (count >= Config.EQHit.CurrentValue)
                            {
                                var Position = preds[0].CastPosition.Extend(preds[i].CastPosition, Spells.Q.Range).To3DWorld();
                                if (Spells.E.IsInRange(Position))
                                {
                                    Location = Position;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                switch (Get_Style_Of_E)
                {
                case 1:
                {
                    var Range = Config.ERange.CurrentValue;
                    var Path  = Intersection_Of_2Circle(Player.Instance.Position.To2D(), Spells.E.Range, TargetPosition, AARange - Range);
                    if (Path.Count() > 0)
                    {
                        if (Path.Count(x => IsNotDangerPosition(x)) == 2)
                        {
                            Location = Path.OrderByDescending(x => Get_Rate_Position(x)).OrderBy(x => x.Distance(Game.CursorPos)).FirstOrDefault().To3DWorld();
                        }
                        else if (Path.Count(x => IsNotDangerPosition(x)) == 0)
                        {
                            var Position = Path.OrderByDescending(x => Get_Rate_Position(x)).OrderBy(x => x.Distance(Game.CursorPos)).FirstOrDefault().To3DWorld();
                            var target   = TargetSelector.GetTarget(EntityManager.Heroes.Enemies.Where(t => t != null &&
                                                                                                       !t.IsDead &&
                                                                                                       t.IsValidTarget() &&
                                                                                                       Position.IsInRange(t, Player.Instance.GetAutoAttackRange(t)) &&
                                                                                                       t.Health <= Damages.EDamage(t) &&
                                                                                                       !t.Unkillable()), DamageType.Physical);
                            if (target != null)
                            {
                                Location = Position;
                            }
                            else if (Config.ECorrect.CurrentValue)
                            {
                                var Loc = Path.OrderBy(x => x.Distance(Game.CursorPos)).FirstOrDefault().To3DWorld();
                                Location = CorrectToBetter(Loc);
                            }
                            else
                            {
                                Location = Vector3.Zero;
                            }
                        }
                        else
                        {
                            Location = Path.OrderBy(x => Get_Rate_Position(x)).FirstOrDefault(x => IsNotDangerPosition(x)).To3DWorld();
                        }
                    }
                    else
                    {
                        if (Player.Instance.Distance(TargetPosition) >= AARange + Spells.E.Range)
                        {
                            Location = Vector3.Zero;
                        }
                        if (Player.Instance.Distance(TargetPosition) <= AARange - Spells.E.Range && Config.EKite.CurrentValue)
                        {
                            Location = Nearest.Position.Extend(Player.Instance, Nearest.Distance(Player.Instance) + Spells.E.Range).To3DWorld();
                        }
                    }
                }
                break;

                case 2:
                {
                    if (Nearest.Distance(Player.Instance) <= AARange + Spells.E.Range)
                    {
                        Location = Player.Instance.ServerPosition.Extend(Game.CursorPos, Spells.E.Range).To3DWorld();
                    }
                }
                break;

                case 3:
                {
                    if (Nearest.Distance(Player.Instance) <= AARange + Spells.E.Range)
                    {
                        if (Nearest.Distance(Player.Instance) <= AARange - Spells.E.Range && Config.EKite.CurrentValue)
                        {
                            Location = Nearest.Position.Extend(Player.Instance, Nearest.Distance(Player.Instance) + Spells.E.Range).To3DWorld();
                        }
                        else
                        {
                            var Pos         = Player.Instance.ServerPosition.Extend(Game.CursorPos, Spells.E.Range).To3DWorld();
                            var GrassObject = ObjectManager.Get <GameObject>().Where(x => Spells.E.IsInRange(x.Position) && x.Type.ToString() == "GrassObject").OrderBy(x => x.Distance(Nearest)).FirstOrDefault();
                            var target      = TargetSelector.GetTarget(EntityManager.Heroes.Enemies.Where(t => t != null &&
                                                                                                          !t.IsDead &&
                                                                                                          t.IsValidTarget() &&
                                                                                                          Pos.IsInRange(t, Player.Instance.GetAutoAttackRange(t)) &&
                                                                                                          t.Health <= Damages.EDamage(t) &&
                                                                                                          !t.Unkillable()), DamageType.Physical);
                            if (IsNotDangerPosition(Pos) || target != null)
                            {
                                Location = Pos;
                            }
                            else if (Config.ECorrect.CurrentValue)
                            {
                                if (GrassObject != null && Config.EGrass.CurrentValue)
                                {
                                    Location = GrassObject.Position;
                                }
                                else
                                {
                                    Location = CorrectToBetter(Pos);
                                }
                            }
                        }
                    }
                }
                break;

                case 4:
                {
                    Location = Player.Instance.ServerPosition.Extend(Game.CursorPos, Spells.E.Range).To3DWorld();
                }
                break;
                }
            }
            return(Location);
        }