예제 #1
0
        private void SpellDetector_OnProcessDetectedSpells()
        {
            ObjectCache.MyHeroCache.UpdateInfo();

            if (!ObjectCache.MenuCache.Cache["DodgeSkillShots"].As <MenuKeyBind>().Enabled)
            {
                LastPosInfo = PositionInfo.SetAllUndodgeable();
                EvadeSpell.UseEvadeSpell();
                return;
            }

            if (ObjectCache.MyHeroCache.ServerPos2D.CheckDangerousPos(0) || ObjectCache.MyHeroCache.ServerPos2DExtra.CheckDangerousPos(0))
            {
                if (EvadeSpell.PreferEvadeSpell())
                {
                    LastPosInfo = PositionInfo.SetAllUndodgeable();
                }
                else
                {
                    var posInfo = EvadeHelper.GetBestPosition();

                    if (posInfo != null)
                    {
                        LastPosInfo = posInfo.CompareLastMovePos();

                        var travelTime = ObjectCache.MyHeroCache.ServerPos2DPing.Distance(LastPosInfo.Position) / MyHero.MoveSpeed;

                        LastPosInfo.EndTime = Environment.TickCount + travelTime * 1000 - 100;
                    }

                    CheckHeroInDanger();

                    if (Environment.TickCount > LastStopEvadeTime)
                    {
                        DodgeSkillShots();
                    }

                    CheckLastMoveTo();
                    EvadeSpell.UseEvadeSpell();
                }
            }
            else
            {
                LastPosInfo = PositionInfo.SetAllDodgeable();
                CheckLastMoveTo();
            }
        }