Ejemplo n.º 1
0
        public static void AddAllNukes(Ability[] spells, Item[] myItems1)
        {
            NukesToggler = new Dictionary <string, bool>();
            foreach (var spell in
                     from spell in spells
                     let data = AbilityDatabase.Find(spell.Name)
                                where data != null && data.IsNuke
                                select spell)
            {
                AddNuke(spell);
                RangeDrawing.AddRange(spell);
            }

            foreach (var spell in
                     from spell in myItems1
                     let data = AbilityDatabase.Find(spell.Name)
                                where data != null && (data.IsNuke || spell.StoredName() == "item_urn_of_shadows")
                                select spell)
            {
                AddNuke(spell);
                RangeDrawing.AddRange(spell);
            }

            if (NukesTogglerCreated)
            {
                MainMenu.Menu.AddItem(new MenuItem("nukesToggler", "Nukes:").SetValue(new AbilityToggler(NukesToggler)));
            }
        }
Ejemplo n.º 2
0
        public static void AddAllHeals(Ability[] spells, Item[] myItems1)
        {
            HealsToggler = new Dictionary <string, bool>();
            foreach (var spell in
                     from spell in spells
                     let data = AbilityDatabase.Find(spell.Name)
                                where data != null && data.IsHeal
                                select spell)
            {
                AddHeal(spell);
                RangeDrawing.AddRange(spell);
            }

            foreach (var spell in
                     from spell in myItems1
                     let data = AbilityDatabase.Find(spell.Name)
                                where data != null && data.IsHeal
                                select spell)
            {
                if (MyAbilities.DefensiveAbilities.ContainsKey(spell.Name + "heal"))
                {
                    continue;
                }

                AddHeal(spell);
                RangeDrawing.AddRange(spell);
            }

            if (HealsTogglerCreated)
            {
                MainMenu.Menu.AddItem(new MenuItem("healsToggler", "Heals:").SetValue(new AbilityToggler(HealsToggler)));
            }
        }
