コード例 #1
0
ファイル: Kalista.cs プロジェクト: 47110572/LeagueSharp-Dev
        protected override void OnPreUpdate()
        {
            if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear ||
                Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit)
            {
                var eBig    = Menu.Item(Menu.Name + ".lasthit.e-big").GetValue <bool>();
                var eJungle = Menu.Item(Menu.Name + ".lasthit.e-jungle").GetValue <bool>();
                var eSiege  = Menu.Item(Menu.Name + ".lasthit.e-siege").GetValue <bool>();
                var eTurret = Menu.Item(Menu.Name + ".lasthit.e-turret").GetValue <bool>();
                var eReset  = Menu.Item(Menu.Name + ".miscellaneous.e-reset").GetValue <bool>();

                IEnumerable <Obj_AI_Minion> minions = new HashSet <Obj_AI_Minion>();
                if (eSiege || eTurret || eReset)
                {
                    minions = GameObjects.EnemyMinions.Where(e => e.IsValidTarget(E.Range) && Rend.IsKillable(e, true));
                }

                if (E.IsReady())
                {
                    if (ManaManager.Check("lasthit"))
                    {
                        if (eSiege)
                        {
                            if (
                                minions.Any(
                                    m =>
                                    (m.CharData.BaseSkinName.Contains("MinionSiege") ||
                                     m.CharData.BaseSkinName.Contains("Super"))))
                            {
                                E.Cast();
                                return;
                            }
                        }
                        if (eTurret)
                        {
                            if (minions.Any(m => Utils.UnderAllyTurret(m.Position)))
                            {
                                E.Cast();
                                return;
                            }
                        }
                    }
                    if (eBig || eJungle)
                    {
                        var enemySmites =
                            GameObjects.EnemyHeroes.Where(
                                e =>
                                !e.IsDead && e.Distance(Player) < SummonerManager.Smite.Range * 1.5f &&
                                SummonerManager.IsSmiteReady(e));
                        var allySmites =
                            (from ally in
                             GameObjects.AllyHeroes.Where(
                                 e => !e.IsDead && e.Distance(Player) < SummonerManager.Smite.Range)
                             let spell = SummonerManager.GetSmiteSpell(ally)
                                         where
                                         spell != null &&
                                         (spell.IsReady() || spell.Cooldown - spell.CooldownExpires - Game.Time <= 3)
                                         select ally).ToList();

                        if (eJungle && Player.Level > 3 ||
                            eBig && (enemySmites.Any() || !allySmites.Any() || Player.CountEnemiesInRange(1000) > 1))
                        {
                            var creeps =
                                GameObjects.Jungle.Where(e => e.IsValidTarget(E.Range) && Rend.IsKillable(e, false))
                                .ToList();
                            if (eJungle && creeps.Any() ||
                                eBig &&
                                creeps.Any(
                                    m =>
                                    (m.CharData.BaseSkinName.StartsWith("SRU_Dragon") ||
                                     m.CharData.BaseSkinName.StartsWith("SRU_Baron"))))
                            {
                                E.Cast();
                                return;
                            }
                        }
                    }
                }

                if (eReset && E.IsReady() && ManaManager.Check("misc") &&
                    GameObjects.EnemyHeroes.Any(e => Rend.HasBuff(e) && e.IsValidTarget(E.Range)))
                {
                    if (minions.Any())
                    {
                        E.Cast();
                        return;
                    }
                }
            }
            if (Menu.Item(Menu.Name + ".ultimate.save").GetValue <bool>() && SoulBound.Unit != null && R.IsReady() &&
                !SoulBound.Unit.InFountain())
            {
                SoulBound.Clean();
                var enemies = SoulBound.Unit.CountEnemiesInRange(500);
                if ((SoulBound.Unit.HealthPercent <= 10 && SoulBound.Unit.CountEnemiesInRange(500) > 0) ||
                    (SoulBound.Unit.HealthPercent <= 5 && SoulBound.TotalDamage > SoulBound.Unit.Health && enemies == 0) ||
                    (SoulBound.Unit.HealthPercent <= 50 && SoulBound.TotalDamage > SoulBound.Unit.Health && enemies > 0))
                {
                    R.Cast();
                }
            }
            if (Menu.Item(Menu.Name + ".miscellaneous.w-baron").GetValue <KeyBind>().Active&& W.IsReady() &&
                Player.Distance(SummonersRift.River.Baron) <= W.Range)
            {
                W.Cast(SummonersRift.River.Baron);
            }
            if (Menu.Item(Menu.Name + ".miscellaneous.w-dragon").GetValue <KeyBind>().Active&& W.IsReady() &&
                Player.Distance(SummonersRift.River.Dragon) <= W.Range)
            {
                W.Cast(SummonersRift.River.Dragon);
            }

            if (SoulBound.Unit == null)
            {
                SoulBound.Unit =
                    GameObjects.AllyHeroes.FirstOrDefault(
                        a =>
                        a.Buffs.Any(
                            b =>
                            b.Caster.IsMe &&
                            b.Name.Equals("kalistacoopstrikeally", StringComparison.OrdinalIgnoreCase)));
            }
            if (SoulBound.Unit != null && SoulBound.Unit.Distance(Player) < R.Range && R.IsReady())
            {
                var blitz = Menu.Item(Menu.Name + ".ultimate.blitzcrank.r").GetValue <bool>();
                var tahm  = Menu.Item(Menu.Name + ".ultimate.tahm-kench.r").GetValue <bool>();
                foreach (var enemy in
                         GameObjects.EnemyHeroes.Where(e => (blitz || tahm) && !e.IsDead && e.Distance(Player) < 3000))
                {
                    if (blitz)
                    {
                        var blitzBuff =
                            enemy.Buffs.FirstOrDefault(
                                b =>
                                b.IsActive && b.Caster.NetworkId.Equals(SoulBound.Unit.NetworkId) &&
                                b.Name.Equals("rocketgrab2", StringComparison.OrdinalIgnoreCase));
                        if (blitzBuff != null)
                        {
                            if (!HeroListManager.Check("blitzcrank", enemy))
                            {
                                if (!SoulBound.Unit.UnderTurret(false) && SoulBound.Unit.Distance(enemy) > 750f &&
                                    SoulBound.Unit.Distance(Player) > R.Range / 3f)
                                {
                                    R.Cast();
                                }
                            }
                            return;
                        }
                    }
                    if (tahm)
                    {
                        var tahmBuff =
                            enemy.Buffs.FirstOrDefault(
                                b =>
                                b.IsActive && b.Caster.NetworkId.Equals(SoulBound.Unit.NetworkId) &&
                                b.Name.Equals("tahmkenchwdevoured", StringComparison.OrdinalIgnoreCase));
                        if (tahmBuff != null)
                        {
                            if (!HeroListManager.Check("tahm-kench", enemy))
                            {
                                if (!SoulBound.Unit.UnderTurret(false) &&
                                    (SoulBound.Unit.Distance(enemy) > Player.AttackRange ||
                                     GameObjects.AllyHeroes.Where(
                                         a => a.NetworkId != SoulBound.Unit.NetworkId && a.NetworkId != Player.NetworkId)
                                     .Any(t => t.Distance(Player) > 600) ||
                                     GameObjects.AllyTurrets.Any(t => t.Distance(Player) < 600)))
                                {
                                    R.Cast();
                                }
                            }
                            return;
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void OnCorePreUpdate(EventArgs args)
        {
            try
            {
                if (Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Combo &&
                    Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Flee)
                {
                    var eBig    = Menu.Item(Menu.Name + ".lasthit.e-big").GetValue <bool>();
                    var eTurret = Menu.Item(Menu.Name + ".lasthit.e-turret").GetValue <bool>();
                    var eReset  = Menu.Item(Menu.Name + ".miscellaneous.e-reset").GetValue <bool>();

                    IEnumerable <Obj_AI_Minion> minions = new HashSet <Obj_AI_Minion>();
                    if (eBig || eTurret || eReset)
                    {
                        minions =
                            GameObjects.EnemyMinions.Where(e => e.IsValidTarget(E.Range) && Rend.IsKillable(e, true));
                    }

                    if (E.IsReady())
                    {
                        if (eBig)
                        {
                            var creeps =
                                GameObjects.Jungle.Where(e => e.IsValidTarget(E.Range) && Rend.IsKillable(e, false))
                                .Concat(minions)
                                .ToList();
                            if (
                                creeps.Any(
                                    m =>
                                    (m.CharData.BaseSkinName.Contains("MinionSiege") ||
                                     m.CharData.BaseSkinName.Contains("Super") ||
                                     m.CharData.BaseSkinName.StartsWith("SRU_Dragon") ||
                                     m.CharData.BaseSkinName.StartsWith("SRU_Baron"))))
                            {
                                E.Cast();
                                return;
                            }
                        }

                        if (eTurret && ManaManager.Check("lasthit"))
                        {
                            var minion =
                                minions.FirstOrDefault(
                                    m => Utils.UnderAllyTurret(m.Position) && Rend.IsKillable(m, false));
                            if (minion != null)
                            {
                                E.Cast();
                                return;
                            }
                        }
                    }

                    if (eReset && E.IsReady() && ManaManager.Check("misc") &&
                        GameObjects.EnemyHeroes.Any(e => Rend.HasBuff(e) && e.IsValidTarget(E.Range)))
                    {
                        if (minions.Any())
                        {
                            E.Cast();
                            return;
                        }
                    }
                }
                if (Menu.Item(Menu.Name + ".ultimate.save").GetValue <bool>() && SoulBound.Unit != null && R.IsReady() &&
                    !SoulBound.Unit.InFountain())
                {
                    SoulBound.Clean();
                    var enemies = SoulBound.Unit.CountEnemiesInRange(500);
                    if ((SoulBound.Unit.HealthPercent <= 10 && SoulBound.Unit.CountEnemiesInRange(500) > 0) ||
                        (SoulBound.Unit.HealthPercent <= 5 && SoulBound.TotalDamage > SoulBound.Unit.Health &&
                         enemies == 0) ||
                        (SoulBound.Unit.HealthPercent <= 50 && SoulBound.TotalDamage > SoulBound.Unit.Health &&
                         enemies > 0))
                    {
                        R.Cast();
                    }
                }
                if (Menu.Item(Menu.Name + ".miscellaneous.w-baron").GetValue <KeyBind>().Active&& W.IsReady() &&
                    Player.Distance(SummonersRift.River.Baron) <= W.Range)
                {
                    W.Cast(SummonersRift.River.Baron);
                }
                if (Menu.Item(Menu.Name + ".miscellaneous.w-dragon").GetValue <KeyBind>().Active&& W.IsReady() &&
                    Player.Distance(SummonersRift.River.Dragon) <= W.Range)
                {
                    W.Cast(SummonersRift.River.Dragon);
                }

                if (SoulBound.Unit == null)
                {
                    SoulBound.Unit =
                        GameObjects.AllyHeroes.FirstOrDefault(
                            a =>
                            a.Buffs.Any(
                                b =>
                                b.Caster.IsMe &&
                                b.Name.Equals("kalistacoopstrikeally", StringComparison.OrdinalIgnoreCase)));
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }