Example #1
0
        public static void Execute(EventArgs args)
        {
            if (!E.IsEnabledAndReady(Variables.Orbwalker.ActiveMode))
            {
                return;
            }


            var CondemnTarget = GetCondemnTarget(ObjectManager.Player.ServerPosition);

            if (CondemnTarget.IsValidTarget())
            {
                var AAForE = MenuExtensions.GetItemValue <Slider>("dz191.vhr.misc.condemn.noeaa").Value;

                if (Math.Ceiling(CondemnTarget.Health / ObjectManager.Player.GetAutoAttackDamage(CondemnTarget, true)) < AAForE)
                {
                    return;
                }

                var targetPosition = CondemnTarget.ServerPosition;
                var myPosition     = ObjectManager.Player.ServerPosition;
                if (WindWall.CollidesWithWall(myPosition, targetPosition))
                {
                    return;
                }

                E.CastOnUnit(CondemnTarget);
                TrinketBush(CondemnTarget.ServerPosition.Extend(ObjectManager.Player.ServerPosition, -450f));
            }
            return;
        }
        public static void Execute(EventArgs args)
        {
            if (!E.IsEnabledAndReady(Variables.Orbwalker.ActiveMode))
            {
                return;
            }

            /**
             * var CondemnTarget = GetCondemnTarget(ObjectManager.Player.ServerPosition);
             * if (CondemnTarget.IsValidTarget())
             * {
             * // var AAForE = MenuExtensions.GetItemValue<Slider>("dz191.vhr.misc.condemn.noeaa").Value;
             *
             * // if (CondemnTarget.Health / ObjectManager.Player.GetAutoAttackDamage(CondemnTarget, true) < AAForE)
             * // {
             * //     return;
             * // }
             *  var targetPosition = CondemnTarget.ServerPosition;
             *  var myPosition = ObjectManager.Player.ServerPosition;
             *  if (WindWall.CollidesWithWall(myPosition, targetPosition))
             *  {
             *      return;
             *  }
             *
             *  E.CastOnUnit(CondemnTarget);
             * }*/

            var pushDistance = MenuExtensions.GetItemValue <Slider>("dz191.vhr.misc.condemn.pushdistance").Value - 25;

            if (pushDistance >= 410)
            {
                var PushEx = pushDistance;
                pushDistance -= (10 + (PushEx - 410) / 2);
            }
            foreach (var target in HeroManager.Enemies.Where(en => en.IsValidTarget(E.Range) && !en.IsDashing()))
            {
                //Yasuo Windwall check
                if (WindWall.CollidesWithWall(ObjectManager.Player.ServerPosition, target.ServerPosition))
                {
                    continue;
                }

                if (MenuExtensions.GetItemValue <bool>("dz191.vhr.misc.condemn.onlystuncurrent") && Variables.Orbwalker.GetTarget() != null &&
                    !target.NetworkId.Equals(Variables.Orbwalker.GetTarget().NetworkId))
                {
                    continue;
                }

                if (target.Health + 10 <=
                    ObjectManager.Player.GetAutoAttackDamage(target) *
                    MenuExtensions.GetItemValue <Slider>("dz191.vhr.misc.condemn.noeaa").Value)
                {
                    continue;
                }
                var Prediction  = Variables.spells[SpellSlot.E].GetPrediction(target);
                var endPosition = Prediction.UnitPosition.Extend(ObjectManager.Player.ServerPosition, -pushDistance);

                if (Prediction.Hitchance >= HitChance.VeryHigh)
                {
                    if (endPosition.IsWall())
                    {
                        var condemnRectangle = new VHRPolygon(VHRPolygon.Rectangle(target.ServerPosition.To2D(), endPosition.To2D(), target.BoundingRadius));

                        if (condemnRectangle.Points
                            .Count(point => NavMesh.GetCollisionFlags(point.X, point.Y).HasFlag(CollisionFlags.Wall)) >= condemnRectangle.Points.Count() * (20 / 100f))
                        {
                            E.CastOnUnit(target);
                            TrinketBush(target.ServerPosition.Extend(ObjectManager.Player.ServerPosition, -450f));
                        }
                    }
                    else
                    {
                        //It's not a wall.
                        var step = pushDistance / 5f;
                        for (float i = 0; i < pushDistance; i += step)
                        {
                            var endPositionEx = Prediction.UnitPosition.Extend(ObjectManager.Player.ServerPosition, -i);
                            if (endPositionEx.IsWall())
                            {
                                var condemnRectangle = new VHRPolygon(VHRPolygon.Rectangle(target.ServerPosition.To2D(), endPosition.To2D(), target.BoundingRadius));

                                if (condemnRectangle.Points
                                    .Count(point => NavMesh.GetCollisionFlags(point.X, point.Y).HasFlag(CollisionFlags.Wall)) >= condemnRectangle.Points.Count() * (20 / 100f))
                                {
                                    E.CastOnUnit(target);
                                    TrinketBush(target.ServerPosition.Extend(ObjectManager.Player.ServerPosition, -450f));
                                }
                                return;
                            }
                        }
                    }
                }
            }
        }