Ejemplo n.º 3
0
        public static Menu Create(string name, Ability ability)
        {
            var menu = new Menu(name, name, textureName: name);

            if (name == "rubick_spell_steal")
            {
                return(menu);
            }

            menu.AddItem(Togglers.OnSight(name));
            var data         = AbilityDatabase.Find(name);
            var defaultValue = ability.AbilityType != AbilityType.Ultimate;

            if (data != null)
            {
                if (data.TrueSight)
                {
                    menu.AddItem(Togglers.OnInvisible(name, defaultValue));
                }

                if (data.IsPurge)
                {
                    menu.AddItem(Togglers.OnPurgable(name, defaultValue));
                }

                if (data.WeakensEnemy)
                {
                    menu.AddItem(Togglers.OnAttack(name, defaultValue));
                }
            }

            menu.AddItem(Sliders.MinManaCheck(name));
            menu.AddItem(Sliders.MinManaCheck(name, true));
            return(menu);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Returns projectile speed of the ability
        /// </summary>
        /// <param name="ability"></param>
        /// <returns></returns>
        public static float GetProjectileSpeed(this Ability ability)
        {
            float speed;

            if (!SpeedDictionary.TryGetValue(ability.Name + " " + ability.Level, out speed))
            {
                AbilityInfo data;
                if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
                {
                    data = AbilityDatabase.Find(ability.Name);
                    AbilityDamage.DataDictionary.Add(ability, data);
                }
                if (data == null)
                {
                    speed = float.MaxValue;
                    SpeedDictionary.Add(ability.Name + " " + ability.Level, speed);
                    return(speed);
                }
                if (data.Speed != null)
                {
                    speed = ability.GetAbilityData(data.Speed);
                    SpeedDictionary.Add(ability.Name + " " + ability.Level, speed);
                }
            }
            return(speed);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Checks all aspects and returns full delay before target gets hit by given ability
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static double GetHitDelay(this Ability ability, Unit target)
        {
            AbilityInfo data;

            if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
            {
                data = AbilityDatabase.Find(ability.Name);
                AbilityDamage.DataDictionary.Add(ability, data);
            }
            var owner = ability.Owner as Unit;
            var delay = ability.GetCastDelay(owner as Hero, target, true);

            if (data != null)
            {
                delay += data.AdditionalDelay;
            }
            var speed  = ability.GetProjectileSpeed();
            var radius = ability.GetRadius();

            if (!ability.AbilityBehavior.HasFlag(AbilityBehavior.NoTarget) && speed < 6000 && speed > 0)
            {
                var xyz = ability.GetPrediction(target);
                delay += (Math.Max((owner.Distance2D(xyz) - radius / 2), 100) / speed);
            }
            return(delay);
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     Checks all aspects and returns full delay before target gets hit by given ability
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="target"></param>
        /// <param name="abilityName"></param>
        /// <returns></returns>
        public static double GetHitDelay(this Ability ability, Unit target, string abilityName = null)
        {
            var         name = abilityName ?? ability.Name;
            AbilityInfo data;

            if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
            {
                data = AbilityDatabase.Find(name);
                AbilityDamage.DataDictionary.Add(ability, data);
            }
            var owner = ability.Owner as Unit;
            var delay = ability.GetCastDelay(owner as Hero, target, true, abilityName: name);

            if (data != null)
            {
                delay += data.AdditionalDelay;
            }
            var speed  = ability.GetProjectileSpeed(name);
            var radius = ability.GetRadius(name);

            if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name) && speed < 6000 && speed > 0)
            {
                var xyz = ability.GetPrediction(target, abilityName: name);
                delay += (Math.Max((owner.Distance2D(xyz) - radius / 2), 100) / speed);
            }
            if (name == "tinker_heat_seeking_missile")
            {
                var xyz = ability.GetPrediction(target, abilityName: name);
                delay += (Math.Max((owner.Distance2D(xyz)), 100) / speed);
            }
            return(delay);
        }
Ejemplo n.º 7
0
        public static void AddAllShields(Ability[] spells, Item[] myItems1)
        {
            ShieldsToggler = new Dictionary <string, bool>();
            foreach (var spell in
                     from spell in spells
                     let data = AbilityDatabase.Find(spell.Name)
                                where data != null && data.IsShield
                                select spell)
            {
                AddShield(spell);
                RangeDrawing.AddRange(spell);
            }

            foreach (var spell in
                     from spell in myItems1
                     let data = AbilityDatabase.Find(spell.Name)
                                where data != null && data.IsShield
                                select spell)
            {
                AddShield(spell);
                RangeDrawing.AddRange(spell);
            }

            if (ShieldsTogglerCreated)
            {
                MainMenu.Menu.AddItem(
                    new MenuItem("shieldsToggler", "Shields:").SetValue(new AbilityToggler(ShieldsToggler)));
            }
        }
Ejemplo n.º 8
0
 public Torrent(Ability ability)
 {
     Ability         = ability;
     CastPoint       = (float)ability.FindCastPoint();
     AdditionalDelay = AbilityDatabase.Find(ability.Name).AdditionalDelay;
     Radius          = ability.GetRadius() + 25;
 }
Ejemplo n.º 9
0
        /// <summary>
        ///     Returns cast range of ability, if ability is NonTargeted it will return its radius!
        /// </summary>
        /// <param name="ability"></param>
        /// <returns></returns>
        public static float GetCastRange(this Ability ability)
        {
            if (ability.Name == "templar_assassin_meld")
            {
                return((ability.Owner as Hero).GetAttackRange() + 50);
            }
            if (!ability.AbilityBehavior.HasFlag(AbilityBehavior.NoTarget))
            {
                var castRange  = ability.CastRange;
                var bonusRange = 0;
                if (castRange <= 0)
                {
                    castRange = 999999;
                }
                if (ability.Name == "dragon_knight_dragon_tail" &&
                    (ability.Owner as Hero).Modifiers.Any(x => x.Name == "modifier_dragon_knight_dragon_form"))
                {
                    bonusRange = 250;
                }
                else if (ability.Name == "beastmaster_primal_roar" && (ability.Owner as Hero).AghanimState())
                {
                    bonusRange = 350;
                }
                return(castRange + bonusRange + 100);
            }
            var         radius = 0f;
            AbilityInfo data;

            if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
            {
                data = AbilityDatabase.Find(ability.Name);
                AbilityDamage.DataDictionary.Add(ability, data);
            }
            if (data == null)
            {
                return(ability.CastRange);
            }
            if (!data.FakeCastRange)
            {
                if (data.Width != null)
                {
                    radius = ability.GetAbilityData(data.Width);
                }
                if (data.StringRadius != null)
                {
                    radius = ability.GetAbilityData(data.StringRadius);
                }
                if (data.Radius > 0)
                {
                    radius = data.Radius;
                }
            }
            else
            {
                radius = ability.GetAbilityData(data.RealCastRange);
            }
            return(radius + 50);
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     Returns cast range of ability, if ability is NonTargeted it will return its radius!
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="abilityName"></param>
        /// <returns></returns>
        public static float GetCastRange(this Ability ability, string abilityName = null)
        {
            var name = abilityName ?? ability.Name;

            if (name == "templar_assassin_meld")
            {
                return((ability.Owner as Hero).GetAttackRange() + 50);
            }
            if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
            {
                var castRange  = ability.CastRange;
                var bonusRange = 0f;
                if (castRange <= 0)
                {
                    castRange = 999999;
                }
                var owner = ability.Owner as Hero;
                if (name == "dragon_knight_dragon_tail" &&
                    owner.Modifiers.Any(x => x.Name == "modifier_dragon_knight_dragon_form"))
                {
                    bonusRange = 250;
                }
                else if (name == "beastmaster_primal_roar" && owner.AghanimState())
                {
                    bonusRange = 350;
                }
                var aetherLens = owner.FindItem("item_aether_lens");
                if (aetherLens != null)
                {
                    bonusRange += aetherLens.GetAbilityData("cast_range_bonus");
                }
                return(castRange + bonusRange);
            }

            var         radius = 0f;
            AbilityInfo data;

            if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
            {
                data = AbilityDatabase.Find(name);
                AbilityDamage.DataDictionary.Add(ability, data);
            }
            if (data == null)
            {
                return(ability.CastRange);
            }
            if (!data.FakeCastRange)
            {
                radius = ability.GetRadius(name);
            }
            else
            {
                radius = ability.GetAbilityData(data.RealCastRange, abilityName: name);
            }
            return(radius);
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     Returns prediction for given target after given ability hit delay
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="target"></param>
        /// <param name="customDelay">enter your custom delay</param>
        /// <param name="abilityName"></param>
        /// <returns></returns>
        public static Vector3 GetPrediction(
            this Ability ability,
            Unit target,
            double customDelay = 0,
            string abilityName = null)
        {
            var         name = abilityName ?? ability.Name;
            AbilityInfo data;

            if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
            {
                data = AbilityDatabase.Find(name);
                AbilityDamage.DataDictionary.Add(ability, data);
            }
            var owner = ability.Owner as Unit;
            var delay = ability.GetCastDelay(owner as Hero, target, true, abilityName: name, useChannel: true);

            if (data != null)
            {
                delay += data.AdditionalDelay;
            }
            var     speed  = ability.GetProjectileSpeed(name);
            var     radius = ability.GetRadius(name);
            Vector3 xyz;

            if (speed > 0 && speed < 6000)
            {
                xyz = Prediction.SkillShotXYZ(
                    owner,
                    target,
                    (float)((delay + owner.GetTurnTime(target.Position)) * 1000),
                    speed,
                    radius);
                if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
                {
                    xyz = Prediction.SkillShotXYZ(
                        owner,
                        target,
                        (float)((delay + (float)owner.GetTurnTime(xyz)) * 1000),
                        speed,
                        radius);
                }
            }
            else
            {
                xyz = Prediction.PredictedXYZ(target, (float)(delay * 1000));
            }
            return(xyz);
        }
Ejemplo n.º 12
0
        /// <summary>
        ///     Uses prediction to cast given skillshot ability
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="target"></param>
        /// <param name="sourcePosition"></param>
        /// <returns>returns true in case of successfull cast</returns>
        public static bool CastSkillShot(this Ability ability, Unit target, Vector3 sourcePosition)
        {
            var owner    = ability.Owner as Unit;
            var position = sourcePosition;
            var xyz      = ability.GetPrediction(target);
            var radius   = ability.GetRadius();
            var speed    = ability.GetProjectileSpeed();

            if (!(position.Distance2D(xyz) <= (ability.GetCastRange() + radius)))
            {
                return(false);
            }
            if (position.Distance2D(xyz) > ability.GetCastRange())
            {
                xyz = (position - xyz) * ability.GetCastRange() / position.Distance2D(xyz) + xyz;
            }
            // Console.WriteLine(ability.GetCastRange() + " " + radius);
            if (ability.Name.Substring(0, Math.Min("nevermore_shadowraze".Length, ability.Name.Length))
                == "nevermore_shadowraze")
            {
                var         delay = ability.GetCastDelay(owner as Hero, target, true);
                AbilityInfo data;
                if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
                {
                    data = AbilityDatabase.Find(ability.Name);
                    AbilityDamage.DataDictionary.Add(ability, data);
                }
                delay += data.AdditionalDelay;
                xyz    = Prediction.SkillShotXYZ(
                    owner,
                    target,
                    (float)((delay + (float)owner.GetTurnTime(xyz)) * 1000),
                    speed,
                    radius);
                if (position.Distance2D(xyz) < (ability.GetCastRange() + radius / 2) &&
                    position.Distance2D(xyz) > (ability.GetCastRange() - radius / 2))
                {
                    owner.Move((position - xyz) * 10 / position.Distance2D(xyz) + xyz);
                    owner.Stop();
                    ability.UseAbility();
                    return(true);
                }
                return(false);
            }
            ability.UseAbility(xyz);
            return(true);
        }
Ejemplo n.º 13
0
        /// <summary>
        ///     Returns impact radius of given ability
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="abilityName"></param>
        /// <returns></returns>
        public static float GetRadius(this Ability ability, string abilityName = null)
        {
            var   name = abilityName ?? ability.Name;
            float radius;

            if (!RadiusDictionary.TryGetValue(name + " " + ability.Level, out radius))
            {
                AbilityInfo data;
                if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
                {
                    data = AbilityDatabase.Find(name);
                    AbilityDamage.DataDictionary.Add(ability, data);
                }
                if (data == null)
                {
                    radius = 0;
                    RadiusDictionary.Add(name + " " + ability.Level, radius);
                    return(radius);
                }
                if (data.Width != null)
                {
                    radius = ability.GetAbilityData(data.Width, abilityName: name);
                    RadiusDictionary.Add(name + " " + ability.Level, radius);
                    return(radius);
                }
                if (data.StringRadius != null)
                {
                    radius = ability.GetAbilityData(data.StringRadius, abilityName: name);
                    RadiusDictionary.Add(name + " " + ability.Level, radius);
                    return(radius);
                }
                if (data.Radius > 0)
                {
                    radius = data.Radius;
                    RadiusDictionary.Add(name + " " + ability.Level, radius);
                    return(radius);
                }
                if (data.IsBuff)
                {
                    radius = (ability.Owner as Hero).GetAttackRange();
                    RadiusDictionary.Add(name + " " + ability.Level, radius);
                    return(radius);
                }
            }
            return(radius);
        }
Ejemplo n.º 14
0
 public static void Update(EventArgs args)
 {
     if (!OnUpdateChecks.CanUpdate())
     {
         return;
     }
     if (Utils.SleepCheck("getheroes") && Heroes.Count < 5)
     {
         UpdateHeroes();
         Utils.Sleep(1000, "getheroes");
     }
     Heroes       = Heroes.Where(x => x.IsValid).ToList();
     UsableHeroes = Heroes.Where(x => x.Health > 0 && x.IsAlive && x.IsVisible).ToArray();
     if (Utils.SleepCheck("enemyHeroesCheckValid") ||
         UsableHeroes.Any(x => !ItemDictionary.ContainsKey(NameManager.Name(x))))
     {
         Utils.Sleep(2000, "enemyHeroesCheckValid");
         var itemList = new List <Item>(Items);
         foreach (var hero in UsableHeroes)
         {
             var name  = NameManager.Name(hero);
             var items = hero.Inventory.Items.ToList();
             foreach (var ability in
                      items.Where(x => !itemList.Contains(x) && AbilityDatabase.Find(NameManager.Name(x)) != null)
                      .OrderBy(ComboOrder.GetAbilityOrder))
             {
                 Items.Add(ability);
             }
             if (ItemDictionary.ContainsKey(name))
             {
                 ItemDictionary[name] =
                     items.Where(
                         x => x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden)
                     .ToList();
                 continue;
             }
             var itemlist =
                 items.Where(x => x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden)
                 .ToList();
             ItemDictionary.Add(name, itemlist);
         }
     }
 }
Ejemplo n.º 15
0
        public static void UpdateHeroes()
        {
            var list        = Ensage.Common.Objects.Heroes.GetByTeam(AbilityMain.Me.Team);
            var herolist    = new List <Hero>(Heroes);
            var abilityList = new List <Ability>(Abilities.Where(x => x.IsValid));

            foreach (var hero in list.Where(x => x.IsValid && x.IsVisible))
            {
                var name   = NameManager.Name(hero);
                var spells = hero.Spellbook.Spells.ToList();
                if (!herolist.Contains(hero))
                {
                    if (name == "npc_dota_hero_ogre_magi")
                    {
                        Game.PrintMessage(
                            "[ABILITY#]: SpellOverlay is temporary disabled for OgreMagi due to Ensage.Core issues",
                            MessageType.ChatMessage);
                    }
                    Heroes.Add(hero);
                }
                if (name == "npc_dota_hero_ogre_magi")
                {
                    continue;
                }
                foreach (var ability in
                         spells.Where(x => !abilityList.Contains(x) && AbilityDatabase.Find(NameManager.Name(x)) != null)
                         .OrderBy(ComboOrder.GetAbilityOrder))
                {
                    Abilities.Add(ability);
                }
                var abilitylist =
                    spells.Where(x => x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden)
                    .ToList();
                if (AbilityDictionary.ContainsKey(name))
                {
                    AbilityDictionary[name] = abilitylist;
                    continue;
                }
                AbilityDictionary.Add(name, abilitylist);
            }
        }
Ejemplo n.º 16
0
        public static void AddAllSpecials(Ability[] spells, Item[] myItems1)
        {
            specialsToggler = new Dictionary <string, bool>();
            foreach (var spell in
                     from spell in spells
                     let data = AbilityDatabase.Find(spell.Name)
                                where
                                spell.Name != "zuus_thundergods_wrath" && data != null &&
                                (data.TrueSight || data.WeakensEnemy || data.IsPurge)
                                select spell)
            {
                AddSpecial(spell);
                RangeDrawing.AddRange(spell);
            }

            foreach (var spell in
                     from spell in myItems1
                     let data = AbilityDatabase.Find(spell.Name)
                                where spell.Name != "item_gem" && data != null && (data.TrueSight || data.WeakensEnemy || data.IsPurge)
                                select spell)
            {
                AddSpecial(spell);
                RangeDrawing.AddRange(spell);
            }

            if (AbilityMain.Me.ClassId == ClassId.CDOTA_Unit_Hero_Rubick)
            {
                var spellSteal = AbilityMain.Me.FindSpell("rubick_spell_steal");
                if (spellSteal != null)
                {
                    AddSpecial(spellSteal);
                    RangeDrawing.AddRange(spellSteal);
                }
            }

            if (SpecialsTogglerCreated)
            {
                MainMenu.Menu.AddItem(
                    new MenuItem("specialsToggler", "Specials:").SetValue(new AbilityToggler(specialsToggler)));
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        ///     Checks if given ability can be used
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="target"></param>
        /// <returns>returns true in case ability can be used</returns>
        public static bool CanBeCasted(this Ability ability, Unit target)
        {
            if (!target.IsValidTarget())
            {
                return(false);
            }

            var canBeCasted = ability.CanBeCasted();

            if (!target.IsMagicImmune())
            {
                return(canBeCasted);
            }

            AbilityInfo data;

            if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
            {
                data = AbilityDatabase.Find(ability.Name);
                AbilityDamage.DataDictionary.Add(ability, data);
            }
            return(data == null ? canBeCasted : data.MagicImmunityPierce);
        }
Ejemplo n.º 18
0
        protected LinearProjectile(Ability ability)
            : base(ability)
        {
            speed = ability.GetProjectileSpeed();

            var widthString    = AbilityDatabase.Find(Name).Width;
            var endWidthString = AbilityDatabase.Find(Name).EndWidth;

            if (string.IsNullOrEmpty(widthString))
            {
                var radius = ability.GetRadius();

                if ((int)ability.GetCastRange() != (int)radius)
                {
                    startRadius = endRadius = radius + 60;
                }
                else
                {
                    startRadius = endRadius = 250;
                }
            }
            else
            {
                startRadius = ability.AbilitySpecialData.First(x => x.Name == widthString).Value + 60;
                endRadius   = ability.AbilitySpecialData.FirstOrDefault(x => x.Name == endWidthString)?.Value + 60
                              ?? startRadius;
            }

            if (startRadius > endRadius)
            {
                endRadius = startRadius;
            }

            Debugger.WriteLine("// Speed: " + speed);
            Debugger.WriteLine("// StartRadius: " + startRadius);
            Debugger.WriteLine("// EndRadius: " + endRadius);
        }
Ejemplo n.º 19
0
        /// <summary>
        ///     Returns prediction for given target after given ability hit delay
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="target"></param>
        /// <param name="customDelay">enter your custom delay</param>
        /// <returns></returns>
        public static Vector3 GetPrediction(this Ability ability, Unit target, double customDelay = 0)
        {
            AbilityInfo data;

            if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
            {
                data = AbilityDatabase.Find(ability.Name);
                AbilityDamage.DataDictionary.Add(ability, data);
            }
            var owner = ability.Owner as Unit;
            var delay = ability.GetCastDelay(owner as Hero, target, true);

            if (data != null)
            {
                delay += data.AdditionalDelay;
            }
            var speed  = ability.GetProjectileSpeed();
            var radius = ability.GetRadius();
            var xyz    = Prediction.SkillShotXYZ(
                owner,
                target,
                (float)((delay + owner.GetTurnTime(target.Position)) * 1000),
                speed,
                radius);

            if (!ability.AbilityBehavior.HasFlag(AbilityBehavior.NoTarget))
            {
                xyz = Prediction.SkillShotXYZ(
                    owner,
                    target,
                    (float)((delay + (float)owner.GetTurnTime(xyz)) * 1000),
                    speed,
                    radius);
            }
            return(xyz);
        }
Ejemplo n.º 20
0
        public static void AddAllToMenu()
        {
            var mySpells = AbilityMain.Me.Spellbook.Spells.Where(x => AbilityDatabase.Find(x.Name) != null);
            var myItems  = AbilityMain.Me.Inventory.Items;
            var spells   = mySpells as Ability[] ?? mySpells.ToArray();
            var myItems1 = myItems as Item[] ?? myItems.ToArray();
            var blink    = myItems1.FirstOrDefault(x => x.Name == "item_blink")
                           ?? spells.FirstOrDefault(x => x.Name == "antimage_blink" || x.Name == "queenofpain_blink");

            MyAbilities.SoulRing         = myItems1.FirstOrDefault(x => x.Name == "item_soul_ring");
            MyAbilities.ForceStaff       = myItems1.FirstOrDefault(x => x.Name == "item_force_staff");
            MyAbilities.ChargeOfDarkness = spells.FirstOrDefault(x => x.Name == "spirit_breaker_charge_of_darkness");
            MyAbilities.InvokerInvoke    = AbilityMain.Me.Spellbook.Spells.FirstOrDefault(x => x.Name == "invoker_invoke");
            MyAbilities.InvokerQ         = AbilityMain.Me.Spellbook.Spells.FirstOrDefault(x => x.Name == "invoker_quas");
            MyAbilities.InvokerW         = AbilityMain.Me.Spellbook.Spells.FirstOrDefault(x => x.Name == "invoker_wex");
            MyAbilities.InvokerE         = AbilityMain.Me.Spellbook.Spells.FirstOrDefault(x => x.Name == "invoker_exort");
            MainMenu.Menu.AddItem(new MenuItem("Ability#.EnableAutoKillSteal", "Enable AutoKillSteal:"))
            .SetValue(true)
            .SetFontColor(fontColor: Color.DarkOrange);
            MainMenu.Menu.AddItem(new MenuItem("Ability#.EnableAutoUsage", "Enable AutoUsage:"))
            .SetValue(true)
            .SetFontColor(fontColor: Color.DarkOrange);
            Nukes.AddAllNukes(spells, myItems1);
            Disables.AddAllDisables(spells, myItems1);
            Slows.AddAllSlows(spells, myItems1);
            Buffs.AddAllBuffs(spells, myItems1);
            Harrases.AddAllHarrases(spells, myItems1);
            Silences.AddAllSilences(spells, myItems1);
            Specials.AddAllSpecials(spells, myItems1);
            Heals.AddAllHeals(spells, myItems1);
            Shields.AddAllShields(spells, myItems1);
            MainMenu.Menu.AddSubMenu(MainMenu.AbilitiesMenu);
            MainMenu.DrawingsMenu.AddSubMenu(MainMenu.DamageIndicatorMenu);
            MainMenu.DrawingsMenu.AddSubMenu(MainMenu.GankDamageMenu);
            MainMenu.GankDamageMenu.AddItem(new MenuItem("enableGankDamage", "Enable: ").SetValue(true));
            MainMenu.GankDamageMenu.AddItem(
                new MenuItem("enableGankDamageAllies", "Enable for allies: ").SetValue(true));
            MainMenu.GankDamageMenu.AddItem(
                new MenuItem("enableGankDamageEnemies", "Enable for enemies: ").SetValue(true));
            MainMenu.DamageIndicatorMenu.AddItem(
                new MenuItem("abilityDamageIndicatorDrawDamage", "Draw Damage").SetValue(true));
            MainMenu.DamageIndicatorMenu.AddItem(
                new MenuItem("abilityDamageIndicatorDrawHits", "Draw hits").SetValue(true));
            MainMenu.DamageIndicatorMenu.AddItem(
                new MenuItem("abilityDamageIndicatorTextSize", "Increase text size").SetValue(new Slider(0, 0, 5)));

            MainMenu.DrawingsMenu.AddSubMenu(MainMenu.ManaBarMenu);
            MainMenu.ManaBarMenu.AddItem(
                new MenuItem("manaBar", "MANA BAR:").SetFontColor(fontColor: Color.White));
            MainMenu.ManaBarMenu.AddItem(
                new MenuItem("enableManaBar", "Enable Mana Bar: ").SetValue(true));

            MainMenu.DrawingsMenu.AddSubMenu(MainMenu.AbilityOverlayMenu);
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("spellOverlay", "SPELLS OVERLAY:").SetFontColor(fontColor: Color.White));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableSpellOverlayEnemy", "Enable for enemies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableSpellOverlayAlly", "Enable for allies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("sizeSliderSpell", "Increase the size: ").SetValue(new Slider(0, 0, 25)));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("ExtraPosSliderSpellX", "Extra Pos X: ").SetValue(new Slider(0, -400, 400)));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("ExtraPosSliderSpellY", "Extra Pos Y: ").SetValue(new Slider(0, -400, 400)));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("itemOverlay", "ITEMS OVERLAY:").SetFontColor(fontColor: Color.White));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableItemOverlayEnemy", "Enable for enemies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableItemOverlayAlly", "Enable for allies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("sizeSliderItem", "Increase the size: ").SetValue(new Slider(0, 0, 25)));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("ExtraPosSliderItemX", "Extra Pos X: ").SetValue(new Slider(0, -400, 400)));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("ExtraPosSliderItemY", "Extra Pos Y: ").SetValue(new Slider(0, -400, 400)));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("unfinishedFeature", "This feature is currently unfinished!"))
            .SetFontColor(fontColor: Color.OrangeRed)
            .SetTooltip("Contains unfinished stuff, not all combos are tweaked/in right order.");
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("abilityKey1", "Combo Key"))
            .SetValue(new KeyBind('G', KeyBindType.Press));
            var priorityChanger =
                new MenuItem("Ability#.ComboOrder", "Custom Order: ").SetValue(
                    new PriorityChanger(new List <string>(), "Ability#.ComboOrder")).SetFontColor(fontColor: Color.Gray);

            MainMenu.ComboKeysMenu.AddItem(new MenuItem("abilityComboType", "Combo Order"))
            .SetValue(new StringList(new[] { "Normal", "Maximum Disable", "Maximum Damage", "Custom" }))
            .ValueChanged +=
                (sender, args) =>
            {
                priorityChanger.SetFontColor(
                    fontColor: args.GetNewValue <StringList>().SelectedIndex == 3 ? Color.Green : Color.Gray);
            };

            if (MainMenu.ComboKeysMenu.Item("abilityComboType").GetValue <StringList>().SelectedIndex == 3)
            {
                priorityChanger.SetFontColor(fontColor: Color.Green);
            }

            MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.Mode", "Move mode"))
            .SetValue(new StringList(new[] { "Orbwalk", "Move to mouse", "Attack target", "Do nothing" }));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.NoMoveRange", "No move range"))
            .SetValue(new Slider(0, 0, 300))
            .SetTooltip("Your hero will not move if you put your mouse near your hero in the selected range");
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.Target", "Target selection"))
            .SetValue(new StringList(new[] { "ClosestToMouse", "FastestKillable" }));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.TargetLock", "Target lock"))
            .SetValue(new StringList(new[] { "None", "WhenTheyGoToFog", "WhenKeyIsPressed" }));
            MainMenu.ComboKeysMenu.AddItem(
                new MenuItem("Ability#.MaximizeDamage", "Maximize damage (beta feature)").SetValue(false)
                .SetFontColor(fontColor: Color.Aqua)
                .SetTooltip(
                    "Enabling this option will make sure that all damage/damage amplifying abilities are used right away"));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("comboAbilitiesToggler", "Abilities in combo: "))
            .SetValue(new AbilityToggler(new Dictionary <string, bool>()));
            MainMenu.ComboKeysMenu.AddItem(priorityChanger);

            foreach (var spell in
                     from spell in AbilityMain.Me.Spellbook.Spells
                     let data = AbilityDatabase.Find(spell.Name)
                                where
                                (data != null &&
                                 (data.IsNuke || data.IsDisable || data.IsHarras || data.IsBuff || data.WeakensEnemy ||
                                  data.IsSlow || data.IsSilence)) || spell.Name == "tinker_rearm" ||
                                spell.StoredName() == "invoker_emp" || spell.StoredName() == "invoker_forge_spirit" ||
                                spell.StoredName() == "invoker_chaos_meteor" ||
                                spell.StoredName() == "skywrath_mage_mystic_flare"
                                select spell)
            {
                var dv = spell.AbilityType != AbilityType.Ultimate || spell.Name == "templar_assassin_psionic_trap";
                if (NameManager.Name(spell) == "tinker_rearm")
                {
                    MyAbilities.TinkerRearm = spell;
                }

                ComboMenu.AddAbility(spell.Name, spell, dv);
            }

            foreach (var spell in
                     from spell in myItems1
                     let data = AbilityDatabase.Find(spell.Name)
                                where
                                data != null &&
                                (data.IsNuke || data.IsDisable || data.IsHarras || data.IsBuff || data.WeakensEnemy ||
                                 data.IsSlow || data.IsSilence)
                                select spell)
            {
                if (NameManager.Name(spell) == "item_cyclone")
                {
                    MyAbilities.Cyclone = spell;
                }

                ComboMenu.AddAbility(spell.Name, spell);
            }

            if (blink != null)
            {
                MyAbilities.Blink = blink;
                RangeDrawing.AddRange(blink);
                ComboMenu.AddAbility(blink.StoredName(), blink);
            }

            // if (blink != null)
            // {
            // MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue<AbilityToggler>().Add(blink.Name);
            // }
            MainMenu.OptionsMenu.AddSubMenu(MainMenu.ComboKeysMenu);
            MainMenu.OptionsMenu.AddSubMenu(MainMenu.DrawingsMenu);
            MainMenu.BlinkMenu.AddItem(
                new MenuItem("Ability#.BlinkRange", "BlinkPosition distance from target").SetValue(
                    new Slider(0, 0, 700)));
            MainMenu.BlinkMenu.AddItem(
                new MenuItem("Ability#.BlinkMaxEnemiesAround", "Maximum enemies around target to use blink").SetValue(
                    new Slider(2, 0, 3)))
            .SetTooltip("If theres more enemies around then specified value, blink will not be used");
            if (AbilityMain.Me.ClassId == ClassId.CDOTA_Unit_Hero_Invoker)
            {
                MainMenu.OptionsMenu.AddSubMenu(MainMenu.InvokerMenu);
                MainMenu.InvokerMenu.AddItem(
                    new MenuItem("Ability#.InvokerInvoke", "Enable AutoInvoke").SetValue(false));
            }

            MainMenu.OptionsMenu.AddSubMenu(MainMenu.BlinkMenu);
            MainMenu.Menu.AddSubMenu(MainMenu.OptionsMenu);
            MainMenu.Menu.AddSubMenu(MainMenu.RangeDrawingMenu);
        }
