/// <summary>
        ///     Returns true if the target is a perfectly valid rend target.
        /// </summary>
        /// <param name="unit">The unit.</param>
        public bool IsPerfectRendTarget(AIBaseClient unit)
        {
            var spellRange = SpellClass.E.Range;
            var orbTarget  = Orbwalker.GetOrbwalkingTarget() as AIHeroClient;

            if (orbTarget != null &&
                orbTarget.NetworkID != unit.NetworkID &&
                orbTarget.IsValidSpellTarget(SpellClass.E.Range))
            {
                spellRange = SpellClass.Q.Range;
            }

            if (unit.IsValidSpellTarget(spellRange) &&
                unit.HasBuff("kalistaexpungemarker"))
            {
                switch (unit.Type.TypeID)
                {
                case GameObjectTypeID.AIMinionClient:
                    return(true);

                case GameObjectTypeID.AIHeroClient:
                    var heroUnit = (AIHeroClient)unit;
                    return(!Invulnerable.Check(heroUnit));
                }
            }

            return(false);
        }
Esempio n. 2
0
        /// <summary>
        ///     Fired when the game is updated.
        /// </summary>
        public void LaneClear(EntropyEventArgs args)
        {
            var minions = Extensions.GetEnemyLaneMinionsTargets();

            /// <summary>
            ///     The Q Laneclear Logic.
            /// </summary>
            if (SpellClass.Q.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.Q.Slot, MenuClass.Spells["q"]["laneclear"]) &&
                MenuClass.Spells["q"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                /*
                 * var farmLocation = SpellClass.Q.GetCircularFarmLocation(minions, SpellClass.Q.Width);
                 * if (farmLocation.MinionsHit >= MenuClass.Spells["q"]["customization"]["laneclear"].As<MenuSlider>().Value)
                 * {
                 *  SpellClass.Q.Cast(farmLocation.Position);
                 * }
                 */
            }

            /// <summary>
            ///     The E Laneclear Logic.
            /// </summary>
            if (SpellClass.E.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.E.Slot, MenuClass.Spells["e"]["laneclear"]) &&
                MenuClass.Spells["e"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                var target = Orbwalker.GetOrbwalkingTarget() as AIMinionClient;
                if (target != null &&
                    minions.Contains(target) &&
                    minions.Count(m => m.Distance(target) <= SpellClass.E.Width) >= MenuClass.Spells["e"]["customization"]["laneclear"].As <MenuSlider>().Value)
                {
                    SpellClass.E.Cast();
                }
            }

            /// <summary>
            ///     The R Laneclear Logic.
            /// </summary>
            if (SpellClass.R.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.R.Slot, MenuClass.Spells["r"]["laneclear"]) &&
                MenuClass.Spells["r"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                /*
                 * var farmLocation = SpellClass.R.GetCircularFarmLocation(minions, this.HasBigOne() ? SpellClass.R2.Width : SpellClass.R.Width);
                 * if (farmLocation.MinionsHit >= MenuClass.Spells["q"]["customization"]["laneclear"].As<MenuSlider>().Value)
                 * {
                 *  SpellClass.Q.Cast(farmLocation.Position);
                 * }
                 */
            }
        }
Esempio n. 3
0
        /// <summary>
        ///     Sets the spells.
        /// </summary>
        public void Spells()
        {
            SpellClass.Q = new Spell(SpellSlot.Q);
            SpellClass.W = new Spell(SpellSlot.W, 900f);

            var target = Orbwalker.GetOrbwalkingTarget();

            SpellClass.E = new Spell(SpellSlot.E, target != null ? UtilityClass.Player.GetAutoAttackRange(target) : UtilityClass.Player.GetAutoAttackRange());
            SpellClass.R = new Spell(SpellSlot.R, target != null ? UtilityClass.Player.GetAutoAttackRange(target) : UtilityClass.Player.GetAutoAttackRange());

            SpellClass.W.SetSkillshot(0.75f, 60f, 1000f, false, SkillshotType.Circle);
        }
