Esempio n. 1
0
 public static void OnUpdate()
 {
     foreach (LandStack landStack in Core.Config._LandStacks.Where<LandStack>((Func<LandStack, bool>) (x => x.MoveForKill)))
       {
     LandStack _SB = landStack;
     Hero hero = EntityManager<Hero>.Entities.FirstOrDefault<Hero>((Func<Hero, bool>) (x =>
     {
       if (x.Team != Core.Config._Hero.Team && TargetChecker.PreCheck(x))
     return (double) x.Distance2D(_SB._Unit.Position) <= 450.0;
       return false;
     }));
     if ((Entity) hero != (Entity) null)
     {
       _SB.IsRunToKill = true;
       foreach (LandBomb landBomb in Core.Config._LandBombs.Where<LandBomb>((Func<LandBomb, bool>) (x => (double) x._Unit.Distance2D(_SB._Unit, false) <= 450.0)))
     landBomb._Unit.Move(hero.Position);
     }
     else if (_SB.IsRunToKill)
     {
       _SB.IsRunToKill = false;
       foreach (LandBomb landBomb in Core.Config._LandBombs.Where<LandBomb>((Func<LandBomb, bool>) (x => (double) x._Unit.Distance2D(_SB._Unit, false) <= 450.0)))
     landBomb._Unit.Stop();
     }
       }
 }
Esempio n. 2
0
        private static bool ShouldDetonateLand(Hero _Enemy, Vector3 _Pos)
        {
            if (!TargetChecker.PreCheck(_Enemy))
            {
                return(false);
            }
            float num = DamageManager._LandDemage(_Enemy);

            return(Core.Config._StasisBombs.Any <StasisBomb>((Func <StasisBomb, bool>)(x => (double)x._Unit.Distance2D(_Pos) <= 400.0)) && (double)Core.Config._LandBombs.Count <LandBomb>((Func <LandBomb, bool>)(x => (double)x._Unit.Distance2D(_Pos) <= 400.0)) * (double)num > (double)_Enemy.Health + (double)_Enemy.HealthRegeneration * 2.0);
        }
Esempio n. 3
0
        private static bool ShouldDetonateCross(Hero _Enemy, Vector3 _Pos)
        {
            if (!TargetChecker.PreCheck(_Enemy))
            {
                return(false);
            }
            float num1 = DamageManager._LandDemage(_Enemy);

            if (Core.Config._StasisBombs.Any <StasisBomb>((Func <StasisBomb, bool>)(x => (double)x._Unit.Distance2D(_Pos) <= 400.0)))
            {
                float num2  = (float)Core.Config._LandBombs.Count <LandBomb>((Func <LandBomb, bool>)(x => (double)x._Unit.Distance2D(_Pos) <= 400.0)) * num1;
                int   num3  = 0;
                int   index = -1;
                foreach (string heroesFullName in Core.Config._HeroesFullNames)
                {
                    if (heroesFullName == _Enemy.Name)
                    {
                        index = num3;
                        break;
                    }
                    ++num3;
                }
                RemoteBomb[]        array  = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x => x.IsHit(_Pos))).ToArray <RemoteBomb>();
                List <EnterInStack> source = new List <EnterInStack>();
                foreach (RemoteBomb remoteBomb in array)
                {
                    RemoteBomb B     = remoteBomb;
                    BombStack  _Temp = Core.Config._BombStacks.MinOrDefault <BombStack, float>((Func <BombStack, float>)(x => B._Unit.Distance2D(x._Unit, false)));
                    if (_Temp != null && (double)_Temp._Unit.Distance2D(B._Unit, false) <= 100.0 && (index == -1 ? 1 : (_Temp._Disabler[index] ? 1 : 0)) == 0)
                    {
                        if (source.Any <EnterInStack>((Func <EnterInStack, bool>)(x => x.Stack.Id == _Temp.Id)))
                        {
                            if (!source.Any <EnterInStack>((Func <EnterInStack, bool>)(x => x.Bombs.Any <RemoteBomb>((Func <RemoteBomb, bool>)(y => (Entity)y._Unit == (Entity)B._Unit)))))
                            {
                                source.First <EnterInStack>((Func <EnterInStack, bool>)(x => x.Stack.Id == _Temp.Id)).Bombs.Add(B);
                            }
                        }
                        else
                        {
                            EnterInStack enterInStack = new EnterInStack()
                            {
                                Bombs = new List <RemoteBomb>(),
                                Stack = _Temp
                            };
                            enterInStack.Bombs.Add(B);
                            source.Add(enterInStack);
                        }
                    }
                }
                float num4 = 0.0f;
                foreach (EnterInStack enterInStack in source)
                {
                    if (enterInStack.Stack.DetonateOnHeroes == 1)
                    {
                        float num5 = enterInStack.Bombs.Sum <RemoteBomb>((Func <RemoteBomb, float>)(x => x._Damage)) * (1f - Core.Config._QSpell.GetDamageReduction((Unit)_Enemy));
                        if ((double)num4 < (double)num5)
                        {
                            num4 = num5;
                        }
                    }
                }
                if ((double)num2 + (double)num4 > (double)_Enemy.Health + (double)_Enemy.HealthRegeneration * 2.0)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 4