Ejemplo n.º 21
0
        private void OnExecuteOrder(Player sender, ExecuteOrderEventArgs args)
        {
            if (!menu.IsEnabled || !args.Process || args.IsQueued || !args.Entities.Contains(manager.MyHero.Hero) ||
                !args.IsPlayerInput && !menu.UniversalUseEnabled || manager.MyHero.IsInvisible() &&
                !manager.MyHero.CanUseAbilitiesInInvisibility())
            {
                return;
            }

            var ability = args.Ability;

            if (args.IsPlayerInput && ability?.Id == AbilityId)
            {
                powerTreads.ChangeDefaultAttribute();
                return;
            }

            var sleep = Math.Max(ability.FindCastPoint() * 1000, 100) + 200;

            if (!powerTreads.CanBeCasted())
            {
                if (ability == null)
                {
                    return;
                }

                sleeper.Sleep((float)sleep, AbilityId);

                if (powerTreads.ActiveAttribute == Attribute.Intelligence)
                {
                    powerTreads.SetSleep((float)sleep);
                }

                return;
            }

            if (ability != null && (ability.ManaCost <= menu.MpAbilityThreshold ||
                                    !menu.IsAbilityEnabled(ability.StoredName())))
            {
                return;
            }

            switch (args.OrderId)
            {
            case OrderId.MoveLocation:
            case OrderId.MoveTarget:
            {
                var switchAttribute = GetAttribute(menu.SwitchOnMoveAttribute);

                if (switchAttribute == Attribute.Invalid || powerTreads.ActiveAttribute == switchAttribute ||
                    activeDelaySwitchModifiers.Any())
                {
                    return;
                }

                powerTreads.SwitchTo(switchAttribute);
                powerTreads.ChangeDefaultAttribute(switchAttribute);
                sleeper.Sleep(300, AbilityId);

                return;
            }

            case OrderId.AttackLocation:
            case OrderId.AttackTarget:
            {
                var switchAttribute = GetAttribute(menu.SwitchOnAttackAttribute);

                if (switchAttribute == Attribute.Invalid || powerTreads.ActiveAttribute == switchAttribute ||
                    activeDelaySwitchModifiers.Any())
                {
                    return;
                }

                powerTreads.SwitchTo(switchAttribute);
                powerTreads.ChangeDefaultAttribute(switchAttribute);
                sleeper.Sleep(300, AbilityId);

                return;
            }

            case OrderId.AbilityTarget:
            {
                var target = args.Target as Unit;
                if (target != null && target.IsValid && target.IsAlive)
                {
                    if (manager.MyHero.Distance2D(target) <= ability.GetCastRange() + 300)
                    {
                        powerTreads.SwitchTo(Attribute.Intelligence);
                        order.UseAbility(ability, target);
                        sleep       += manager.MyHero.Hero.GetTurnTime(target) * 1000;
                        args.Process = false;
                    }
                }
                break;
            }

            case OrderId.AbilityLocation:
            {
                var targetLocation = args.TargetPosition;
                if (manager.MyHero.Distance2D(targetLocation) <= ability.GetCastRange() + 300 ||
                    !AbilityDatabase.Find(ability.StoredName()).FakeCastRange)
                {
                    powerTreads.SwitchTo(Attribute.Intelligence);
                    order.UseAbility(ability, targetLocation);
                    sleep       += manager.MyHero.Hero.GetTurnTime(targetLocation) * 1000;
                    args.Process = false;
                }
                break;
            }

            case OrderId.Ability:
            {
                powerTreads.SwitchTo(Attribute.Intelligence);
                order.UseAbility(ability);
                args.Process = false;
                break;
            }

            case OrderId.ToggleAbility:
            {
                powerTreads.SwitchTo(Attribute.Intelligence);
                order.ToggleAbility(ability);
                args.Process = false;
                break;
            }

            default:
            {
                return;
            }
            }

            if (!args.Process)
            {
                sleeper.Sleep((float)sleep, AbilityId);
            }
        }