Esempio n. 4
0
        /// <summary>
        ///     Called on post attack.
        /// </summary>

        /// <param name="args">The <see cref="OnPreAttackEventArgs" /> instance containing the event data.</param>
        public void Laneclear(OnPreAttackEventArgs args)
        {
            /// <summary>
            ///     The Laneclear Q Logic.
            /// </summary>
            if (SpellClass.Q.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.Q.Slot, MenuClass.Spells["q"]["laneclear"]) &&
                MenuClass.Spells["q"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                /*
                 * var farmLocation = SpellClass.Q.GetLinearFarmLocation(minions, SpellClass.Q.Width);
                 * if (farmLocation.MinionsHit >= MenuClass.Spells["q"]["customization"]["laneclear"].As<MenuSlider>().Value)
                 * {
                 *  SpellClass.Q.Cast(farmLocation.Position);
                 * }
                 */
            }

            /// <summary>
            ///     The E Big Minions Lasthit Logic.
            /// </summary>
            if (SpellClass.E.Ready &&
                MenuClass.Spells["e"]["lasthit"].As <MenuBool>().Enabled)
            {
                foreach (var minion in Extensions.GetEnemyLaneMinionsTargetsInRange(SpellClass.E.Range).Where(m =>
                                                                                                              (m.CharName.Contains("Siege") || m.CharName.Contains("Super")) &&
                                                                                                              m.GetRealHealth() < UtilityClass.Player.GetSpellDamage(m, SpellSlot.E)))
                {
                    SpellClass.E.CastOnUnit(minion);
                }
            }

            /// <summary>
            ///     The Laneclear W Logic.
            /// </summary>
            if (SpellClass.W.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.Q.Slot, MenuClass.Spells["w"]["laneclear"]) &&
                MenuClass.Spells["w"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                var mainMinion = Orbwalker.GetOrbwalkingTarget() as AIMinionClient;
                if (mainMinion != null)
                {
                    SpellClass.W.Cast();
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        ///     Called on pre attack.
        /// </summary>

        /// <param name="args">The <see cref="OnPreAttackEventArgs" /> instance containing the event data.</param>
        public void OnPreAttack(OnPreAttackEventArgs args)
        {
            var orbTarget = Orbwalker.GetOrbwalkingTarget();

            if (orbTarget != null)
            {
                var baseTarget = orbTarget as AIBaseClient;
                if (baseTarget != null)
                {
                    if (IsAllured(baseTarget) && !IsFullyAllured(baseTarget) &&
                        MenuClass.Spells["miscellaneous"]["dontaasemiallured"].As <MenuBool>().Enabled)
                    {
                        args.Cancel = true;
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        ///     Fired on spell cast.
        /// </summary>

        /// <param name="args">The <see cref="SpellbookCastSpellEventArgs" /> instance containing the event data.</param>
        public void OnLocalCastSpell(SpellbookLocalCastSpellEventArgs args)
        {
            if (IsUltimateShooting() &&
                args.Slot != SpellSlot.R)
            {
                args.Execute = false;
            }

            switch (args.Slot)
            {
            case SpellSlot.E:
                var target = Orbwalker.GetOrbwalkingTarget() as AIHeroClient;
                if (target != null &&
                    target.HasBuff("jhinetrapslow"))
                {
                    args.Execute = false;
                }
                break;
            }
        }
Esempio n. 7
0
 /// <summary>
 ///     Called on do-cast.
 /// </summary>
 /// <param name="args">The <see cref="OnPostAttackEventArgs" /> instance containing the event data.</param>
 public void Lasthit(OnPostAttackEventArgs args)
 {
     /// <summary>
     ///     The Q FarmHelper Logic.
     /// </summary>
     if (SpellClass.Q.Ready &&
         UtilityClass.Player.MPPercent()
         > ManaManager.GetNeededMana(SpellClass.Q.Slot, MenuClass.Q["farmhelper"]) &&
         MenuClass.Q["farmhelper"].Enabled)
     {
         var posAfterQ = UtilityClass.Player.Position.Extend(Hud.CursorPositionUnclipped, 300f);
         if (Extensions.GetEnemyLaneMinionsTargetsInRange(SpellClass.Q.Range)
             .Any(m => m.Distance(posAfterQ) < UtilityClass.Player.GetAutoAttackRange() &&
                  m != Orbwalker.GetOrbwalkingTarget() &&
                  posAfterQ.EnemyHeroesCount(UtilityClass.Player.GetAutoAttackRange(m)) <= 2 &&
                  m.HP <= UtilityClass.Player.GetAutoAttackDamage(m) + GetQBonusDamage(m)))
         {
             SpellClass.Q.Cast(Hud.CursorPositionUnclipped);
         }
     }
 }
Esempio n. 8
0
        /// <summary>
        ///     Called on do-cast.
        /// </summary>

        /// <param name="args">The <see cref="OnPreAttackEventArgs" /> instance containing the event data.</param>
        public void Laneclear(OnPreAttackEventArgs args)
        {
            /// <summary>
            ///     The Laneclear E Logic.
            /// </summary>
            if (SpellClass.E.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.E.Slot, MenuClass.Spells["e"]["laneclear"]) &&
                MenuClass.Spells["e"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                var idealMinion = Extensions.GetEnemyLaneMinionsTargets().FirstOrDefault(
                    m =>
                    m.IsValidTarget(SpellClass.E.Range) &&
                    Extensions.GetEnemyLaneMinionsTargets()
                    .Count(m2 => m2.Distance(m) < 200f) >= MenuClass.Spells["e"]["customization"]["laneclear"].Value);

                if (idealMinion != null)
                {
                    SpellClass.E.CastOnUnit(idealMinion);
                }
            }

            var minionTarget = Orbwalker.GetOrbwalkingTarget() as AIMinionClient;

            if (minionTarget == null ||
                !Extensions.GetEnemyLaneMinionsTargets().Contains(minionTarget))
            {
                return;
            }

            /// <summary>
            ///     The Laneclear Q Logic.
            /// </summary>
            if (SpellClass.Q.Ready &&
                MenuClass.Spells["q"]["laneclear"].As <MenuBool>().Enabled)
            {
                SpellClass.Q.Cast();
            }
        }
Esempio n. 9
0
        /// <summary>
        ///     Called on post attack.
        /// </summary>

        /// <param name="args">The <see cref="OnPostAttackEventArgs" /> instance containing the event data.</param>
        public void Laneclear(OnPostAttackEventArgs args)
        {
            /// <summary>
            ///     The Laneclear Q Logic.
            /// </summary>
            if (SpellClass.Q.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.Q.Slot, MenuClass.Spells["q"]["laneclear"]) &&
                MenuClass.Spells["q"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                /*
                 * var farmLocation = SpellClass.Q.GetLinearFarmLocation(minions, SpellClass.Q.Width);
                 * if (farmLocation.MinionsHit >= MenuClass.Spells["q"]["customization"]["laneclear"].As<MenuSlider>().Value)
                 * {
                 *  SpellClass.Q.Cast(farmLocation.Position);
                 * }
                 */
            }

            /// <summary>
            ///     The Laneclear W Logic.
            /// </summary>
            if (SpellClass.W.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.Q.Slot, MenuClass.Spells["w"]["laneclear"]) &&
                MenuClass.Spells["w"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                var mainMinion = Orbwalker.GetOrbwalkingTarget() as AIMinionClient;
                if (mainMinion != null &&
                    Extensions.GetEnemyLaneMinionsTargets().Count(m => m.Distance(mainMinion) <= 250f) >=
                    MenuClass.Spells["w"]["customization"]["laneclear"].As <MenuSlider>().Value)
                {
                    SpellClass.W.Cast();
                }
            }
        }
Esempio n. 10
0
        private static void ResetToDefalut()
        {
            try
            {
                var selectTarget = TargetSelector.GetSelectedTarget();
                var orbTarget    = Orbwalker.GetOrbwalkingTarget() as Obj_AI_Hero;

                if (selectTarget != null && !selectTarget.IsDead && selectTarget.IsValid && selectTarget.IsValidTarget())
                {
                    myTarget = selectTarget;
                }
                else if (orbTarget != null && !orbTarget.IsDead && orbTarget.IsValid && orbTarget.Type == GameObjectType.obj_AI_Hero &&
                         orbTarget.IsValidTarget())
                {
                    myTarget = orbTarget;
                }
                else
                {
                    myTarget = null;
                }

                if (Me.SpellBook.GetSpell(SpellSlot.W).Level > 0)
                {
                    W.Range = Me.HasBuff("RivenFengShuiEngine") ? 330f : 260f;
                }

                if (qStack != 0 && Game.TickCount - lastQTime > 3800)
                {
                    qStack = 0;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error in MyEventManager.ResetToDefalut." + ex);
            }
        }
Esempio n. 11
0
        /// <summary>
        ///     Gets the best valid enemy hero target in the game inside a determined range.
        /// </summary>
        public static AIHeroClient GetBestEnemyHeroTargetInRange(float range)
        {
            /*
             * var selectedTarget = TargetSelector.GetSelectedTarget();
             * if (selectedTarget != null &&
             * selectedTarget.IsValidTarget(range))
             * {
             * return selectedTarget;
             * }*/

            var orbTarget = Orbwalker.GetOrbwalkingTarget() as AIHeroClient;

            if (orbTarget != null &&
                orbTarget.IsValidTarget(range))
            {
                return(orbTarget);
            }

            var tsTarget = TargetSelector.LastTarget;

            if (tsTarget != null &&
                tsTarget.IsValidTarget(range))
            {
                return(tsTarget);
            }

            var lastTarget = ObjectCache.EnemyHeroes.FirstOrDefault(t =>
                                                                    t.IsValidTarget(range) && !t.IsZombie() && !Invulnerable.Check(t));

            if (lastTarget != null)
            {
                return(lastTarget);
            }

            return(null);
        }
Esempio n. 12
0
        private static void OnLocalCastSpell(SpellbookLocalCastSpellEventArgs args)
        {
            var slot = args.Slot;

            if (!Utilities.SpellSlots.Contains(slot) || LocalPlayer.Instance.MaxMP <= 200)
            {
                return;
            }

            // Preserve Spells Logic, works fine.
            var menuValue = General.PreserveSpellsMenu.GetSlotValue(slot);

            if (menuValue > 0)
            {
                switch (Orbwalker.Mode)
                {
                case OrbwalkingMode.Combo:
                case OrbwalkingMode.Harass:
                    var target = Orbwalker.GetOrbwalkingTarget() as AIHeroClient;
                    if (target != null &&
                        target.GetRealHealth(DamageType.Physical) <=
                        LocalPlayer.Instance.GetAutoAttackDamage(target) * menuValue)
                    {
                        args.Execute = false;
                        Logging.Log(
                            $"Preserve Spells Logic: Denied {args.Slot} usage because {target.CharName} is killable within {menuValue} autos.");
                    }

                    break;
                }
            }
            // end of preserve spells logic

            // Start of Preserve Mana Logic

            // Dictionary to fill with data.
            var data = Utility.Utilities.PreserveManaData;

            // If menuoption is disabled, just return, and if the spell was before being preserved, remove it from the list.
            var menuOptionEnabled = General.PreserveManaMenu.IsSlotEnabled(slot);

            if (!menuOptionEnabled && data.ContainsKey(slot))
            {
                data.Remove(slot);
                Logging.Log($"Preserve Mana List: Removed {slot} (Disabled).");
                return;
            }

            // gets manacost from manacostarray.
            var manaCost = slot.GetManaCost();

            if (manaCost == 0)
            {
                return;
            }

            // if the spell is already registered inside the preservedataarray..
            if (data.ContainsKey(slot))
            {
                var registeredManaCost = data.FirstOrDefault(d => d.Key == slot).Value;
                if (registeredManaCost != manaCost)
                {
                    // ..and the registered mana cost is different from its actual cost, it means the spell updated its manacost by leveling up, thus we will remove it and readd it, updated.
                    data.Remove(slot);
                    Logging.Log($"Preserve Mana List: Updated {slot}'s Manacost (Old: {registeredManaCost}), (New: {manaCost}).");
                    data.Add(slot, manaCost);
                }
            }
            // else if the spell is enabled but not registered..
            else if (menuOptionEnabled && !data.ContainsKey(slot))
            {
                // .. add it to the preservedataarray.
                data.Add(slot, manaCost);
                Logging.Log($"Preserve Mana List: Added {slot}, Cost: {manaCost}.");
            }

            var sum = data.Where(s => General.PreserveManaMenu.IsSlotEnabled(s.Key)).Sum(s => s.Value);

            if (sum <= 0 ||
                data.Keys.Contains(slot) ||
                LocalPlayer.Instance.MP - manaCost >= sum)
            {
                return;
            }

            args.Execute = false;
            Logging.Log(
                $"Preserve Mana Logic: Denied {slot} usage because mana would drop lower than the total mana to preserve ({LocalPlayer.Instance.MP} - {manaCost} < {sum}).");
        }
Esempio n. 13
0
        /*
         * private static void OnPostAttack(OnPostAttackEventArgs args)
         * {
         *      if (!LocalPlayer.Instance.IsMelee || args.Target.IsStructure())
         *      {
         *              return;
         *      }
         *
         *      // Hydra casting
         *      if (BaseMenu.Root["hydra"] != null)
         *      {
         *              var slot = LocalPlayer.Instance.InventorySlots.FirstOrDefault(i => Enumerations.Hydras.Contains((ItemID)i.ItemID));
         *              if (slot != null)
         *              {
         *                      CastHydra(slot);
         *              }
         *      }
         * }
         */

        /*
         * private static void CastHydra(InventorySlot slot)
         * {
         *      var hydraMenu = BaseMenu.Root["general"]["hydra"];
         *      var hydra = LocalPlayer.Instance.GetItem((ItemID)slot.ItemID);
         *      if (hydra != null)
         *      {
         *              switch (Orbwalker.Mode)
         *              {
         *                      case OrbwalkingMode.Combo when !hydraMenu["combo"].Enabled:
         *                              return;
         *                      case OrbwalkingMode.Harass when !hydraMenu["mixed"].Enabled:
         *                              return;
         *                      case OrbwalkingMode.LaneClear when !hydraMenu["laneclear"].Enabled:
         *                              return;
         *                      case OrbwalkingMode.LastHit when !hydraMenu["lasthit"].Enabled:
         *                              return;
         *                      case OrbwalkingMode.None when !hydraMenu["manual"].Enabled:
         *                              return;
         *              }
         *
         *              var hydraSpellSlot = hydra.Slot;
         *              if (hydraSpellSlot != SpellSlot.Unknown &&
         *                  LocalPlayer.Instance.Spellbook.GetSpellState(hydraSpellSlot).HasFlag(SpellState.Ready))
         *              {
         *                      Spellbook.CastSpell(hydraSpellSlot);
         *              }
         *      }
         * }
         */

        private static void OnLocalCastSpell(SpellbookLocalCastSpellEventArgs args)
        {
            var slot = args.Slot;

            if (Enumerations.SpellSlots.Contains(slot))
            {
                var championSpellManaCosts = Utilities.ManaCostArray.FirstOrDefault(v => v.Key == LocalPlayer.Instance.CharName).Value;
                if (championSpellManaCosts != null)
                {
                    var spellbook = LocalPlayer.Instance.Spellbook;
                    var data      = Utilities.PreserveManaData;

                    var spell            = spellbook.GetSpell(slot);
                    var preserveManaMenu = BaseMenu.Root["general"]["preservemana"];
                    var menuOption       = preserveManaMenu[slot.ToString().ToLower()];
                    if (menuOption != null &&
                        menuOption.Enabled)
                    {
                        var registeredSpellData = data.FirstOrDefault(d => d.Key == slot).Value;
                        var actualSpellData     = championSpellManaCosts[slot][spell.Level - 1];

                        if (data.ContainsKey(slot) &&
                            registeredSpellData != actualSpellData)
                        {
                            data.Remove(slot);
                            Logging.Log($"Preserve Mana List: Removed {slot} (Updated ManaCost).");
                        }

                        if (spell.Level > 0 &&
                            !data.ContainsKey(slot))
                        {
                            data.Add(slot, actualSpellData);
                            Logging.Log($"Preserve Mana List: Added {slot}, Cost: {actualSpellData}.");
                        }
                    }
                    else
                    {
                        if (data.ContainsKey(slot))
                        {
                            data.Remove(slot);
                            Logging.Log($"Preserve Mana List: Removed {slot} (Disabled).");
                        }
                    }

                    var sum = data
                              .Where(s => preserveManaMenu[s.Key.ToString().ToLower()].Enabled)
                              .Sum(s => s.Value);
                    if (sum <= 0)
                    {
                        return;
                    }

                    var spellCost = championSpellManaCosts[slot][LocalPlayer.Instance.Spellbook.GetSpell(slot).Level - 1];
                    if (!data.Keys.Contains(slot) &&
                        LocalPlayer.Instance.MP - spellCost < sum)
                    {
                        args.Execute = false;
                    }
                }

                switch (Orbwalker.Mode)
                {
                case OrbwalkingMode.Combo:
                case OrbwalkingMode.Harass:
                    var target = Orbwalker.GetOrbwalkingTarget() as AIHeroClient;
                    if (target != null &&
                        target.GetRealHealth(DamageType.Physical) <=
                        LocalPlayer.Instance.GetAutoAttackDamage(target) * BaseMenu.Root["general"]["preservespells"][args.Slot.ToString().ToLower()].Value)
                    {
                        args.Execute = false;
                    }
                    break;
                }
            }
        }
Esempio n. 14
0
        /// <summary>
        ///     Fired when the game is updated.
        /// </summary>
        public void LaneClear(EntropyEventArgs args)
        {
            var minions = Extensions.GetEnemyLaneMinionsTargets();

            /// <summary>
            ///     The Q Laneclear Logic.
            /// </summary>
            if (SpellClass.Q.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.Q.Slot, MenuClass.Spells["q"]["laneclear"]) &&
                MenuClass.Spells["q"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                var qMinions = Extensions.GetEnemyLaneMinionsTargetsInRange(SpellClass.Q.Range);
                //var farmLocation = SpellClass.Q.GetLinearFarmLocation(minions, MenuClass.Spells["q"]["customization"]["laneclear"].As<MenuSlider>().Value);
                switch (UtilityClass.Player.Spellbook.GetSpell(SpellSlot.Q).ToggleState)
                {
                case 1:
                    /*
                     * if (farmLocation != null)
                     * {
                     *  SpellClass.Q.Cast(farmLocation);
                     * }
                     */
                    break;

                case 2:
                    if (FlashFrost != null &&
                        MenuClass.Spells["q"]["customization"]["laneclear"].As <MenuSlider>().Value <=
                        qMinions.Count(t => t.IsValidTarget(SpellClass.Q.Width, false, true, FlashFrost.Position)))
                    {
                        SpellClass.Q.Cast();
                    }
                    break;
                }
            }

            /// <summary>
            ///     The E Laneclear Logic.
            /// </summary>
            if (SpellClass.E.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.E.Slot, MenuClass.Spells["e"]["laneclear"]) &&
                MenuClass.Spells["e"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                var target = Orbwalker.GetOrbwalkingTarget() as AIMinionClient;
                if (target != null &&
                    minions.Contains(target) &&
                    UtilityClass.Player.GetSpellDamage(target, SpellSlot.E, DamageStage.Empowered) >= target.HP)
                {
                    SpellClass.E.CastOnUnit(target);
                }
            }

            /// <summary>
            ///     The R Laneclear Logic.
            /// </summary>
            if (SpellClass.R.Ready &&
                UtilityClass.Player.MPPercent()
                > ManaManager.GetNeededMana(SpellClass.R.Slot, MenuClass.Spells["r"]["laneclear"]) &&
                MenuClass.Spells["r"]["laneclear"].As <MenuSliderBool>().Enabled)
            {
                var rMinions = Extensions.GetEnemyLaneMinionsTargetsInRange(SpellClass.R.Range);
                //var farmLocation = SpellClass.R.GetCircularFarmLocation(minions, MenuClass.Spells["r"]["customization"]["laneclear"].As<MenuSlider>().Value);
                switch (UtilityClass.Player.Spellbook.GetSpell(SpellSlot.Q).ToggleState)
                {
                case 1:
                    /*
                     * if (farmLocation != null)
                     * {
                     *  SpellClass.R.Cast(farmLocation);
                     * }
                     */
                    break;

                case 2:
                    if (UtilityClass.Player.InFountain())
                    {
                        return;
                    }

                    if (GlacialStorm != null &&
                        MenuClass.Spells["r"]["customization"]["laneclear"].As <MenuSlider>().Value >
                        rMinions.Count(t => t.IsValidTarget(SpellClass.R.Width, false, true, GlacialStorm.Position)))
                    {
                        SpellClass.R.Cast();
                    }
                    break;
                }
            }
        }
Esempio n. 15
0
        private static void Combo()
        {
            if (ComboOption.UseQ && Q.Ready && Orbwalker.GetOrbwalkingTarget() != null)
            {
                var target = Orbwalker.GetOrbwalkingTarget() as Obj_AI_Hero;

                if (target != null && !target.IsDead && target.IsValidAutoRange())
                {
                    if (Me.HasBuff("asheqcastready"))
                    {
                        Q.Cast();
                    }
                }
            }

            if (ComboOption.UseR && R.Ready)
            {
                foreach (var target in GameObjects.EnemyHeroes.Where(x => x.IsValidTarget(1200)))
                {
                    if (ComboOption.GetBool("ComboRTeam").Enabled)
                    {
                        if (target.IsValidTarget(600) && Me.CountEnemyHeroesInRange(600) >= 3 &&
                            target.CountAllyHeroesInRange(200) <= 2)
                        {
                            var rPred = R.GetPrediction(target);

                            if (rPred.HitChance >= HitChance.High)
                            {
                                R.Cast(rPred.CastPosition);
                            }
                        }
                    }

                    if (ComboOption.GetBool("ComboRSolo").Enabled)
                    {
                        if (Me.CountEnemyHeroesInRange(800) == 1 &&
                            !target.IsValidAutoRange() &&
                            target.DistanceToPlayer() <= 700 &&
                            target.Health > Me.GetAutoAttackDamage(target) &&
                            target.Health < Me.GetSpellDamage(target, SpellSlot.R) + Me.GetAutoAttackDamage(target) * 3 &&
                            !target.HasBuffOfType(BuffType.SpellShield))
                        {
                            var rPred = R.GetPrediction(target);

                            if (rPred.HitChance >= HitChance.High)
                            {
                                R.Cast(rPred.CastPosition);
                            }
                        }

                        if (target.DistanceToPlayer() <= 1000 &&
                            (!target.CanMoveMent() || target.HasBuffOfType(BuffType.Stun) ||
                             R.GetPrediction(target).HitChance == HitChance.Immobile))
                        {
                            var rPred = R.GetPrediction(target);

                            if (rPred.HitChance >= HitChance.High)
                            {
                                R.Cast(rPred.CastPosition);
                            }
                        }
                    }
                }
            }

            if (ComboOption.UseW && W.Ready && !Me.HasBuff("AsheQAttack"))
            {
                if (ComboOption.GetBool("ComboSaveMana").Enabled&&
                    Me.Mana > (R.Ready ? R.GetBasicSpell().Cost : 0) + W.GetBasicSpell().Cost + Q.GetBasicSpell().Cost ||
                    !ComboOption.GetBool("ComboSaveMana").Enabled)
                {
                    var target = MyTargetSelector.GetTarget(W.Range);

                    if (target.IsValidTarget(W.Range))
                    {
                        var wPred = W.GetPrediction(target);

                        if (wPred.HitChance >= HitChance.High)
                        {
                            W.Cast(wPred.CastPosition);
                        }
                    }
                }
            }

            if (ComboOption.UseE && E.Ready)
            {
                var target = MyTargetSelector.GetTarget(1000);

                if (target != null)
                {
                    var ePred = E.GetPrediction(target);

                    if (ePred.UnitPosition.IsGrass() || target.ServerPosition.IsGrass())
                    {
                        E.Cast(ePred.UnitPosition);
                    }
                }
            }
        }
Esempio n. 16
0
        /// <summary>
        ///     Fired on spell cast.
        /// </summary>
        /// <param name="args">The <see cref="SpellbookLocalCastSpellEventArgs" /> instance containing the event data.</param>
        public static void OnLocalCastSpell(SpellbookLocalCastSpellEventArgs args)
        {
            var slot = args.Slot;

            if (UtilityClass.SpellSlots.Contains(slot))
            {
                /// <summary>
                ///     The 'Preserve Mana' Logic.
                /// </summary>
                var championSpellManaCosts = UtilityClass.ManaCostArray
                                             .FirstOrDefault(v => v.Key == UtilityClass.Player.CharName).Value;
                if (championSpellManaCosts != null)
                {
                    var spellbook = UtilityClass.Player.Spellbook;
                    var data      = UtilityClass.PreserveManaData;

                    var spell      = spellbook.GetSpell(slot);
                    var menuOption = MenuClass.PreserveMana[slot.ToString().ToLower()];
                    if (menuOption != null && menuOption.Enabled)
                    {
                        var registeredSpellData = data.FirstOrDefault(d => d.Key == slot).Value;
                        var actualSpellData     = championSpellManaCosts[slot][spell.Level - 1];

                        if (data.ContainsKey(slot) &&
                            registeredSpellData != actualSpellData)
                        {
                            data.Remove(slot);
                            Logging.Log($"Preserve Mana List: Removed {slot} (Updated ManaCost).");
                        }

                        if (!data.ContainsKey(slot) && spell.Level > 0)
                        {
                            data.Add(slot, actualSpellData);
                            Logging.Log($"Preserve Mana List: Added {slot}, Cost: {actualSpellData}.");
                        }
                    }
                    else
                    {
                        if (data.ContainsKey(slot))
                        {
                            data.Remove(slot);
                            Logging.Log($"Preserve Mana List: Removed {slot} (Disabled).");
                        }
                    }

                    var sum = data
                              .Where(s => MenuClass.PreserveMana[s.Key.ToString().ToLower()].Enabled)
                              .Sum(s => s.Value);
                    if (sum <= 0)
                    {
                        return;
                    }

                    var spellCost =
                        championSpellManaCosts[slot][UtilityClass.Player.Spellbook.GetSpell(slot).Level - 1];
                    var mana = UtilityClass.Player.MP;
                    if (!data.Keys.Contains(slot) && mana - spellCost < sum)
                    {
                        args.Execute = false;
                    }
                }

                /// <summary>
                ///     The 'Preserve Spells' Logic.
                /// </summary>
                switch (Orbwalker.Mode)
                {
                case OrbwalkingMode.Combo:
                case OrbwalkingMode.Harass:
                    var target = Orbwalker.GetOrbwalkingTarget() as AIHeroClient;
                    if (target != null)
                    {
                        if (target.GetRealHealth(DamageType.Physical) <=
                            UtilityClass.Player.GetAutoAttackDamage(target) *
                            MenuClass.PreserveSpells[args.Slot.ToString().ToLower()].Value)
                        {
                            args.Execute = false;
                        }
                    }

                    break;
                }
            }
        }
Esempio n. 17
0
        /// <summary>
        ///     Fired when the game is updated.
        /// </summary>
        public void Automatic(EntropyEventArgs args)
        {
            SpellClass.Q2.Range = SpellClass.Q.Range + 50f + 25f * SpellClass.Q.Level;

            if (UtilityClass.Player.IsRecalling())
            {
                return;
            }

            Logging.Log($"Q Range: {SpellClass.Q.Range}, Distance: {Orbwalker.GetOrbwalkingTarget()?.DistanceToPlayer()}");

            /// <summary>
            ///     The Force Pow Pow Logic.
            /// </summary>
            if (SpellClass.Q.Ready &&
                IsUsingFishBones() &&
                Orbwalker.Mode == OrbwalkingMode.None &&
                MenuClass.Miscellaneous["forcepowpow"].As <MenuBool>().Enabled)
            {
                SpellClass.Q.Cast();
            }

            /// <summary>
            ///     The Automatic E Logic.
            /// </summary>
            if (SpellClass.E.Ready &&
                MenuClass.Spells["e"]["logical"].As <MenuBool>().Enabled)
            {
                foreach (var target in GameObjects.EnemyHeroes.Where(t =>
                                                                     t.IsImmobile(SpellClass.E.Delay) &&
                                                                     t.DistanceToPlayer() <= SpellClass.E.Range))
                {
                    SpellClass.E.Cast(target.Position);
                }
            }

            /// <summary>
            ///     The Automatic E on Teleport Logic.
            /// </summary>
            if (SpellClass.E.Ready &&
                MenuClass.Spells["e"]["teleport"].As <MenuBool>().Enabled)
            {
                foreach (var minion in ObjectManager.Get <AIMinionClient>().Where(m =>
                                                                                  m.IsEnemy() &&
                                                                                  m.DistanceToPlayer() <= SpellClass.E.Range &&
                                                                                  m.GetActiveBuffs().Any(b => b.Name.Equals("teleport_target"))))
                {
                    SpellClass.E.Cast(minion.Position);
                }
            }

            /// <summary>
            ///     The Semi-Automatic R Management.
            /// </summary>
            if (SpellClass.R.Ready &&
                MenuClass.Spells["r"]["bool"].As <MenuBool>().Enabled&&
                MenuClass.Spells["r"]["key"].As <MenuKeyBind>().Enabled)
            {
                var bestTarget = GameObjects.EnemyHeroes
                                 .Where(t =>
                                        !Invulnerable.Check(t) &&
                                        t.IsValidTarget(SpellClass.R.Range) &&
                                        MenuClass.Spells["r"]["whitelist"][t.CharName.ToLower()].As <MenuBool>().Enabled)
                                 .MinBy(o => o.GetRealHealth());
                if (bestTarget != null)
                {
                    SpellClass.R.Cast(bestTarget);
                }
            }
        }