public static AIHeroClient GetTarget(float range, DamageType damageType, bool ignoreShield = true, IEnumerable <AIHeroClient> ignoredChamps = null, Vector3?rangeCheckFrom = null, TargetSelectionConditionDelegate conditions = null) { return(GetTarget(ObjectManager.Player, range, damageType, ignoreShield, ignoredChamps, rangeCheckFrom, conditions)); }
public static AIHeroClient GetTarget( Obj_AI_Base champion, float range, DamageType type, bool ignoreShieldSpells = true, IEnumerable <AIHeroClient> ignoredChamps = null, Vector3?rangeCheckFrom = null, TargetSelectionConditionDelegate conditions = null) { try { if (ignoredChamps == null) { ignoredChamps = new List <AIHeroClient>(); } var damageType = (Damage.DamageType)Enum.Parse(typeof(Damage.DamageType), type.ToString()); if (_configMenu != null && IsValidTarget( SelectedTarget, _configMenu.Item("ForceFocusSelected").GetValue <bool>() ? float.MaxValue : range, type, ignoreShieldSpells, rangeCheckFrom)) { return(SelectedTarget); } if (_configMenu != null && IsValidTarget( SelectedTarget, _configMenu.Item("ForceFocusSelectedKeys").GetValue <bool>() ? float.MaxValue : range, type, ignoreShieldSpells, rangeCheckFrom)) { if (_configMenu.Item("ForceFocusSelectedK").GetValue <KeyBind>().Active || _configMenu.Item("ForceFocusSelectedK2").GetValue <KeyBind>().Active) { return(SelectedTarget); } } if (_configMenu != null && _configMenu.Item("TargetingMode") != null && Mode == TargetingMode.AutoPriority) { var menuItem = _configMenu.Item("TargetingMode").GetValue <StringList>(); Enum.TryParse(menuItem.SList[menuItem.SelectedIndex], out Mode); } var targets = EloBuddy.SDK.EntityManager.Heroes.Enemies.FindAll( hero => ignoredChamps.All(ignored => ignored.NetworkId != hero.NetworkId) && IsValidTarget(hero, range, type, ignoreShieldSpells, rangeCheckFrom) && (conditions == null || conditions(hero))); switch (Mode) { case TargetingMode.LowHP: return(targets.MinOrDefault(hero => hero.Health)); case TargetingMode.MostAD: return(targets.MaxOrDefault(hero => hero.BaseAttackDamage + hero.FlatPhysicalDamageMod)); case TargetingMode.MostAP: return(targets.MaxOrDefault(hero => hero.BaseAbilityDamage + hero.FlatMagicDamageMod)); case TargetingMode.Closest: return (targets.MinOrDefault( hero => (rangeCheckFrom.HasValue ? rangeCheckFrom.Value : champion.ServerPosition).Distance( hero.ServerPosition, true))); case TargetingMode.NearMouse: return(targets.MinOrDefault(hero => hero.Distance(Game.CursorPos, true))); case TargetingMode.AutoPriority: return (targets.MaxOrDefault( hero => champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) * GetPriority(hero))); case TargetingMode.LessAttack: return (targets.MaxOrDefault( hero => champion.CalcDamage(hero, Damage.DamageType.Physical, 100) / (1 + hero.Health) * GetPriority(hero))); case TargetingMode.LessCast: return (targets.MaxOrDefault( hero => champion.CalcDamage(hero, Damage.DamageType.Magical, 100) / (1 + hero.Health) * GetPriority(hero))); case TargetingMode.MostStack: return (targets.MaxOrDefault( hero => champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) * GetPriority(hero) + (1 + hero.Buffs.Where(b => StackNames.Contains(b.Name.ToLower())).Sum(t => t.Count)))); } } catch (Exception e) { Console.WriteLine(e); } return(null); }
public static AIHeroClient GetTarget(Obj_AI_Base champion, float range, DamageType type, bool ignoreShieldSpells = true, IEnumerable<AIHeroClient> ignoredChamps = null, Vector3? rangeCheckFrom = null, TargetSelectionConditionDelegate conditions = null) { try { if (ignoredChamps == null) { ignoredChamps = new List<AIHeroClient>(); } var damageType = (EloBuddy.DamageType)Enum.Parse(typeof(EloBuddy.DamageType), type.ToString()); if (_configMenu != null && IsValidTarget( SelectedTarget, focusMenu["ForceFocusSelected"].Cast<CheckBox>().CurrentValue ? float.MaxValue : range, type, ignoreShieldSpells, rangeCheckFrom)) { return SelectedTarget; } if (_configMenu != null && IsValidTarget( SelectedTarget, focusMenu["ForceFocusSelectedKeys"].Cast<CheckBox>().CurrentValue ? float.MaxValue : range, type, ignoreShieldSpells, rangeCheckFrom)) { if (focusMenu["ForceFocusSelectedK"].Cast<KeyBind>().CurrentValue || focusMenu["ForceFocusSelectedK2"].Cast<KeyBind>().CurrentValue) { return SelectedTarget; } } if (_configMenu != null && _configMenu["TargetingMode"] != null && Mode == TargetingMode.AutoPriority) { var menuItem = _configMenu["TargetingMode"].Cast<ComboBox>().CurrentValue; Enum.TryParse(getMode().ToString(), out Mode); } var targets = EntityManager.Heroes.Enemies .FindAll( hero => ignoredChamps.All(ignored => ignored.NetworkId != hero.NetworkId) && IsValidTarget(hero, range, type, ignoreShieldSpells, rangeCheckFrom) && (conditions == null || conditions(hero))); switch (Mode) { case TargetingMode.LowHP: return targets.MinOrDefault(hero => hero.Health); case TargetingMode.MostAD: return targets.MaxOrDefault(hero => hero.BaseAttackDamage + hero.FlatPhysicalDamageMod); case TargetingMode.MostAP: return targets.MaxOrDefault(hero => hero.BaseAbilityDamage + hero.FlatMagicDamageMod); case TargetingMode.Closest: return targets.MinOrDefault( hero => (rangeCheckFrom.HasValue ? rangeCheckFrom.Value : champion.ServerPosition).LSDistance( hero.ServerPosition, true)); case TargetingMode.NearMouse: return targets.MinOrDefault(hero => hero.LSDistance(Game.CursorPos, true)); case TargetingMode.AutoPriority: return targets.MaxOrDefault( hero => champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) * GetPriority(hero)); case TargetingMode.LessAttack: return targets.MaxOrDefault( hero => champion.CalcDamage(hero, EloBuddy.DamageType.Physical, 100) / (1 + hero.Health) * GetPriority(hero)); case TargetingMode.LessCast: return targets.MaxOrDefault( hero => champion.CalcDamage(hero, EloBuddy.DamageType.Magical, 100) / (1 + hero.Health) * GetPriority(hero)); case TargetingMode.MostStack: return targets.MaxOrDefault( hero => champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) * GetPriority(hero) + (1 + hero.Buffs.Where(b => StackNames.Contains(b.Name.ToLower())).Sum(t => t.Count))); } } catch (Exception e) { Console.WriteLine(e); } return null; }
public static AIHeroClient GetTarget(float range, DamageType damageType, bool ignoreShield = true, IEnumerable<AIHeroClient> ignoredChamps = null, Vector3? rangeCheckFrom = null, TargetSelectionConditionDelegate conditions = null) { return GetTarget(ObjectManager.Player, range, damageType, ignoreShield, ignoredChamps, rangeCheckFrom, conditions); }