示例#1
0
 private static bool ShouldDetonate(Hero _Enemy, Vector3 _Pos)
 {
     foreach (BombStack bombStack in Core.Config._BombStacks)
     {
         BombStack _Stack = bombStack;
         if (!TargetChecker.CheckPos(_Enemy, _Stack))
         {
             return(false);
         }
         if (_Stack.DetonateOnHeroes == 1)
         {
             List <RemoteBomb> list = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x =>
             {
                 if (x.IsHit(_Pos))
                 {
                     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)
             {
                 return(true);
             }
         }
         else
         {
             int num = 0;
             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));
             foreach (Hero _Enemy1 in EntityManager <Hero> .Entities.Where <Hero>((Func <Hero, bool>)(x =>
             {
                 if (x.Team != Core.Config._Hero.Team && !x.IsIllusion && TargetChecker.ForcePreCheck(x))
                 {
                     return(TargetChecker.CheckPos(x, _Stack));
                 }
                 return(false);
             })))
             {
                 List <RemoteBomb> list = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x =>
                 {
                     if (x.IsHit(_Pos))
                     {
                         return((double)x._Unit.Distance2D(_Stack._Unit, false) <= 100.0);
                     }
                     return(false);
                 })).OrderBy <RemoteBomb, float>((Func <RemoteBomb, float>)(x => x._Unit.CreateTime)).ToList <RemoteBomb>();
                 List <RemoteBomb> _Bombs = list;
                 int kill = DamageManager.NeedToKill(_Enemy1, _Bombs);
                 if (list.Count >= kill)
                 {
                     ++num;
                 }
             }
             if (num >= _Stack.DetonateOnHeroes)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#2
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());
     }
 }