Exemple #1
0
        private static void ContinueLastBlockedCommand()
        {
            if (!ObjectCache.MenuCache.Cache["ContinueMovement"].As <MenuBool>().Enabled || !Situation.ShouldDodge())
            {
                return;
            }

            var movePos    = LastBlockedUserMoveTo.TargetPosition;
            var extraDelay = ObjectCache.MenuCache.Cache["ExtraPingBuffer"].As <MenuSlider>().Value;

            if (IsDodging || LastBlockedUserMoveTo.IsProcessed || !(Environment.TickCount - LastEvadeCommand.Timestamp > ObjectCache.GamePing + extraDelay) ||
                !(Environment.TickCount - LastBlockedUserMoveTo.Timestamp < 1500))
            {
                return;
            }

            movePos = movePos + (movePos - ObjectCache.MyHeroCache.ServerPos2D).Normalized() * EvadeUtils.Random.Next(1, 65);

            if (EvadeHelper.CheckMovePath(movePos, ObjectCache.GamePing + extraDelay))
            {
                return;
            }

            EvadeCommand.MoveTo(movePos);
            LastBlockedUserMoveTo.IsProcessed = true;
        }
Exemple #2
0
        private static void DodgeSkillShots()
        {
            if (!Situation.ShouldDodge())
            {
                IsDodging = false;
                return;
            }

            if (IsDodging)
            {
                if (LastPosInfo == null)
                {
                    return;
                }

                var lastBestPosition = LastPosInfo.Position;

                if (!ObjectCache.MenuCache.Cache["ClickOnlyOnce"].Enabled && MyHero.Path.Count() > 0 && LastPosInfo.Position.Distance(MyHero.Path.Last().To2D()) < 5)
                {
                    return;
                }

                EvadeCommand.MoveTo(lastBestPosition);
                LastEvadeOrderTime = Environment.TickCount;
            }
            else
            {
                //Check if hero will walk into a skillshot
                var path = MyHero.Path;

                if (path.Length <= 0)
                {
                    return;
                }

                var movePos = path[path.Length - 1].To2D();

                if (!EvadeHelper.CheckMovePath(movePos))
                {
                    return;
                }

                var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos);
                if (posInfo != null)
                {
                    EvadeCommand.MoveTo(posInfo.Position);
                }
            }
        }
Exemple #3
0
        private void Game_OnIssueOrder(Obj_AI_Base hero, Obj_AI_BaseIssueOrderEventArgs args)
        {
            if (!hero.IsMe)
            {
                return;
            }

            if (!Situation.ShouldDodge())
            {
                return;
            }

            if (args.OrderType == OrderType.MoveTo)
            {
                if (IsDodging && SpellDetector.Spells.Any())
                {
                    var limitDelay = ObjectCache.MenuCache.Cache["TickLimiter"].As <MenuSlider>(); //Tick limiter
                    if (Environment.TickCount - LastTickCount < limitDelay.Value)
                    {
                        LastTickCount     = Environment.TickCount;
                        args.ProcessEvent = false;
                        return;
                    }

                    CheckHeroInDanger();

                    LastBlockedUserMoveTo = new EvadeCommand
                    {
                        Order          = EvadeOrderCommand.MoveTo,
                        TargetPosition = args.Position.To2D(),
                        Timestamp      = Environment.TickCount,
                        IsProcessed    = false
                    };

                    var posInfoTest = EvadeHelper.CanHeroWalkToPos(args.Position.To2D(), ObjectCache.MyHeroCache.MoveSpeed, 0, 0, false);

                    if (posInfoTest.IsDangerousPos)
                    {
                        args.ProcessEvent = false;
                    }
                    else
                    {
                        LastPosInfo.Position = args.Position.To2D();
                        args.ProcessEvent    = true;
                    }
                }
                else
                {
                    var movePos    = args.Position.To2D();
                    var extraDelay = ObjectCache.MenuCache.Cache["ExtraPingBuffer"].As <MenuSlider>().Value;

                    if (EvadeHelper.CheckMovePath(movePos, ObjectCache.GamePing + extraDelay))
                    {
                        LastBlockedUserMoveTo = new EvadeCommand
                        {
                            Order          = EvadeOrderCommand.MoveTo,
                            TargetPosition = args /*.Target*/.Position.To2D(),
                            Timestamp      = Environment.TickCount,
                            IsProcessed    = false
                        };

                        args.ProcessEvent = false;

                        if (Environment.TickCount - LastMovementBlockTime < 500 && LastMovementBlockPos.Distance(args./*Target.*/ Position) < 100)
                        {
                            return;
                        }

                        LastMovementBlockPos  = args./*Target.*/ Position;
                        LastMovementBlockTime = Environment.TickCount;

                        var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos);
                        if (posInfo != null)
                        {
                            EvadeCommand.MoveTo(posInfo.Position);
                        }
                        return;
                    }
                    LastBlockedUserMoveTo.IsProcessed = true;
                }
            }
            else
            {
                if (IsDodging)
                {
                    args.ProcessEvent = false;
                }
                else
                {
                    if (args.OrderType == OrderType.AttackUnit)
                    {
                        var target = args.Target;
                        if (target != null && target.IsValid)
                        {
                            var baseTarget = target as Obj_AI_Base;
                            if (baseTarget != null && ObjectCache.MyHeroCache.ServerPos2D.Distance(baseTarget.ServerPosition.To2D()) >
                                MyHero.AttackRange + ObjectCache.MyHeroCache.BoundingRadius + baseTarget.BoundingRadius)
                            {
                                var movePos    = args.Position.To2D();
                                var extraDelay = ObjectCache.MenuCache.Cache["ExtraPingBuffer"].As <MenuSlider>().Value;
                                if (EvadeHelper.CheckMovePath(movePos, ObjectCache.GamePing + extraDelay))
                                {
                                    args.ProcessEvent = false;
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            if (!args.ProcessEvent)
            {
                return;
            }

            LastIssueOrderGameTime = Game.ClockTime * 1000;
            LastIssueOrderTime     = Environment.TickCount;
            LastIssueOrderArgs     = args;

            switch (args.OrderType)
            {
            case OrderType.MoveTo:
                LastMoveToPosition  = args /*.Target*/.Position.To2D();
                LastMoveToServerPos = MyHero.ServerPosition.To2D();
                break;

            case OrderType.Stop:
                LastStopPosition = MyHero.ServerPosition.To2D();
                break;
            }
        }