private async Task SetBootsAttributeAsync(PowerTreads boots, Ensage.Attribute targetAttribute)
        {
            if (boots.ActiveAttribute == targetAttribute || _isSwitching)
            {
                return;
            }

            while (boots.ActiveAttribute != targetAttribute)
            {
                if (_hero.IsInvisible() && _hero.HeroId != HeroId.npc_dota_hero_riki)
                {
                    _isSwitching = false;
                    break;
                }
                _isSwitching = true;
                boots.UseAbility();
                await Task.Delay(_configs.SwitchingSpeed.Value + (_configs.RandomizeSwitches ? _random.Next(5, 50) : 0)); //Randomize this a bit..
            }
            _isSwitching = false;
        }
Ejemplo n.º 2
0
        private static void ChangePowerTreads(Attribute attribute, bool switchBack = true, bool healing = false)
        {
            if (powerTreads == null)
            {
                return;
            }

            healActive = healing;

            if (hero.IsChanneling() || hero.IsInvisible() || !hero.CanUseItems())
            {
                return;
            }

            var ptNow = 0;
            var ptTo  = 0;

            switch (powerTreads.ActiveAttribute)
            {
            case Attribute.Strength:
                ptNow = 1;
                break;

            case Attribute.Agility:     // int
                ptNow = 2;
                break;

            case Attribute.Intelligence:     // agi
                ptNow = 3;
                break;
            }

            switch (attribute)
            {
            case Attribute.Strength:
                ptTo = 1;
                break;

            case Attribute.Intelligence:
                ptTo = 2;
                break;

            case Attribute.Agility:
                ptTo = 3;
                break;
            }

            if (ptNow == ptTo)
            {
                return;
            }

            var change = ptTo - ptNow % 3;

            if (ptNow == 2 && ptTo == 1) // random fix
            {
                change = 2;
            }

            ptChanged = switchBack;

            for (var i = 0; i < change; i++)
            {
                powerTreads.UseAbility();
            }
        }
Ejemplo n.º 3
0
        public static void SwitchTo(Attribute attribute, bool switchBack = true)
        {
            if (powerTreads == null)//another check
            {
                return;
            }

            if (me.IsChanneling() || !me.CanUseItems() || me.HasModifiers(new[]
            {
                "modifier_clinkz_shadow_walk", "modifier_item_smoke_of_deceit",
            }, false))
            {
                return;//Just for the PlayerOnExecute
            }

            /* and do this fo each attribute, Or now != next need to think of something better
             * if (Treads.ActiveAttribute != Ensage.Attribute.Agility)
             * {
             *   if (Treads.ActiveAttribute == Ensage.Attribute.Strength)
             *      {
             *       Treads.UseAbility();
             *       Treads.UseAbility();
             *      }
             *       else
             *      {
             *      Treads.UseAbility();
             *      }
             *     }
             */
            var now  = 0;
            var next = 0;

            if (powerTreads.ActiveAttribute != Attribute.Strength)
            {
                if (powerTreads.ActiveAttribute != Attribute.Agility)
                {
                    if (powerTreads.ActiveAttribute == Attribute.Intelligence)
                    {
                        now = 2;
                    }
                }
                else
                {
                    now = 3;
                }
            }
            else
            {
                now = 1;
            }

            if (attribute != Attribute.Strength)
            {
                if (attribute != Attribute.Intelligence)
                {
                    if (attribute == Attribute.Agility)
                    {
                        next = 3;
                    }
                }
                else
                {
                    next = 2;
                }
            }
            else
            {
                next = 1;
            }

            if (now == next)
            {
                return;
            }

            var change = next - now % 3;

            if (now == 2 && next == 1)
            {
                change = 2;
            }

            int i;

            for (i = 0; i < change; i++)
            {
                powerTreads.UseAbility();
            }
        }