Ejemplo n.º 22
0
        public static void AddAllToMenu()
        {
            var mySpells = AbilityMain.Me.Spellbook.Spells.Where(x => AbilityDatabase.Find(x.Name) != null);
            var myItems  = AbilityMain.Me.Inventory.Items;
            var spells   = mySpells as Ability[] ?? mySpells.ToArray();
            var myItems1 = myItems as Item[] ?? myItems.ToArray();
            var blink    = myItems1.FirstOrDefault(x => x.Name == "item_blink");

            MyAbilities.SoulRing = myItems1.FirstOrDefault(x => x.Name == "item_soul_ring");
            if (blink != null)
            {
                MyAbilities.Blink = blink;
                BlinkMenu.Create(blink);
            }
            Nukes.AddAllNukes(spells, myItems1);
            Disables.AddAllDisables(spells, myItems1);
            Slows.AddAllSlows(spells, myItems1);
            Buffs.AddAllBuffs(spells, myItems1);
            Harrases.AddAllHarrases(spells, myItems1);
            Silences.AddAllSilences(spells, myItems1);
            Specials.AddAllSpecials(spells, myItems1);
            Heals.AddAllHeals(spells, myItems1);
            Shields.AddAllShields(spells, myItems1);
            MainMenu.Menu.AddSubMenu(MainMenu.AbilitiesMenu);
            MainMenu.DrawingsMenu.AddSubMenu(MainMenu.DamageIndicatorMenu);
            MainMenu.DrawingsMenu.AddSubMenu(MainMenu.GankDamageMenu);
            MainMenu.GankDamageMenu.AddItem(new MenuItem("enableGankDamage", "Enable: ").SetValue(true));
            MainMenu.GankDamageMenu.AddItem(
                new MenuItem("enableGankDamageAllies", "Enable for allies: ").SetValue(true));
            MainMenu.GankDamageMenu.AddItem(
                new MenuItem("enableGankDamageEnemies", "Enable for enemies: ").SetValue(true));
            MainMenu.DamageIndicatorMenu.AddItem(
                new MenuItem("abilityDamageIndicatorDrawDamage", "Draw Damage").SetValue(true));
            MainMenu.DamageIndicatorMenu.AddItem(
                new MenuItem("abilityDamageIndicatorDrawHits", "Draw hits").SetValue(true));
            MainMenu.DamageIndicatorMenu.AddItem(
                new MenuItem("abilityDamageIndicatorTextSize", "Increase text size").SetValue(new Slider(0, 0, 5)));
            MainMenu.DrawingsMenu.AddSubMenu(MainMenu.AbilityOverlayMenu);
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("spellOverlay", "SPELLS OVERLAY:").SetFontStyle(fontColor: Color.White));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableSpellOverlayEnemy", "Enable for enemies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableSpellOverlayAlly", "Enable for allies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("sizeSliderSpell", "Increase the size: ").SetValue(new Slider(0, 0, 25)));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("itemOverlay", "ITEMS OVERLAY:").SetFontStyle(fontColor: Color.White));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableItemOverlayEnemy", "Enable for enemies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableItemOverlayAlly", "Enable for allies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("sizeSliderItem", "Increase the size: ").SetValue(new Slider(0, 0, 25)));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("unfinishedFeature", "This feature is currently unfinished!"))
            .SetFontStyle(fontColor: Color.OrangeRed)
            .SetTooltip("Contains unfinished stuff, not all combos are tweaked/in right order.");
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("abilityKey1", "Combo Key"))
            .SetValue(new KeyBind('G', KeyBindType.Press));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("abilityComboType", "Combo Order"))
            .SetValue(new StringList(new[] { "Normal", "Maximum Disable", "Maximum Damage" }));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("comboAbilitiesToggler", "Abilities in combo: "))
            .SetValue(new AbilityToggler(new Dictionary <string, bool>()));
            foreach (var spell in
                     from spell in spells
                     let data = AbilityDatabase.Find(spell.Name)
                                where
                                data != null &&
                                (data.IsNuke || data.IsDisable || data.IsHarras || data.IsBuff || data.WeakensEnemy ||
                                 data.IsSlow || data.IsSilence)
                                select spell)
            {
                var dv = spell.AbilityType != AbilityType.Ultimate;
                ComboMenu.AddAbility(spell.Name, dv);
            }
            foreach (var spell in
                     from spell in myItems1
                     let data = AbilityDatabase.Find(spell.Name)
                                where
                                data != null &&
                                (data.IsNuke || data.IsDisable || data.IsHarras || data.IsBuff || data.WeakensEnemy ||
                                 data.IsSlow || data.IsSilence)
                                select spell)
            {
                ComboMenu.AddAbility(spell.Name);
            }
            //if (blink != null)
            //{
            //    MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue<AbilityToggler>().Add(blink.Name);
            //}
            MainMenu.OptionsMenu.AddSubMenu(MainMenu.ComboKeysMenu);
            MainMenu.OptionsMenu.AddSubMenu(MainMenu.DrawingsMenu);
            MainMenu.Menu.AddSubMenu(MainMenu.OptionsMenu);
            MainMenu.Menu.AddSubMenu(MainMenu.RangeDrawingMenu);
        }
