Esempio n. 1
0
        private static Vector3?OverrideOrbwalkPosition()
        {
            if (!Settings.Axe.CatchAxes || !AxeObjects.Any() || (GetAxesCount() == 0))
            {
                return(null);
            }

            foreach (
                var axeObjectData in
                AxeObjects.Where(
                    x =>
                    Settings.Axe.CatchAxesMode == 2 ? Player.Instance.IsInRange(x.EndPosition, Settings.Axe.AxeCatchRange) : Game.CursorPos.IsInRange(x.EndPosition, Settings.Axe.AxeCatchRange) &&
                    CanPlayerCatchAxe(x)).OrderBy(x => x.EndPosition.DistanceCached(Player.Instance)))
            {
                var isOutside = !Player.Instance.Position.IsInRange(axeObjectData.EndPosition, 120);
                var isInside  = Player.Instance.Position.IsInRange(axeObjectData.EndPosition, 120);

                if ((Settings.Axe.CatchAxesMode == 0) && !Player.Instance.Position.IsInRange(axeObjectData.EndPosition, 250))
                {
                    return(null);
                }

                if (isOutside)
                {
                    if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo))
                    {
                        var target = TargetSelector.GetTarget(Player.Instance.GetAutoAttackRange() + 350, DamageType.Physical);

                        if ((target != null) && (target.TotalHealthWithShields() < Player.Instance.GetAutoAttackDamageCached(target) * 2))
                        {
                            var pos = Prediction.Position.PredictUnitPosition(target, (int)(GetEta(axeObjectData, Player.Instance.MoveSpeed) * 1000));

                            if (!axeObjectData.EndPosition.IsInRangeCached(pos, Player.Instance.GetAutoAttackRange()))
                            {
                                return(null);
                            }
                        }
                    }

                    if ((axeObjectData.EndTick - Game.Time < GetEta(axeObjectData, Player.Instance.MoveSpeed)) &&
                        !HasMoveSpeedFuryBuff &&
                        (GetEta(axeObjectData, Player.Instance.MoveSpeed * WAdditionalMovementSpeed[W.Level]) >
                         axeObjectData.EndTick - Game.Time) &&
                        W.IsReady() && Settings.Axe.UseWToCatch)
                    {
                        W.Cast();
                    }

                    return(axeObjectData.EndPosition);
                }

                if (isInside)
                {
                    if (!CanPlayerLeaveAxeRangeInDesiredTime(axeObjectData.EndPosition, (axeObjectData.EndTick - Core.GameTickCount) / 1000f))
                    {
                        return(null);
                    }

                    var target = TargetSelector.GetTarget(Player.Instance.GetAutoAttackRange() + 100, DamageType.Physical);

                    if ((target != null) &&
                        (target.TotalHealthWithShields() < Player.Instance.GetAutoAttackDamageCached(target, true) * 2) &&
                        !Prediction.Position.PredictUnitPosition(target, (int)(axeObjectData.EndTick - Core.GameTickCount))
                        .IsInRangeCached(Player.Instance, Player.Instance.GetAutoAttackRange()))
                    {
                        return(null);
                    }

                    var position =
                        new Geometry.Polygon.Circle(axeObjectData.EndPosition, 110).Points.Where(
                            x =>
                            axeObjectData.EndPosition.To2D()
                            .ProjectOn(axeObjectData.EndPosition.To2D(), Game.CursorPos.To2D())
                            .IsOnSegment).OrderBy(x => x.DistanceCached(Game.CursorPos)).FirstOrDefault();

                    if (position == default(Vector2))
                    {
                        return(null);
                    }

                    return(position.To3D());
                }
            }
            return(null);
        }