Пример #1
0
        private static void AUTOWHIT(EventArgs args)
        {
            if (ME.IsDead || !BrandSettings.Whit.Enabled)
            {
                return;
            }

            if (!W.IsReady())
            {
                return;
            }

            var targets = TargetSelector.GetTargets(W.Range).OrderBy(i => i.DistanceToPlayer());

            if (targets == null)
            {
                return;
            }

            foreach (var target in targets)
            {
                if (target == null)
                {
                    return;
                }

                var pred = FSpred.Prediction.Prediction.GetPrediction(W, target);
                if (pred != null && pred.Hitchance >= FSpred.Prediction.HitChance.High)
                {
                    WPoly = new Geometry.Circle(pred.CastPosition, 260f);
                    var targethit      = GameObjects.EnemyHeroes.Where(i => WPoly.IsInside(i.Position));
                    var targethitcount = targethit.Count();

                    if (targethitcount >= BrandSettings.Whit.ActiveValue && pred.CastPosition.DistanceToPlayer() <= W.Range)
                    {
                        if (W.Cast(pred.CastPosition))
                        {
                            return;
                        }
                    }
                }
            }
        }
Пример #2
0
        private static void AUTOEHIT(EventArgs args)
        {
            if (ME.IsDead)
            {
                return;
            }

            if (!E.IsReady())
            {
                return;
            }

            var targets = TargetSelector.GetTargets(E.Range + 375f).OrderBy(i => i.DistanceToPlayer());

            if (targets == null)
            {
                return;
            }

            foreach (var target in targets)
            {
                if (target == null)
                {
                    return;
                }

                EPoly = new Geometry.Circle(target.Position, 375f);
                var targethit      = GameObjects.EnemyHeroes.Where(i => EPoly.IsInside(i.Position));
                var targethitcount = targethit.Count();

                if (targethitcount >= 2 && target.IsValidTarget(E.Range) && target.Burning())
                {
                    if (E.Cast(target) == CastStates.SuccessfullyCasted || E.CastOnUnit(target))
                    {
                        return;
                    }
                }
            }
        }
Пример #3
0
        private static void AUTORHIT(EventArgs args)
        {
            if (ME.IsDead || !BrandSettings.AutoR.Enabled)
            {
                return;
            }

            if (!R.IsReady())
            {
                return;
            }

            var targets = TargetSelector.GetTargets(R.Range + 600).OrderBy(i => i.DistanceToPlayer());

            if (targets == null)
            {
                return;
            }

            foreach (var target in targets)
            {
                if (target == null)
                {
                    return;
                }

                RPoly = new Geometry.Circle(target.Position, 600f);
                var targethit      = GameObjects.EnemyHeroes.Where(i => !i.IsDead && RPoly.IsInside(i));
                var targethitcount = targethit.Count();

                if (targethitcount >= BrandSettings.AutoR.ActiveValue && target.IsValidTarget(R.Range))
                {
                    if (R.Cast(target) == CastStates.SuccessfullyCasted || R.CastOnUnit(target))
                    {
                        return;
                    }
                }
            }
        }
Пример #4
0
        public static Result GetCircleAoePrediction(this Spell spell, AIHeroClient target, HitChance hitChance,
                                                    bool boundingRadius = true, bool extended = true, Vector3?sourcePosition = null)
        {
            try
            {
                if (spell == null || target == null)
                {
                    return(new Result(Vector3.Zero, new List <AIHeroClient>()));
                }
                var fromPosition = sourcePosition ?? ObjectManager.Player.PreviousPosition;
                var hits         = new List <AIHeroClient>();
                var center       = Vector3.Zero;
                var radius       = float.MaxValue;
                var range        = spell.Range + (extended ? spell.Width * 0.85f : 0) +
                                   (boundingRadius ? target.BoundingRadius * BoundingRadiusMultiplicator : 0);
                var positions = (from t in GameObjects.EnemyHeroes
                                 where t.IsValidTarget(range * 1.5f, true, fromPosition)
                                 let prediction = spell.GetPrediction(t)
                                                  where prediction.Hitchance >= hitChance
                                                  select new Position(t, prediction.UnitPosition)).ToList();
                var spellWidth = spell.Width;
                if (positions.Any())
                {
                    var mainTarget    = positions.FirstOrDefault(p => p.Hero.NetworkId == target.NetworkId);
                    var possibilities =
                        ProduceEnumeration(
                            positions.Where(
                                p => p.UnitPosition.Distance(mainTarget.UnitPosition) <= spell.Width * 0.85f).ToList())
                        .Where(p => p.Count > 0 && p.Any(t => t.Hero.NetworkId == mainTarget.Hero.NetworkId))
                        .ToList();
                    foreach (var possibility in possibilities)
                    {
                        var mec      = MEC.GetMec(possibility.Select(p => p.UnitPosition.ToVector2()).ToList());
                        var distance = spell.From.Distance(mec.Center.ToVector3());
                        if (mec.Radius < spellWidth && distance < range)
                        {
                            var lHits  = new List <AIHeroClient>();
                            var circle =
                                new Geometry.Circle(
                                    spell.From.Extend(
                                        mec.Center.ToVector3(), spell.Range > distance ? distance : spell.Range), spell.Width);

                            if (boundingRadius)
                            {
                                lHits.AddRange(
                                    from position in positions
                                    where
                                    new Geometry.Circle(
                                        position.UnitPosition,
                                        position.Hero.BoundingRadius * BoundingRadiusMultiplicator).Points.Any(
                                        p => circle.IsInside(p))
                                    select position.Hero);
                            }
                            else
                            {
                                lHits.AddRange(
                                    from position in positions
                                    where circle.IsInside(position.UnitPosition)
                                    select position.Hero);
                            }

                            if ((lHits.Count > hits.Count || lHits.Count == hits.Count && mec.Radius < radius ||
                                 lHits.Count == hits.Count &&
                                 spell.From.Distance(circle.Center.ToVector3()) < spell.From.Distance(center)) &&
                                lHits.Any(p => p.NetworkId == target.NetworkId))
                            {
                                center = ToVector32(circle.Center);
                                radius = mec.Radius;
                                hits.Clear();
                                hits.AddRange(lHits);
                            }
                        }
                    }
                    if (!center.Equals(Vector3.Zero))
                    {
                        return(new Result(center, hits));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            return(new Result(Vector3.Zero, new List <AIHeroClient>()));
        }