Ejemplo n.º 23
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="AbilitySkill" /> class.
        /// </summary>
        /// <param name="sourceAbility">
        ///     The skill.
        /// </param>
        /// <param name="castingFunction">
        ///     The casting Function.
        /// </param>
        protected AbilitySkill(Ability sourceAbility)
        {
            if (sourceAbility == null)
            {
                throw new ArgumentException("Skill passed to AbilitySkill ctor was null");
            }

            this.Source        = (Unit)sourceAbility.Owner;
            this.SourceAbility = sourceAbility;
            this.Name          = sourceAbility.StoredName();

            // this.DamageCalculator = new DefaultSkillDamageCalculator(this);
            this.SourceItem = sourceAbility as Item;

            this.IsItem            = this.SourceItem != null;
            this.SkillHandle       = this.SourceAbility.Handle;
            this.SkillHandleString = this.SkillHandle.ToString(CultureInfo.CurrentCulture);
            this.AbilityInfo       = AbilityDatabase.Find(this.Name) ?? new AbilityInfo();

            // this.Variables.DealsDamageToTarget = this.SourceAbility.IsNuke();
            // this.Variables.AppliesDisableOnTarget = this.SourceAbility.IsDisable();
            // this.Variables.AppliesSlowOnTarget = this.SourceAbility.IsSlow();

            // if (this.Name == "item_soul_ring")
            // {
            // this.Variables.RefillsMana = true;
            // this.Variables.BonusMana = sourceAbility.GetAbilityData("mana_gain");
            // }
            if (this.Name.Contains("item_"))
            {
                this.Texture = Textures.GetItemTexture(this.Name);

                // this.IconSize = new Vector2(HUDInfo.GetHPBarSizeX() / 6, (float)(HUDInfo.GetHPBarSizeX() / 6 / 1.24));
            }
            else
            {
                this.Texture = Textures.GetSpellTexture(this.Name);

                // this.IconSize = new Vector2(HUDInfo.GetHPBarSizeX() / 6, HUDInfo.GetHPBarSizeX() / 6 + 1);
            }

            // this.AbilityPhase = new AbilityPhase(this);
            // this.AbilityParticle = new AbilityParticle(this);

            // DelayAction.Add(200,
            // () =>
            // {
            // if (this.Json.ParticleNames == null)
            // {
            // return;
            // }

            // Entity.OnParticleEffectAdded += this.Entity_OnParticleEffectAdded;
            // });

            // if (this.DealsDamageToTarget)
            // {
            // foreach (var hero in Heroes.All)
            // {
            // this.DamageDealtDictionary[hero.Handle] = 0;
            // this.CanUseOnDictionary[hero.Handle] = false;
            // }
            // }
        }
