private void KillAnyone() { foreach (var enemy in HeroManager.Enemies) { if (!enemy.IsValidTarget(Range) || KalistaTargetSelector.IsInvulnerable(enemy, KalistaTargetSelector.DamageType.Physical, false)) { continue; } var damage = GetDamage(enemy); if (_flyingAttacks.ContainsKey(enemy) && _flyingAttacks[enemy].IsValid) { var flyingAuto = _flyingAttacks[enemy]; // if(flyingAuto) if (flyingAuto.Position.Distance(enemy.Position, true) < 300 * 300) { damage += KalistaWalker.GetDamageForOneAuto(enemy, Level, flyingAuto.SData.MissileSpeed < 2600); } } if (damage > enemy.Health && !KalistaTargetSelector.IsInvulnerable(enemy, KalistaTargetSelector.DamageType.Physical, false)) { Cast(); } } //if (HeroManager.Enemies.Any(enemy => enemy.IsValidTarget(Range) && IsKillable(enemy) && !enemy.HasSpellShield() && !TargetSelector.IsInvulnerable(enemy, TargetSelector.DamageType.Physical))) // Cast(); }
public override void Execute(Obj_AI_Hero target) { KillAnyone(); var enemyWithStacks = false; var enemyInAutoRange = false; var sumDamage = 0f; Profiler.StartEndSection("e_collectData"); foreach (var enemy in HeroManager.Enemies) { var valid = enemy.IsValidTarget(Range); if (valid) { if (!enemyInAutoRange && Provider.Orbwalker.InAutoAttackRange(enemy)) { enemyInAutoRange = true; } if (enemy.IsMelee && enemy.AttackRange + ObjectManager.Player.BoundingRadius > ObjectManager.Player.Position.Distance(enemy.Position)) { //enemyWithStacks = false; SlowWithReset(); return; } if (MobilityType != 4 && enemy.HasBuff("Kalistaexpungemarker")) { enemyWithStacks = true; sumDamage += GetDamage(enemy); } } } Profiler.StartEndSection("e_useData"); if (!enemyInAutoRange && enemyWithStacks) { SlowWithReset(); } else if (sumDamage > KalistaWalker.GetDamageForOneAuto(target, Level) * Math.Max(1, (MobilityType + 1) * (MobilityType + 1))) { // Console.WriteLine(sumDamage + " > " + KalistaWalker.GetDamageForOneAuto(target, Level)); SlowWithReset(); } }
public override void Draw() { foreach (var enemy in HeroManager.Enemies) { if (enemy.IsValid && enemy.IsHPBarRendered) { var pos = enemy.HPBarPosition; Drawing.DrawText(pos.X + 145, pos.Y + 20, Color.White, "~" + (Instance.GetState() != SpellState.Cooldown && Instance.State != SpellState.NoMana ? Math.Ceiling((enemy.Health - GetDamage(enemy)) / KalistaWalker.GetDamageForOneAuto(enemy, Level)) : Math.Ceiling(enemy.Health / ObjectManager.Player.GetAutoAttackDamage(enemy))) + " AA"); } } }
public static Obj_AI_Hero GetTarget(Obj_AI_Base champion, float range, DamageType type, bool ignoreShieldSpells = true, IEnumerable <Obj_AI_Hero> ignoredChamps = null, Vector3?rangeCheckFrom = null) { try { if (ignoredChamps == null) { ignoredChamps = new List <Obj_AI_Hero>(); } 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 && _configMenu.Item("TargetingMode2") != null && Mode == TargetingMode.AutoPriority) { var menuItem = _configMenu.Item("TargetingMode2").GetValue <StringList>(); Enum.TryParse(menuItem.SList[menuItem.SelectedIndex], out Mode); } var targets = HeroManager.Enemies .FindAll( hero => ignoredChamps.All(ignored => ignored.NetworkId != hero.NetworkId) && IsValidTarget(hero, range, type, ignoreShieldSpells, rangeCheckFrom)); switch (Mode) { case TargetingMode.SmartKalista: Obj_AI_Hero bestTarget = null; var bestTargetPriority = 0d; foreach (var target in targets) { var edmg = _e.GetDamage(target); if (KalistaWalker.GetDamageForOneAuto(target, _e.Level) + edmg > target.Health) { return(target); } var priority = champion.CalcDamage(target, damageType, 100) / (1 + target.Health - _e.GetDamage(target)) * GetPriority(target); if (priority > bestTargetPriority) { bestTarget = target; bestTargetPriority = priority; } } return(bestTarget); 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.Find(hero => hero.Distance(Game.CursorPos, true) < 22500)); // 150 * 150 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))); } } catch (Exception e) { Console.WriteLine(e); } return(null); }