Пример #1
0
        public static Obj_AI_Base GetTarget(Vector3 fromPosition)
        {
            var HeroList = EntityManager.Heroes.Enemies.Where(
                h =>
                h.IsValidTarget(Program.E.Range) &&
                !h.HasBuffOfType(BuffType.SpellShield) &&
                !h.HasBuffOfType(BuffType.SpellImmunity));
            //dz191.vhr.misc.condemn.rev.accuracy
            //dz191.vhr.misc.condemn.rev.nextprediction
            var MinChecksPercent = MenuManager.CondemnMenu["condemnPercent"].Cast <Slider>().CurrentValue;
            var PushDistance     = MenuManager.CondemnMenu["pushDistance"].Cast <Slider>().CurrentValue;

            if (PushDistance >= 410)
            {
                var PushEx = PushDistance;
                PushDistance -= (10 + (PushEx - 410) / 2);
            }

            if (other.UnderEnemyTower((Vector2)Variables._Player.ServerPosition))
            {
                return(null);
            }

            foreach (var Hero in HeroList)
            {
                if (MenuManager.CondemnMenu["UseEc"].Cast <CheckBox>().CurrentValue&&
                    Hero.NetworkId != Orbwalker.LastTarget.NetworkId)
                {
                    continue;
                }

                if (Hero.Health + 10 <=
                    ObjectManager.Player.GetAutoAttackDamage(Hero) *
                    MenuManager.CondemnMenu["noeaa"].Cast <Slider>().CurrentValue)
                {
                    continue;
                }


                var targetPosition   = Program.E2.GetPrediction(Hero).UnitPosition;
                var finalPosition    = targetPosition.Extend(ObjectManager.Player.ServerPosition, -PushDistance);
                var finalPosition_ex = Hero.ServerPosition.Extend(ObjectManager.Player.ServerPosition, -PushDistance);

                var condemnRectangle    = new VHRPolygon(VHRPolygon.Rectangle(targetPosition.To2D(), finalPosition, Hero.BoundingRadius));
                var condemnRectangle_ex = new VHRPolygon(VHRPolygon.Rectangle(Hero.ServerPosition.To2D(), finalPosition_ex, Hero.BoundingRadius));

                if (IsBothNearWall(Hero))
                {
                    return(null);
                }

                if (condemnRectangle.Points.Count(point => NavMesh.GetCollisionFlags(point.X, point.Y).HasFlag(CollisionFlags.Wall)) >= condemnRectangle.Points.Count() * (MinChecksPercent / 100f) &&
                    condemnRectangle_ex.Points.Count(point => NavMesh.GetCollisionFlags(point.X, point.Y).HasFlag(CollisionFlags.Wall)) >= condemnRectangle_ex.Points.Count() * (MinChecksPercent / 100f))
                {
                    return(Hero);
                }
            }
            return(null);
        }
Пример #2
0
        public static Obj_AI_Base GetTarget(Vector3 fromPosition)
        {
            var HeroList = EntityManager.Heroes.Enemies.Where(
                                    h =>
                                        h.IsValidTarget(Program.E.Range) &&
                                        !h.HasBuffOfType(BuffType.SpellShield) &&
                                        !h.HasBuffOfType(BuffType.SpellImmunity));
            //dz191.vhr.misc.condemn.rev.accuracy
            //dz191.vhr.misc.condemn.rev.nextprediction
            var MinChecksPercent = MenuManager.CondemnMenu["condemnPercent"].Cast<Slider>().CurrentValue;
            var PushDistance = MenuManager.CondemnMenu["pushDistance"].Cast<Slider>().CurrentValue;

            if (PushDistance >= 410)
            {
                var PushEx = PushDistance;
                PushDistance -= (10 + (PushEx - 410) / 2);
            }

            if (other.UnderEnemyTower((Vector2)Variables._Player.ServerPosition))
            {
                return null;
            }

            foreach (var Hero in HeroList)
            {
                if (MenuManager.CondemnMenu["UseEc"].Cast<CheckBox>().CurrentValue &&
                    Hero.NetworkId != TargetSelector.GetTarget((int)Variables._Player.GetAutoAttackRange(),DamageType.Physical).NetworkId)
                {
                    continue;
                }

                if (Hero.Health + 10 <=
                    ObjectManager.Player.GetAutoAttackDamage(Hero) *
                    MenuManager.CondemnMenu["noeaa"].Cast<Slider>().CurrentValue)
                {
                    continue;
                }


                var targetPosition = Program.E2.GetPrediction(Hero).UnitPosition;
                var finalPosition = targetPosition.Extend(ObjectManager.Player.ServerPosition, -PushDistance);
                var finalPosition_ex = Hero.ServerPosition.Extend(ObjectManager.Player.ServerPosition, -PushDistance);

                var condemnRectangle = new VHRPolygon(VHRPolygon.Rectangle(targetPosition.To2D(), finalPosition, Hero.BoundingRadius));
                var condemnRectangle_ex = new VHRPolygon(VHRPolygon.Rectangle(Hero.ServerPosition.To2D(), finalPosition_ex, Hero.BoundingRadius));

                if (IsBothNearWall(Hero))
                {
                    return null;
                }

                if (condemnRectangle.Points.Count(point => NavMesh.GetCollisionFlags(point.X, point.Y).HasFlag(CollisionFlags.Wall)) >= condemnRectangle.Points.Count() * (MinChecksPercent / 100f)
                    && condemnRectangle_ex.Points.Count(point => NavMesh.GetCollisionFlags(point.X, point.Y).HasFlag(CollisionFlags.Wall)) >= condemnRectangle_ex.Points.Count() * (MinChecksPercent / 100f))
                {
                    return Hero;
                }
            }
            return null;
        }