0
 public static async Task OnUpdateAsync()
 {
     try
     {
         List <BombStack> .Enumerator enumerator;
         enumerator = Core.Config._BombStacks.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 BombStack _Stack = enumerator.Current;
                 if (_Stack.DetonateOnHeroes == 1)
                 {
                     if (Core.Config._Menu.Features.UseOldHeroSelector)
                     {
                         foreach (Hero _Enemy in Heroes.GetByTeam(Team.Dire == Core.Config._Hero.Team ? Team.Dire : Team.Radiant).Where <Hero>((Func <Hero, bool>)(x =>
                         {
                             if (!x.IsIllusion && TargetChecker.PreCheck(x) && TargetChecker.CheckPos(x, _Stack))
                             {
                                 return(!TargetChecker.CanCounter(x));
                             }
                             return(false);
                         })))
                         {
                             await DetonationLogic.SingleDetonationAsync(_Enemy, _Stack);
                         }
                     }
                     else
                     {
                         foreach (Hero _Enemy in EntityManager <Hero> .Entities.Where <Hero>((Func <Hero, bool>)(x =>
                         {
                             if (x.Team != Core.Config._Hero.Team && !x.IsIllusion && (TargetChecker.PreCheck(x) && TargetChecker.CheckPos(x, _Stack)))
                             {
                                 return(!TargetChecker.CanCounter(x));
                             }
                             return(false);
                         })))
                         {
                             await DetonationLogic.SingleDetonationAsync(_Enemy, _Stack);
                         }
                     }
                 }
                 else
                 {
                     int           num2       = 0;
                     int           num3       = 0;
                     List <string> stringList = new List <string>();
                     IOrderedEnumerable <RemoteBomb> orderedEnumerable = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x => (double)x._Unit.Distance2D(_Stack._Unit, false) <= 100.0)).OrderBy <RemoteBomb, float>((Func <RemoteBomb, float>)(x => x._Unit.CreateTime));
                     if (Core.Config._Menu.Features.UseOldHeroSelector)
                     {
                         foreach (Hero hero in Heroes.GetByTeam(Team.Dire == Core.Config._Hero.Team ? Team.Dire : Team.Radiant).Where <Hero>((Func <Hero, bool>)(x =>
                         {
                             if (!x.IsIllusion && TargetChecker.PreCheck(x) && TargetChecker.CheckPos(x, _Stack))
                             {
                                 return(!TargetChecker.CanCounter(x));
                             }
                             return(false);
                         })))
                         {
                             Hero _Enemy            = hero;
                             List <RemoteBomb> list = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x =>
                             {
                                 if (x.IsHit(_Enemy))
                                 {
                                     return((double)x._Unit.Distance2D(_Stack._Unit, false) <= 100.0);
                                 }
                                 return(false);
                             })).OrderBy <RemoteBomb, float>((Func <RemoteBomb, float>)(x => x._Unit.CreateTime)).ToList <RemoteBomb>();
                             int kill = DamageManager.NeedToKill(_Enemy, list);
                             if (list.Count >= kill)
                             {
                                 if (kill > num3 && kill < 100)
                                 {
                                     num3 = kill;
                                 }
                                 ++num2;
                                 stringList.Add(_Enemy.Name);
                             }
                         }
                     }
                     else
                     {
                         foreach (Hero hero in EntityManager <Hero> .Entities.Where <Hero>((Func <Hero, bool>)(x =>
                         {
                             if (x.Team != Core.Config._Hero.Team && !x.IsIllusion && (TargetChecker.PreCheck(x) && TargetChecker.CheckPos(x, _Stack)))
                             {
                                 return(!TargetChecker.CanCounter(x));
                             }
                             return(false);
                         })))
                         {
                             Hero _Enemy            = hero;
                             List <RemoteBomb> list = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x =>
                             {
                                 if (x.IsHit(_Enemy))
                                 {
                                     return((double)x._Unit.Distance2D(_Stack._Unit, false) <= 100.0);
                                 }
                                 return(false);
                             })).OrderBy <RemoteBomb, float>((Func <RemoteBomb, float>)(x => x._Unit.CreateTime)).ToList <RemoteBomb>();
                             int kill = DamageManager.NeedToKill(_Enemy, list);
                             if (list.Count >= kill)
                             {
                                 if (kill > num3 && kill < 100)
                                 {
                                     num3 = kill;
                                 }
                                 ++num2;
                                 stringList.Add(_Enemy.Name);
                             }
                         }
                     }
                     if (num2 >= _Stack.DetonateOnHeroes)
                     {
                         foreach (string Name in stringList)
                         {
                             Sleeper.Sleep(Name, 1f);
                         }
                         int num4 = 0;
                         Core.Config.Log.Warn("DetonateOnStack Multi");
                         foreach (RemoteBomb remoteBomb in (IEnumerable <RemoteBomb>)orderedEnumerable)
                         {
                             remoteBomb.Detonate();
                             ++num4;
                             if (num4 >= num3)
                             {
                                 break;
                             }
                         }
                     }
                 }
             }
         }
         finally
         {
             enumerator.Dispose();
         }
         enumerator = new List <BombStack> .Enumerator();
     }
     catch (Exception ex)
     {
         Core.Config.Log.Error(ex.ToString());
     }
 }