private string GetModeString(UltimateModeType mode, bool overrideFlash)
 {
     if (overrideFlash && mode == UltimateModeType.Flash)
     {
         mode = UltimateModeType.Assisted;
     }
     return(mode.ToString().ToLower());
 }
Esempio n. 2
0
        public static bool Check(UltimateModeType mode,
                                 int min,
                                 List <Obj_AI_Hero> hits,
                                 Func <Obj_AI_Hero, float> calcDamage = null)
        {
            try
            {
                var modeString = mode.ToString().ToLower();
                if (_menu == null || hits == null || !hits.Any())
                {
                    return(false);
                }

                if (_force && HeroListManager.Enabled("ultimate-force"))
                {
                    var killable    = _menu.Item(_menu.Name + ".ultimate.force.combo-killable").GetValue <bool>();
                    var additional  = _menu.Item(_menu.Name + ".ultimate.force.additional").GetValue <Slider>().Value;
                    var damageMulti =
                        (_menu.Item(_menu.Name + ".ultimate.single.damage.percent").GetValue <Slider>().Value / 100f);
                    if (
                        hits.Any(
                            hit =>
                            HeroListManager.Check("ultimate-force", hit) &&
                            (!killable || calcDamage == null || calcDamage(hit) * damageMulti > hit.Health)) &&
                        hits.Count >= additional + 1)
                    {
                        return(true);
                    }
                }

                if (_required && HeroListManager.Enabled("ultimate-required-" + modeString))
                {
                    var minReq =
                        _menu.Item(_menu.Name + ".ultimate." + modeString + ".required.min").GetValue <Slider>().Value;
                    var enabledHeroes = HeroListManager.GetEnabledHeroes("ultimate-required-" + modeString);
                    if (minReq > 0 && enabledHeroes.Count > 0)
                    {
                        var count =
                            enabledHeroes.Where(
                                e => !e.IsDead && e.IsVisible && e.Distance(ObjectManager.Player) <= 2000)
                            .Count(e => hits.Any(h => h.NetworkId.Equals(e.NetworkId)));
                        if (count < minReq)
                        {
                            return(false);
                        }
                    }
                }

                return(hits.Count >= min);
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(false);
        }
 private string GetModeString(UltimateModeType mode, bool overrideFlash)
 {
     if (overrideFlash && mode == UltimateModeType.Flash)
     {
         mode = UltimateModeType.Assisted;
     }
     return mode.ToString().ToLower();
 }
 private string GetModeString(UltimateModeType mode)
 {
     if (mode == UltimateModeType.Flash)
     {
         mode = UltimateModeType.Assisted;
     }
     return mode.ToString().ToLower();
 }
        public static bool Check(UltimateModeType mode,
            int min,
            List<Obj_AI_Hero> hits,
            Func<Obj_AI_Hero, float> calcDamage = null)
        {
            try
            {
                var modeString = mode.ToString().ToLower();
                if (_menu == null || hits == null || !hits.Any())
                {
                    return false;
                }

                if (_force && HeroListManager.Enabled("ultimate-force"))
                {
                    var killable = _menu.Item(_menu.Name + ".ultimate.force.combo-killable").GetValue<bool>();
                    var additional = _menu.Item(_menu.Name + ".ultimate.force.additional").GetValue<Slider>().Value;
                    var damageMulti =
                        (_menu.Item(_menu.Name + ".ultimate.single.damage.percent").GetValue<Slider>().Value / 100f);
                    if (
                        hits.Any(
                            hit =>
                                HeroListManager.Check("ultimate-force", hit) &&
                                (!killable || calcDamage == null || calcDamage(hit) * damageMulti > hit.Health)) &&
                        hits.Count >= additional + 1)
                    {
                        return true;
                    }
                }

                if (_required && HeroListManager.Enabled("ultimate-required-" + modeString))
                {
                    var minReq =
                        _menu.Item(_menu.Name + ".ultimate." + modeString + ".required.min").GetValue<Slider>().Value;
                    var enabledHeroes = HeroListManager.GetEnabledHeroes("ultimate-required-" + modeString);
                    if (minReq > 0 && enabledHeroes.Count > 0)
                    {
                        var count =
                            enabledHeroes.Where(
                                e => !e.IsDead && e.IsVisible && e.Distance(ObjectManager.Player) <= 2000)
                                .Count(e => hits.Any(h => h.NetworkId.Equals(e.NetworkId)));
                        if (count < minReq)
                        {
                            return false;
                        }
                    }
                }

                return hits.Count >= min;
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return false;
        }