ClosestToMouse() public static method

public static ClosestToMouse ( Hero source, float range = 600 ) : Hero
source Hero
range float
return Hero
Exemplo n.º 1
0
        private static async Task Action(CancellationToken cancellationToken)
        {
            if (IsComboHero)
            {
                if (!IsComboHero)
                {
                    if (_globalTarget != null)
                    {
                        Helper.UnHandleEffect(_globalTarget);
                    }
                    _globalTarget = null;
                    return;
                }
                if (_globalTarget == null || !_globalTarget.IsValid)
                {
                    _globalTarget = Helper.ClosestToMouse(Members.MyHero);
                    return;
                }

                if (Members.MyHero.IsChanneling())
                {
                    return;
                }

                await DoTrash(_globalTarget, cancellationToken);

                await Task.Delay(50, cancellationToken);

                Printer.Print("rdy for rearm!");
                var rearm = Abilities.FindAbility("tinker_rearm");
                if (rearm.CanBeCasted())
                {
                    rearm?.UseAbility();
                    var time = (int)(GetRearmTime(rearm) + Game.Ping + rearm.FindCastPoint() * 1000);
                    Printer.Print("rearm!");
                    Log.Debug("Rearm: " + time);
                    await Task.Delay(time, cancellationToken);

                    return;
                }
                if (AutoAttack)
                {
                    if (UseOrbWalkker)
                    {
                        Orbwalking.Orbwalk(_globalTarget, followTarget: true);
                    }
                    else if (!Members.MyHero.IsAttacking() && !_attacker.Sleeping && !_globalTarget.IsAttackImmune())
                    {
                        Members.MyHero.Attack(_globalTarget);
                        _attacker.Sleep(250);
                    }
                }
            }
            else
            {
                if (_globalTarget != null)
                {
                    Helper.UnHandleEffect(_globalTarget);
                }
                _globalTarget = null;
            }


            await Task.Delay(100, cancellationToken);
        }
Exemplo n.º 2
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!IsEnable)
            {
                return;
            }
            if (!Members.MyHero.IsAlive)
            {
                return;
            }
            //CalculateDamage();
            if (_attacker == null)
            {
                _attacker = new Sleeper();
            }
            if (_spellSleeper == null)
            {
                _spellSleeper = new MultiSleeper();
            }
            if (_ethereal == null)
            {
                _ethereal = new Sleeper();
            }
            var laser   = Abilities.FindAbility("tinker_laser");
            var rockets = Abilities.FindAbility("tinker_heat_seeking_missile");

            if (_spellSleeper.Sleeping(Abilities.FindAbility("tinker_rearm")))
            {
                return;
            }

            /*var data = _laser.AbilitySpecialData;
             * var dmg = _laser.GetAbilityData("laser_damage", 1);
             * Console.WriteLine($"dmg: {dmg}");
             * foreach (var abilitySpecialData in data.Where(x=>x.IsSpellDamageValue))
             * {
             *  Console.WriteLine($"{abilitySpecialData.Name}: {abilitySpecialData.GetValue(_laser.Level-1)}");
             * }
             * Console.WriteLine($"Laser: {_laser.GetDamage(0)}/{_laser.GetDamage(1)}/{_laser.GetDamage(2)}/{_laser.GetDamage(3)}");*/
            if (IsEnableKillSteal && !IsComboHero)
            {
                foreach (var x in Heroes.GetByTeam(Members.MyHero.GetEnemyTeam())
                         .Where(x => x.IsAlive && x.IsVisible && !x.IsIllusion() && !x.IsMagicImmune())
                         .Where(x => Helper.CalculateMyCurrentDamage(x, true) < 0))
                {
                    CastCombo(x, laser, rockets, true);
                }
            }

            if (!IsComboHero)
            {
                if (_globalTarget != null)
                {
                    Helper.UnHandleEffect(_globalTarget);
                }
                _globalTarget = null;
                return;
            }
            if (_globalTarget == null || !_globalTarget.IsValid)
            {
                _globalTarget = Helper.ClosestToMouse(Members.MyHero);
                return;
            }
            Helper.HandleEffect(_globalTarget);
            if (Members.MyHero.IsChanneling() || _globalTarget.Distance2D(Members.MyHero) > 2500)
            {
                return;
            }
            if (AutoAttack)
            {
                if (UseOrbWalkker)
                {
                    Orbwalking.Orbwalk(_globalTarget, followTarget: true);
                }
                else if (!Members.MyHero.IsAttacking() && !_attacker.Sleeping && !_globalTarget.IsAttackImmune())
                {
                    Members.MyHero.Attack(_globalTarget);
                    _attacker.Sleep(250);
                }
            }
            CastCombo(_globalTarget, laser, rockets);
        }
Exemplo n.º 3
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!IsEnable)
            {
                return;
            }
            if (!Members.MyHero.IsAlive)
            {
                return;
            }
            //CalculateDamage();
            if (_attacker == null)
            {
                _attacker = new Sleeper();
            }
            if (_spellSleeper == null)
            {
                _spellSleeper = new MultiSleeper();
            }
            if (_ethereal == null)
            {
                _ethereal = new Sleeper();
            }
            var laser   = Abilities.FindAbility("tinker_laser");
            var rockets = Abilities.FindAbility("tinker_heat_seeking_missile");

            if (_spellSleeper.Sleeping(Abilities.FindAbility("tinker_rearm")))
            {
                return;
            }
            if (IsEnableKillSteal && !IsComboHero)
            {
                foreach (var x in Heroes.GetByTeam(Members.MyHero.GetEnemyTeam())
                         .Where(x => x.IsAlive && x.IsVisible && !x.IsIllusion() && !x.IsMagicImmune())
                         .Where(x => Helper.CalculateMyCurrentDamage(x, true) < 0))
                {
                    CastCombo(x, laser, rockets, true);
                }
            }

            if (!IsComboHero)
            {
                if (_globalTarget != null)
                {
                    Helper.UnHandleEffect(_globalTarget);
                }
                _globalTarget = null;
                return;
            }
            if (_globalTarget == null || !_globalTarget.IsValid)
            {
                _globalTarget = Helper.ClosestToMouse(Members.MyHero);
                return;
            }
            Helper.HandleEffect(_globalTarget);
            if (Members.MyHero.IsChanneling() || _globalTarget.Distance2D(Members.MyHero) > 2500)
            {
                return;
            }
            if (AutoAttack)
            {
                if (UseOrbWalkker)
                {
                    Orbwalking.Orbwalk(_globalTarget, followTarget: true);
                }
                else if (!Members.MyHero.IsAttacking() && !_attacker.Sleeping && !_globalTarget.IsAttackImmune())
                {
                    Members.MyHero.Attack(_globalTarget);
                    _attacker.Sleep(250);
                }
            }
            CastCombo(_globalTarget, laser, rockets);
        }