Example #1
0
        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();
        }
Example #2
0
        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();
            }
        }
Example #3
0
        static void Main()
        {
            CustomEvents.Game.OnGameLoad += (eArgs) =>
            {
                DevAssistant.Init(); //todo: remove
                if (ObjectManager.Player.ChampionName != "Kalista")
                {
                    return;
                }

                var alwaysStealBaronAndDrake = false;

                var mainMenu = new Menu("The Kalista", "TheKalista", true);
                mainMenu.AddToMainMenu();

                var orbwalkerMenu      = mainMenu.CreateSubmenu("Orbwalker");
                var targetselectorMenu = mainMenu.CreateSubmenu("Target Selector");
                var comboMenu          = mainMenu.CreateSubmenu("Combo");
                var ultMenu            = comboMenu.CreateSubmenu("R Settings");
                var harassMenu         = mainMenu.CreateSubmenu("Harass");
                var laneclearMenu      = mainMenu.CreateSubmenu("Laneclear");
                var lasthitMenu        = mainMenu.CreateSubmenu("Lasthit / Steal");
                var itemsMenu          = mainMenu.CreateSubmenu("Items");
                var summonersMenu      = mainMenu.CreateSubmenu("Summoners");
                var miscMenu           = mainMenu.CreateSubmenu("Misc");
                var autoLevelSpells    = mainMenu.CreateSubmenu("Auto Level Spells");
                var drawingsMenu       = mainMenu.CreateSubmenu("Drawings");

                var q = new KalistaQ(SpellSlot.Q, 1200, TargetSelector.DamageType.Physical);
                var w = new KalistaW(SpellSlot.W);
                var e = new KalistaE(SpellSlot.E, 1000, TargetSelector.DamageType.Physical);
                var r = new KalistaR(SpellSlot.R, 1500, TargetSelector.DamageType.Physical);

                var orbwalker = new KalistaWalker(orbwalkerMenu);
                KalistaTargetSelector.AddToMenu(targetselectorMenu, e);
                orbwalkerMenu.Item("ExtraWindup").DontSave();
                orbwalkerMenu.Item("ExtraWindup").SetValue(new Slider(0, 0, 1));
                orbwalkerMenu.AddMItem("(You don't need extra windup on Kalista)").FontColor = new SharpDX.Color(218, 165, 32);

                var provider = new KalistaCombo(2100, orbwalker, q, w, e, r);
                provider.Initialize();

                provider.CreateBasicMenu(null, null, null, null, null, null, null, drawingsMenu);
                provider.CreateComboMenu(comboMenu, SpellSlot.W);
                provider.CreateLaneclearMenu(harassMenu, true, SpellSlot.W);
                provider.CreateLaneclearMenu(laneclearMenu, true, SpellSlot.W);
                //provider.CreateLasthitMenu(lasthitMenu, true, SpellSlot.Q, SpellSlot.E);
                provider.CreateItemsMenu(itemsMenu, new BilgewaterCutlass(), new Botrk(), new YoumusBlade(), new Qss(), new MercuralScimitar());
                provider.CreateSummonersMenu(summonersMenu, new Cleanse(), new Heal());
                provider.CreateAutoLevelMenu(autoLevelSpells, Commons.ComboSystem.ComboProvider.SpellOrder.RWEQ, Commons.ComboSystem.ComboProvider.SpellOrder.REQW);

                comboMenu.AddMItem("Focus", new StringList(new[] { "Most Damage", "More Damage", "Damage + Mobility", "More Mobility", "Most Mobility" }), val => e.MobilityType = val.SelectedIndex);

                if (HeroManager.Allies.Any(ally => ally.ChampionName == "Blitzcrank"))
                {
                    ultMenu.AddMItem("Balista", true, val => r.Balista = val);
                    ultMenu.AddMItem("Balista min. range", new Slider(700, 100, 1450), val => r.BalistaDistance = val.Value); //vales from iKalista
                }

                ultMenu.AddMItem("Ally Health %", new Slider(15), val => r.AllyHealth = val.Value);
                ultMenu.AddMItem("My Health %", new Slider(35), val => r.MyHealth     = val.Value);
                ultMenu.AddMItem("Smart peel", true, val => r.SmartPeel = val);
                //ultMenu.AddMItem("Possible hit count", new Slider(4, 0, 6), val => r.HitCount = val.Value);
                ultMenu.AddMItem("(Will ult if any condition is met)").FontColor = new SharpDX.Color(218, 165, 32); // Color.Goldenrod 218 165 32

                lasthitMenu.AddMItem("E minions it would miss", true, val => e.FarmAssist  = val);
                lasthitMenu.AddMItem("Min Mana %", new Slider(50), val => e.FarmAssistMana = val.Value);
                lasthitMenu.AddMItem("Always steal Baron and Drake", true, val => alwaysStealBaronAndDrake = val);
                lasthitMenu.AddMItem("Jungle steal in Mixed/Lasthit/Clear", true, val => e.StealJungle     = val);

                laneclearMenu.AddMItem("Min. E kills", new Slider(4, 1, 12), val => e.MinLaneclear = val.Value);
                laneclearMenu.AddMItem("Min. Q kills", new Slider(3, 1, 12), val => q.MinLaneclear = val.Value);



                miscMenu.AddMItem("Stuck W Baron", new KeyBind("T"[0], KeyBindType.Press), val =>
                {
                    if (val.Active)
                    {
                        if (w.BaronPosition.Distance(ObjectManager.Player.Position) < 5000)
                        {
                            w.Cast(w.BaronPosition);
                        }
                        else
                        {
                            Notifications.AddNotification("Not in range!", 3);
                        }
                    }
                });

                miscMenu.AddMItem("Stuck W Dragon", new KeyBind("Y"[0], KeyBindType.Press), val =>
                {
                    if (val.Active)
                    {
                        if (w.DragonPosition.Distance(ObjectManager.Player.Position) < 5000)
                        {
                            w.Cast(w.DragonPosition);
                        }
                        else
                        {
                            Notifications.AddNotification("Not in range!", 3);
                        }
                    }
                });
                miscMenu.AddMItem("E damage reduction", new Slider(20), val => e.Reduction = val.Value);


                var autobuyblue        = miscMenu.AddMItem("Autobuy: Blue Trinket", true);
                var autobuyblueLevel   = miscMenu.AddMItem("Autobuy: Blue Trinket: Level", new Slider(10, 1, 18));
                var autoUseBlueTrinket = true;
                miscMenu.AddMItem("Use blue trinket", true, val => autoUseBlueTrinket = val);

                AttackableUnit.OnLeaveTeamVisiblity += (sender, args) =>
                {
                    if (autoUseBlueTrinket && sender.Type == GameObjectType.obj_AI_Hero && sender.IsEnemy && !sender.IsDead && !((Obj_AI_Hero)sender).UnderTurret() && sender.Position.Distance(ObjectManager.Player.Position, true) < 500 * 500 && provider.Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo)
                    {
                        var orb = ObjectManager.Player.Spellbook.Spells.FirstOrDefault(spell => spell.Name.ToLower().Contains("trinketorb"));
                        if (orb != null)
                        {
                            ObjectManager.Player.Spellbook.CastSpell(orb.Slot, sender.Position);
                        }
                        var trinket = ObjectManager.Player.Spellbook.Spells.FirstOrDefault(spell => spell.Name.ToLower().Contains("trinkettotem"));
                        if (trinket != null)
                        {
                            ObjectManager.Player.Spellbook.CastSpell(trinket.Slot, sender.Position);
                        }
                    }
                };
                //itemmercurial & Mercurial_Scimitar / / ItemMercurial
                //QuicksilverSash & Quicksilver_Sash / / QuicksilverSash
                //drawingsMenu.AddMItem("E progress", new StringList(new[] {"AAs to kill", "% to kill"}), list => e.DrawCount = list.SelectedIndex == 0);

                Drawing.OnDraw += _ =>
                {
                    //Drawing.DrawText(200, 200, Color.Red, e.Instance.GetState().ToString());
                    //Profiler.DrawSections(700, 200);
                };

                Game.OnUpdate += _ =>
                {
                    Profiler.Clear(); //Todo: remove

                    if (alwaysStealBaronAndDrake || provider.Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.None)
                    {
                        if (Baron.IsValidTarget(e.Range) && Baron.Health < Baron.MaxHealth)
                        {
                            var damage = e.GetDamage(Baron);
                            if (ObjectManager.Player.HasBuff("barontarget"))
                            {
                                damage *= 0.5f;
                            }
                            if (damage > Baron.Health)
                            {
                                e.Cast();
                            }
                        }

                        if (Dragon.IsValidTarget(e.Range) && Dragon.Health < Dragon.MaxHealth)
                        {
                            var damage = e.GetDamage(Dragon);
                            if (ObjectManager.Player.HasBuff("s5test_dragonslayerbuff"))
                            {
                                damage *= (1 - (.07f * ObjectManager.Player.GetBuffCount("s5test_dragonslayerbuff")));
                            }
                            if (damage > Dragon.Health)
                            {
                                e.Cast();
                            }
                        }
                    }

                    provider.Update();

                    if (!TickLimiter.Limit(1000))
                    {
                        return;
                    }

                    if (Soulbound == null)
                    {
                        Soulbound = HeroManager.Allies.FirstOrDefault(ally => ally.HasBuff("kalistacoopstrikeally"));
                    }

                    if (Baron == null || Dragon != null)
                    {
                        Baron  = ObjectManager.Get <Obj_AI_Minion>().FirstOrDefault(min => min.Name.StartsWith("SRU_Baron"));
                        Dragon = ObjectManager.Get <Obj_AI_Minion>().FirstOrDefault(min => min.Name.StartsWith("SRU_Dragon"));
                    }

                    if (autobuyblue.IsActive() && ObjectManager.Player.Level >= autobuyblueLevel.GetValue <Slider>().Value&& ObjectManager.Player.InFountain() && ObjectManager.Player.InventoryItems.Any(item => item.Id == ItemId.Warding_Totem_Trinket))
                    {
                        ObjectManager.Player.BuyItem(ItemId.Scrying_Orb_Trinket);
                    }
                };

                //var pos = ObjectManager.Player.Position;
                //Drawing.OnDraw += _ =>
                //{
                //    Drawing.DrawText(600, 600, Color.Red, ObjectManager.Player.Position.Distance(pos).ToString());
                //};
            };
        }
Example #4
0
        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);
        }