Ejemplo n.º 24
0
        public static void ObjectMgr_OnRemoveEntity(EntityEventArgs args)
        {
            try
            {
                var a = args.Entity;
                if (a == null || NameManager.Name(a) == null || MainMenu.Menu == null)
                {
                    return;
                }

                var name = NameManager.Name(a);
                var data = AbilityDatabase.Find(name);
                if (data == null || a.Owner == null || !a.Owner.Equals(AbilityMain.Me))
                {
                    return;
                }

                MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue <AbilityToggler>().Remove(name);
                MainMenu.ComboKeysMenu.Item("Ability#.ComboOrder").GetValue <PriorityChanger>().Remove(name);

                // if (AbilityMain.Me.ClassId == ClassId.CDOTA_Unit_Hero_Rubick)
                // {
                // if (!Rubick.MyCdDictionary.ContainsKey(name))
                // {
                // Rubick.MyCdDictionary.Add(name, Utils.TickCount + ((a as Ability).Cooldown * 1000));
                // }
                // }
                RangeDrawing.RemoveRange(a as Ability);
                if (data.IsPurge || data.WeakensEnemy || data.TrueSight)
                {
                    MainMenu.Menu.Item("specialsToggler").GetValue <AbilityToggler>().Remove(name);
                    Specials.SpecialsMenuDictionary.Remove(name);
                    Specials.SpecialsMenu.RemoveSubMenu(name);
                    MyAbilities.OffensiveAbilities.Remove(name + "special");
                }

                if (data.IsBuff)
                {
                    MainMenu.Menu.Item("buffsToggler").GetValue <AbilityToggler>().Remove(name);
                    Buffs.BuffsMenuDictionary.Remove(name);
                    Buffs.BuffsMenu.RemoveSubMenu(name);
                    MyAbilities.OffensiveAbilities.Remove(name + "buff");
                }

                if (data.IsNuke || name == "item_urn_of_shadows")
                {
                    MainMenu.Menu.Item("nukesToggler").GetValue <AbilityToggler>().Remove(name);
                    Nukes.NukesMenuDictionary.Remove(name);
                    Nukes.NukesMenu.RemoveSubMenu(name);
                    MyAbilities.OffensiveAbilities.Remove(name + "nuke");
                }

                if (data.IsDisable)
                {
                    MainMenu.Menu.Item("disablesToggler").GetValue <AbilityToggler>().Remove(name);
                    Disables.DisablesMenuDictionary.Remove(name);
                    Disables.DisablesMenu.RemoveSubMenu(name);
                    MyAbilities.OffensiveAbilities.Remove(name + "disable");
                }

                if (data.IsSlow)
                {
                    MainMenu.Menu.Item("slowsToggler").GetValue <AbilityToggler>().Remove(name);
                    Slows.SlowsMenuDictionary.Remove(name);
                    Slows.SlowsMenu.RemoveSubMenu(name);
                    MyAbilities.OffensiveAbilities.Remove(name + "slow");
                }

                if (data.IsHarras)
                {
                    MainMenu.Menu.Item("harrasesToggler").GetValue <AbilityToggler>().Remove(name);
                    Harrases.HarrasesMenuDictionary.Remove(name);
                    Harrases.HarrasesMenu.RemoveSubMenu(name);
                    MyAbilities.OffensiveAbilities.Remove(name + "harras");
                }

                if (data.IsSilence)
                {
                    MainMenu.Menu.Item("silencesToggler").GetValue <AbilityToggler>().Remove(name);
                    Silences.SilencesMenuDictionary.Remove(name);
                    Silences.SilencesMenu.RemoveSubMenu(name);
                    MyAbilities.OffensiveAbilities.Remove(name + "silence");
                }

                if (data.IsHeal)
                {
                    MainMenu.Menu.Item("healsToggler").GetValue <AbilityToggler>().Remove(name);
                    Heals.HealsMenuDictionary.Remove(name);
                    Heals.HealsMenu.RemoveSubMenu(name);
                    MyAbilities.DefensiveAbilities.Remove(name + "heal");
                }

                if (data.IsShield)
                {
                    MainMenu.Menu.Item("shieldsToggler").GetValue <AbilityToggler>().Remove(name);
                    Shields.ShieldsMenuDictionary.Remove(name);
                    Shields.ShieldsMenu.RemoveSubMenu(name);
                    MyAbilities.DefensiveAbilities.Remove(name + "shield");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
Ejemplo n.º 25
0
        public static void UpdateItems(EventArgs args)
        {
            if (!OnUpdateChecks.CanUpdate())
            {
                return;
            }

            try
            {
                if (!Utils.SleepCheck("checkitems"))
                {
                    return;
                }

                foreach (var item in
                         AbilityMain.Me.Inventory.Items)
                {
                    switch (NameManager.Name(item))
                    {
                    case "item_gem":
                        continue;

                    case "item_soul_ring":
                        MyAbilities.SoulRing = item;
                        break;

                    case "item_aether_lens":

                        RangeDrawing.Update();
                        break;

                    case "item_cyclone":
                        MyAbilities.Cyclone = item;
                        break;

                    case "item_force_staff":
                        MyAbilities.ForceStaff = item;
                        break;

                    case "item_blink":
                        if (MyAbilities.Blink != null && MyAbilities.Blink.IsValid)
                        {
                            continue;
                        }

                        ComboMenu.AddAbility(item.StoredName(), item);
                        RangeDrawing.AddRange(item);
                        MyAbilities.Blink = item;
                        continue;
                    }

                    var data = AbilityDatabase.Find(NameManager.Name(item));

                    if (data == null)
                    {
                        continue;
                    }

                    if (!MyAbilities.OffensiveAbilities.ContainsValue(item))
                    {
                        var added = false;
                        if (data.IsSlow)
                        {
                            AddNewSlow(item);
                            added = true;
                        }

                        if (data.IsHarras)
                        {
                            AddNewHarras(item);
                            added = true;
                        }

                        if (data.IsBuff)
                        {
                            AddNewBuff(item);
                            added = true;
                        }

                        if (data.IsSilence)
                        {
                            AddNewSilence(item);
                            added = true;
                        }

                        if (data.TrueSight || data.WeakensEnemy || data.IsPurge)
                        {
                            AddNewSpecial(item, data);
                            added = true;
                        }

                        if (data.IsDisable)
                        {
                            AddNewDisable(item);
                            added = true;
                        }

                        if (data.IsNuke || item.Name == "item_urn_of_shadows")
                        {
                            AddNewNuke(item);
                            added = true;
                        }

                        if (added)
                        {
                            RangeDrawing.AddRange(item);
                            ComboMenu.AddAbility(item.Name, item);
                        }
                    }

                    // Console.WriteLine(!MyAbilities.DefensiveAbilities.ContainsValue(item) + " " + NameManager.Name(item) + " " + data.IsHeal);
                    if (!MyAbilities.DefensiveAbilities.ContainsValue(item))
                    {
                        if (data.IsHeal)
                        {
                            AddNewHeal(item);
                        }

                        if (data.IsShield)
                        {
                            AddNewShield(item);
                        }
                    }
                }

                if (AbilityMain.Me.ClassId == ClassId.CDOTA_Unit_Hero_Rubick)
                {
                    foreach (var item in AllyHeroes.AbilityDictionary[NameManager.Name(AbilityMain.Me)])
                    {
                        var data = AbilityDatabase.Find(NameManager.Name(item));

                        if (data == null)
                        {
                            continue;
                        }

                        if (item.StoredName() == "spirit_breaker_charge_of_darkness")
                        {
                            MyAbilities.ChargeOfDarkness = item;
                        }

                        if (!MyAbilities.OffensiveAbilities.ContainsValue(item))
                        {
                            var added = false;
                            if (data.IsSlow)
                            {
                                AddNewSlow(item);
                                added = true;
                            }

                            if (data.IsHarras)
                            {
                                AddNewHarras(item);
                                added = true;
                            }

                            if (data.IsBuff)
                            {
                                AddNewBuff(item);
                                added = true;
                            }

                            if (data.IsSilence)
                            {
                                AddNewSilence(item);
                                added = true;
                            }

                            if (data.TrueSight || data.WeakensEnemy || data.IsPurge)
                            {
                                AddNewSpecial(item, data);
                                added = true;
                            }

                            if (data.IsDisable)
                            {
                                AddNewDisable(item);
                                added = true;
                            }

                            if (data.IsNuke)
                            {
                                AddNewNuke(item);
                                added = true;
                            }

                            if (added)
                            {
                                ComboMenu.AddAbility(item.Name, item);
                            }
                        }

                        // Console.WriteLine(!MyAbilities.DefensiveAbilities.ContainsValue(item) + " " + NameManager.Name(item) + " " + data.IsHeal);
                        if (!MyAbilities.DefensiveAbilities.ContainsValue(item))
                        {
                            if (data.IsHeal)
                            {
                                AddNewHeal(item);
                            }

                            if (data.IsShield)
                            {
                                AddNewShield(item);
                            }
                        }
                    }
                }

                Utils.Sleep(1000, "checkitems");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        ///     The execute combo.
        /// </summary>
        /// <param name="target">
        ///     The target.
        /// </param>
        /// <returns>
        ///     The <see cref="bool" />.
        /// </returns>
        public bool ExecuteCombo(Unit target)
        {
            if (!Variables.Hero.CanUseItems())
            {
                return(false);
            }

            foreach (var item in this.items)
            {
                var name = item.StoredName();
                if (!item.IsValid || !Variables.MenuManager.AbilityEnabled(name) || !item.CanBeCasted())
                {
                    continue;
                }

                var data = AbilityDatabase.Find(name);
                if (data == null)
                {
                    continue;
                }

                var n = "BreakerSharp." + name;
                if (!Utils.SleepCheck(n))
                {
                    continue;
                }

                if (data.IsDisable || data.IsSilence || data.IsSlow || name == "item_heavens_halberd")
                {
                    if (!item.CanHit(target))
                    {
                        continue;
                    }

                    if (!item.CastStun(target))
                    {
                        continue;
                    }

                    Utils.Sleep((item.GetCastDelay(Variables.Hero, target) * 1000) + Game.Ping, n);
                    return(true);
                }

                if (data.WeakensEnemy)
                {
                    if (!item.CanHit(target))
                    {
                        continue;
                    }

                    item.UseAbility(target);
                    Utils.Sleep((item.GetCastDelay(Variables.Hero, target) * 1000) + Game.Ping, n);
                    return(true);
                }

                if (name == "item_urn_of_shadows")
                {
                    if (!item.CanHit(target))
                    {
                        continue;
                    }

                    if (!target.HasModifier("modifier_item_urn_damage"))
                    {
                        item.UseAbility(target);
                        Utils.Sleep(500, n);
                        return(true);
                    }

                    continue;
                }

                if (!data.IsBuff || Variables.Hero.Distance2D(target) > 800)
                {
                    continue;
                }

                if (name == "item_armlet")
                {
                    var canEnableArmlet =
                        !Variables.Hero.HasModifiers(
                            new[] { "modifier_item_armlet_unholy_strength", "modifier_ice_blast" },
                            false) && !item.IsToggled;
                    if (!canEnableArmlet)
                    {
                        continue;
                    }

                    item.ToggleAbility();
                    Utils.Sleep(1000, n);
                    return(true);
                }

                item.UseAbility();
                Utils.Sleep(100, n);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 27
0
        public static void UpdateItems(EventArgs args)
        {
            if (!OnUpdateChecks.CanUpdate())
            {
                return;
            }

            try
            {
                if (!Utils.SleepCheck("checkitems"))
                {
                    return;
                }

                foreach (var item in
                         AbilityMain.Me.Inventory.Items)
                {
                    switch (NameManager.Name(item))
                    {
                    case "item_gem":
                        continue;

                    case "item_soul_ring":
                        MyAbilities.SoulRing = item;
                        break;

                    case "item_aether_lens":

                        RangeDrawing.Update();
                        break;

                    case "item_blink":
                        // MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue<AbilityToggler>().Add(item.Name);
                        RangeDrawing.AddRange(item);
                        MyAbilities.Blink = item;
                        continue;
                    }

                    var data = AbilityDatabase.Find(NameManager.Name(item));

                    if (data == null)
                    {
                        continue;
                    }

                    if (!MyAbilities.OffensiveAbilities.ContainsValue(item))
                    {
                        var added = false;
                        if (data.IsSlow)
                        {
                            AddNewSlow(item);
                            added = true;
                        }

                        if (data.IsHarras)
                        {
                            AddNewHarras(item);
                            added = true;
                        }

                        if (data.IsBuff)
                        {
                            AddNewBuff(item);
                            added = true;
                        }

                        if (data.IsSilence)
                        {
                            AddNewSilence(item);
                            added = true;
                        }

                        if (data.TrueSight || data.WeakensEnemy || data.IsPurge)
                        {
                            AddNewSpecial(item, data);
                            added = true;
                        }

                        if (data.IsDisable)
                        {
                            AddNewDisable(item);
                            added = true;
                        }

                        if (data.IsNuke)
                        {
                            AddNewNuke(item);
                            added = true;
                        }

                        if (added)
                        {
                            RangeDrawing.AddRange(item);
                            ComboMenu.AddAbility(item.Name);
                        }
                    }

                    // Console.WriteLine(!MyAbilities.DeffensiveAbilities.ContainsValue(item) + " " + NameManager.Name(item) + " " + data.IsHeal);
                    if (!MyAbilities.DeffensiveAbilities.ContainsValue(item))
                    {
                        if (data.IsHeal)
                        {
                            AddNewHeal(item);
                        }

                        if (data.IsShield)
                        {
                            AddNewShield(item);
                        }
                    }
                }

                if (AbilityMain.Me.ClassID == ClassID.CDOTA_Unit_Hero_Rubick)
                {
                    foreach (var item in AllyHeroes.AbilityDictionary[NameManager.Name(AbilityMain.Me)])
                    {
                        var data = AbilityDatabase.Find(NameManager.Name(item));

                        if (data == null)
                        {
                            continue;
                        }

                        if (!MyAbilities.OffensiveAbilities.ContainsValue(item))
                        {
                            var added = false;
                            if (data.IsSlow)
                            {
                                AddNewSlow(item);
                                added = true;
                            }

                            if (data.IsHarras)
                            {
                                AddNewHarras(item);
                                added = true;
                            }

                            if (data.IsBuff)
                            {
                                AddNewBuff(item);
                                added = true;
                            }

                            if (data.IsSilence)
                            {
                                AddNewSilence(item);
                                added = true;
                            }

                            if (data.TrueSight || data.WeakensEnemy || data.IsPurge)
                            {
                                AddNewSpecial(item, data);
                                added = true;
                            }

                            if (data.IsDisable)
                            {
                                AddNewDisable(item);
                                added = true;
                            }

                            if (data.IsNuke)
                            {
                                AddNewNuke(item);
                                added = true;
                            }

                            if (added)
                            {
                                ComboMenu.AddAbility(item.Name);
                            }
                        }

                        // Console.WriteLine(!MyAbilities.DeffensiveAbilities.ContainsValue(item) + " " + NameManager.Name(item) + " " + data.IsHeal);
                        if (!MyAbilities.DeffensiveAbilities.ContainsValue(item))
                        {
                            if (data.IsHeal)
                            {
                                AddNewHeal(item);
                            }

                            if (data.IsShield)
                            {
                                AddNewShield(item);
                            }
                        }
                    }
                }

                Utils.Sleep(1000, "checkitems");
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 28
0
        public static void AddAllToMenu()
        {
            var mySpells = AbilityMain.Me.Spellbook.Spells.Where(x => AbilityDatabase.Find(x.Name) != null);
            var myItems  = AbilityMain.Me.Inventory.Items;
            var spells   = mySpells as Ability[] ?? mySpells.ToArray();
            var myItems1 = myItems as Item[] ?? myItems.ToArray();
            var blink    = myItems1.FirstOrDefault(x => x.Name == "item_blink");

            MyAbilities.SoulRing = myItems1.FirstOrDefault(x => x.Name == "item_soul_ring");
            if (blink != null)
            {
                MyAbilities.Blink = blink;
                RangeDrawing.AddRange(blink);
            }

            Nukes.AddAllNukes(spells, myItems1);
            Disables.AddAllDisables(spells, myItems1);
            Slows.AddAllSlows(spells, myItems1);
            Buffs.AddAllBuffs(spells, myItems1);
            Harrases.AddAllHarrases(spells, myItems1);
            Silences.AddAllSilences(spells, myItems1);
            Specials.AddAllSpecials(spells, myItems1);
            Heals.AddAllHeals(spells, myItems1);
            Shields.AddAllShields(spells, myItems1);
            MainMenu.Menu.AddSubMenu(MainMenu.AbilitiesMenu);
            MainMenu.DrawingsMenu.AddSubMenu(MainMenu.DamageIndicatorMenu);
            MainMenu.DrawingsMenu.AddSubMenu(MainMenu.GankDamageMenu);
            MainMenu.GankDamageMenu.AddItem(new MenuItem("enableGankDamage", "Enable: ").SetValue(true));
            MainMenu.GankDamageMenu.AddItem(
                new MenuItem("enableGankDamageAllies", "Enable for allies: ").SetValue(true));
            MainMenu.GankDamageMenu.AddItem(
                new MenuItem("enableGankDamageEnemies", "Enable for enemies: ").SetValue(true));
            MainMenu.DamageIndicatorMenu.AddItem(
                new MenuItem("abilityDamageIndicatorDrawDamage", "Draw Damage").SetValue(true));
            MainMenu.DamageIndicatorMenu.AddItem(
                new MenuItem("abilityDamageIndicatorDrawHits", "Draw hits").SetValue(true));
            MainMenu.DamageIndicatorMenu.AddItem(
                new MenuItem("abilityDamageIndicatorTextSize", "Increase text size").SetValue(new Slider(0, 0, 5)));
            MainMenu.DrawingsMenu.AddSubMenu(MainMenu.AbilityOverlayMenu);
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("spellOverlay", "SPELLS OVERLAY:").SetFontStyle(fontColor: Color.White));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableSpellOverlayEnemy", "Enable for enemies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableSpellOverlayAlly", "Enable for allies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("sizeSliderSpell", "Increase the size: ").SetValue(new Slider(0, 0, 25)));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("itemOverlay", "ITEMS OVERLAY:").SetFontStyle(fontColor: Color.White));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableItemOverlayEnemy", "Enable for enemies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("enableItemOverlayAlly", "Enable for allies: ").SetValue(true));
            MainMenu.AbilityOverlayMenu.AddItem(
                new MenuItem("sizeSliderItem", "Increase the size: ").SetValue(new Slider(0, 0, 25)));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("unfinishedFeature", "This feature is currently unfinished!"))
            .SetFontStyle(fontColor: Color.OrangeRed)
            .SetTooltip("Contains unfinished stuff, not all combos are tweaked/in right order.");
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("abilityKey1", "Combo Key"))
            .SetValue(new KeyBind('G', KeyBindType.Press));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("abilityComboType", "Combo Order"))
            .SetValue(new StringList(new[] { "Normal", "Maximum Disable", "Maximum Damage" }));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.Mode", "Move mode"))
            .SetValue(new StringList(new[] { "Orbwalk", "Move to mouse", "Attack target", "Do nothing" }));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.NoMoveRange", "No move range"))
            .SetValue(new Slider(0, 0, 300))
            .SetTooltip("Your hero will not move if you put your mouse near your hero in the selected range");
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.Target", "Target selection"))
            .SetValue(new StringList(new[] { "ClosestToMouse", "FastestKillable" }));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.TargetLock", "Target lock"))
            .SetValue(new StringList(new[] { "None", "WhenTheyGoToFog", "WhenKeyIsPressed" }));
            MainMenu.ComboKeysMenu.AddItem(new MenuItem("comboAbilitiesToggler", "Abilities in combo: "))
            .SetValue(new AbilityToggler(new Dictionary <string, bool>()));

            foreach (var spell in
                     from spell in spells
                     let data = AbilityDatabase.Find(spell.Name)
                                where
                                (data != null &&
                                 (data.IsNuke || data.IsDisable || data.IsHarras || data.IsBuff || data.WeakensEnemy ||
                                  data.IsSlow || data.IsSilence)) || spell.Name == "tinker_rearm"
                                select spell)
            {
                var dv = spell.AbilityType != AbilityType.Ultimate || spell.Name == "templar_assassin_psionic_trap";
                if (NameManager.Name(spell) == "tinker_rearm")
                {
                    MyAbilities.TinkerRearm = spell;
                }

                ComboMenu.AddAbility(spell.Name, dv);
            }

            foreach (var spell in
                     from spell in myItems1
                     let data = AbilityDatabase.Find(spell.Name)
                                where
                                data != null &&
                                (data.IsNuke || data.IsDisable || data.IsHarras || data.IsBuff || data.WeakensEnemy ||
                                 data.IsSlow || data.IsSilence)
                                select spell)
            {
                ComboMenu.AddAbility(spell.Name);
            }

            // if (blink != null)
            // {
            // MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue<AbilityToggler>().Add(blink.Name);
            // }
            MainMenu.OptionsMenu.AddSubMenu(MainMenu.ComboKeysMenu);
            MainMenu.OptionsMenu.AddSubMenu(MainMenu.DrawingsMenu);
            MainMenu.Menu.AddSubMenu(MainMenu.OptionsMenu);
            MainMenu.Menu.AddSubMenu(MainMenu.RangeDrawingMenu);
        }
Ejemplo n.º 29
0
        private void UseAbility(ExecuteOrderEventArgs args)
        {
            var ability = args.Ability;

            if (itemManager.PowerTreads.Equals(ability))
            {
                switch (itemManager.PowerTreads.ActiveAttribute)
                {
                case Attribute.Strength:
                    itemManager.PowerTreads.DefaultAttribute = Attribute.Intelligence;
                    break;

                case Attribute.Agility:
                    itemManager.PowerTreads.DefaultAttribute = Attribute.Strength;
                    break;

                case Attribute.Intelligence:
                    itemManager.PowerTreads.DefaultAttribute = Attribute.Agility;
                    break;
                }
                Sleeper.Sleep(100 + Game.Ping, "SwitchBackPT");
                return;
            }

            if (ability.ManaCost <= Menu.PowerTreads.ManaThreshold ||
                abilityUpdater.IgnoredAbilities.Contains(ability.StoredName()))
            {
                return;
            }

            var soulRingCondition = itemManager.SoulRing.CanBeCasted() &&
                                    Menu.SoulRing.AbilityEnabled(ability.StoredName());

            var powerTreadsCondition = itemManager.PowerTreads.CanBeCasted() &&
                                       Menu.PowerTreads.AbilityEnabled(ability.StoredName());

            if (!soulRingCondition && !powerTreadsCondition)
            {
                return;
            }

            args.Process = false;

            if (soulRingCondition)
            {
                itemManager.SoulRing.Use(false);
            }

            var sleep = Math.Max(ability.FindCastPoint() * 1000, 100) + Game.Ping / 1000 + 300;

            switch (args.Order)
            {
            case Order.AbilityTarget:
                var target = args.Target as Unit;
                if (target != null && target.IsValid && target.IsAlive)
                {
                    if (powerTreadsCondition && Hero.Distance2D(target) <= ability.GetCastRange() + 300)
                    {
                        itemManager.PowerTreads.SwitchTo(Attribute.Intelligence);
                        sleep += Hero.GetTurnTime(target) * 1000;
                    }
                    ability.UseAbility(target);
                }
                break;

            case Order.AbilityLocation:
                var targetLocation = args.TargetPosition;
                if (powerTreadsCondition &&
                    (Hero.Distance2D(targetLocation) <= ability.GetCastRange() + 300 ||
                     AbilityDatabase.Find(ability.StoredName()).FakeCastRange))
                {
                    itemManager.PowerTreads.SwitchTo(Attribute.Intelligence);
                    sleep += Hero.GetTurnTime(targetLocation) * 1000;
                }
                ability.UseAbility(targetLocation);
                break;

            case Order.Ability:
                if (powerTreadsCondition)
                {
                    itemManager.PowerTreads.SwitchTo(Attribute.Intelligence);
                }
                ability.UseAbility();
                break;

            case Order.ToggleAbility:
                if (powerTreadsCondition && !itemManager.PowerTreads.DelaySwitch())
                {
                    itemManager.PowerTreads.SwitchTo(Attribute.Intelligence);
                }
                ability.ToggleAbility();
                break;
            }

            Sleeper.Sleep((float)sleep, "SwitchBackPT", true);
        }