/// <summary>
        ///     The track.
        /// </summary>
        /// <param name="args">
        ///     The args.
        /// </param>
        private void Track(EventArgs args)
        {
            if (this.Unit == null || !this.Unit.IsValid)
            {
                Drawing.OnDraw -= this.Track;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            if (this.Unit.NetworkActivity == this.lastUnitActivity)
            {
                return;
            }

            this.lastUnitActivity = this.Unit.NetworkActivity;
            if (!this.Unit.IsAttacking())
            {
                if (this.CanCancelAttack())
                {
                    return;
                }

                this.lastUnitActivity      = 0;
                this.nextUnitAttackEnd     = 0;
                this.nextUnitAttackRelease = 0;
                return;
            }

            this.nextUnitAttackEnd     = (float)(Utils.TickCount + UnitDatabase.GetAttackRate(this.Unit) * 1000);
            this.nextUnitAttackRelease = (float)(Utils.TickCount + UnitDatabase.GetAttackPoint(this.Unit) * 1000);
        }
        /// <summary>
        ///     The entity_ on int 32 property change.
        /// </summary>
        /// <param name="sender">
        ///     The sender.
        /// </param>
        /// <param name="args">
        ///     The args.
        /// </param>
        private void Entity_OnInt32PropertyChange(Entity sender, Int32PropertyChangeEventArgs args)
        {
            if (!sender.Equals(this.Unit) || args.PropertyName != "m_NetworkActivity")
            {
                return;
            }

            if (this.Unit == null || !this.Unit.IsValid)
            {
                Entity.OnInt32PropertyChange -= this.Entity_OnInt32PropertyChange;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            var newValue = (NetworkActivity)args.NewValue;
            var oldValue = (NetworkActivity)args.OldValue;

            if (newValue == this.lastUnitActivity || newValue == oldValue)
            {
                return;
            }

            var canCancel    = this.CanCancelAttack();
            var wasAttacking = false;

            if (!this.IsAttackOnCoolDown() || canCancel)
            {
                wasAttacking          = this.isAttacking;
                this.lastUnitActivity = newValue;
                this.isAttacking      = newValue == NetworkActivity.Attack || newValue == NetworkActivity.Crit ||
                                        newValue == NetworkActivity.Attack2 || newValue == NetworkActivity.AttackEvent ||
                                        newValue == NetworkActivity.AttackEventBash ||
                                        newValue == NetworkActivity.EarthshakerTotemAttack;
            }

            if (wasAttacking && canCancel && !this.isAttacking &&
                (oldValue == NetworkActivity.Attack || oldValue == NetworkActivity.Crit ||
                 oldValue == NetworkActivity.Attack2 || oldValue == NetworkActivity.AttackEvent ||
                 oldValue == NetworkActivity.AttackEventBash || oldValue == NetworkActivity.EarthshakerTotemAttack))
            {
                this.AttackEnd();
            }

            if (!this.isAttacking || (!this.isAttacking && !canCancel))
            {
                return;
            }

            this.LastUnitAttackStart = Game.RawGameTime;
            this.NextUnitAttackEnd   =
                (float)(this.LastUnitAttackStart * 1000 + UnitDatabase.GetAttackRate(this.Unit) * 1000);
            this.NextUnitAttackRelease =
                (float)(this.LastUnitAttackStart * 1000 + UnitDatabase.GetAttackPoint(this.Unit) * 1000);
            this.AttackOrderSent = false;
            this.AttackStart();
        }
        private void Track(EventArgs args)
        {
            if (Unit == null || !Unit.IsValid)
            {
                Events.OnUpdate -= Track;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            if (Unit.NetworkActivity == lastUnitActivity)
            {
                return;
            }

            lastUnitActivity = Unit.NetworkActivity;
            if (!Unit.IsAttacking())
            {
                if (CanCancelAttack())
                {
                    return;
                }

                lastUnitActivity      = 0;
                nextUnitAttackEnd     = 0;
                nextUnitAttackRelease = 0;
                return;
            }

            nextUnitAttackEnd     = (float)(Utils.TickCount + (UnitDatabase.GetAttackRate(Unit) * 1000));
            nextUnitAttackRelease = (float)(Utils.TickCount + (UnitDatabase.GetAttackPoint(Unit) * 1000));
        }
Пример #4
0
        /// <summary>
        ///     Returns delay before ability is casted
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        /// <param name="usePing"></param>
        /// <param name="useCastPoint"></param>
        /// <param name="abilityName"></param>
        /// <param name="useChannel"></param>
        /// <returns></returns>
        public static double GetCastDelay(
            this Ability ability,
            Hero source,
            Unit target,
            bool usePing       = false,
            bool useCastPoint  = true,
            string abilityName = null,
            bool useChannel    = false)
        {
            var name  = abilityName ?? ability.Name;
            var delay = 0d;

            if (useCastPoint)
            {
                if (!DelayDictionary.TryGetValue(name + " " + ability.Level, out delay))
                {
                    delay = Math.Max(ability.FindCastPoint(name), 0.07);
                    DelayDictionary.Add(name + " " + ability.Level, delay);
                }
                if (name == "templar_assassin_meld")
                {
                    delay += UnitDatabase.GetAttackPoint(source);
                }
                if ((name == "item_diffusal_blade" || name == "item_diffusal_blade_2"))
                {
                    delay += 2;
                }
            }
            else
            {
                if (ability is Item)
                {
                    delay = 0;
                }
                else
                {
                    delay = 0.05;
                }
            }
            if (usePing)
            {
                delay += Game.Ping / 1000;
            }
            if (useChannel)
            {
                delay += ability.ChannelTime(name);
            }
            if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
            {
                return
                    (Math.Max(
                         delay
                         + (!target.Equals(source)
                               ? (useCastPoint ? source.GetTurnTime(target) : source.GetTurnTime(target) / 2)
                               : 0),
                         0));
            }
            return(Math.Max(delay, 0));
        }
Пример #5
0
        private static void Orbwalk(
            Hero me,
            Unit target,
            float bonusWindupMs = 100,
            float bonusRange    = 0)
        {
            if (me == null)
            {
                return;
            }
            var targetHull = 0f;

            if (target != null)
            {
                targetHull = target.HullRadius;
            }
            float distance = 0;

            if (target != null)
            {
                var pos = Prediction.InFront(
                    me,
                    (float)((Game.Ping / 1000 + me.GetTurnTime(target.Position)) * me.MovementSpeed));
                distance = pos.Distance2D(target) - me.Distance2D(target);
            }
            var isValid = target != null && target.IsValid && target.IsAlive && target.IsVisible && !target.IsInvul() &&
                          !target.Modifiers.Any(
                x => x.Name == "modifier_ghost_state" || x.Name == "modifier_item_ethereal_blade_slow") &&
                          target.Distance2D(me)
                          <= (me.GetAttackRange() + me.HullRadius + 50 + targetHull + bonusRange + Math.Max(distance, 0));

            if (isValid || (target != null && me.IsAttacking() && me.GetTurnTime(target.Position) < 0.1))
            {
                var canAttack = !AttackOnCooldown(me, target, bonusWindupMs) &&
                                !target.IsAttackImmune() && !target.IsInvul() && me.CanAttack();
                if (canAttack && Utils.SleepCheck("!Orbwalk.Attack"))
                {
                    me.Attack(target);
                    Utils.Sleep(
                        UnitDatabase.GetAttackPoint(me) * 1000 + me.GetTurnTime(target) * 1000,
                        "!Orbwalk.Attack");
                    return;
                }
            }
            var canCancel = (CanCancelAnimation(me) && AttackOnCooldown(me, target, bonusWindupMs)) ||
                            (!isValid && !me.IsAttacking() && CanCancelAnimation(me));

            if (!canCancel || !Utils.SleepCheck("!Orbwalk.Move") || !Utils.SleepCheck("!Orbwalk.Attack"))
            {
                return;
            }
            if (target != null)
            {
                me.Move(target.Position);
            }
            Utils.Sleep(100, "!Orbwalk.Move");
        }
Пример #6
0
        private static bool CanCancelAnimation(Hero me, float delay = 0f)
        {
            int lastAttackStart;

            LastAttackStart.TryGetValue(me.Handle, out lastAttackStart);
            var time      = _tick - lastAttackStart;
            var cancelDur = UnitDatabase.GetAttackPoint(me) * 1000 - Game.Ping + 50 - delay;

            return(time > cancelDur);
        }
Пример #7
0
        private void OnUpdate(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused || !Menu.ArmletAutoToggle)
            {
                return;
            }

            if (!Hero.IsAlive || !Hero.CanUseItems())
            {
                return;
            }

            var nearEnemies =
                ObjectManager.GetEntitiesParallel <Unit>()
                .Where(
                    x =>
                    x.IsValid && x.IsAlive && x.IsSpawned && x.AttackCapability != AttackCapability.None &&
                    x.Team != HeroTeam && x.Distance2D(Hero) < x.GetAttackRange() + 200);

            foreach (var enemy in nearEnemies.Where(x => x.AttackCapability == AttackCapability.Melee))
            {
                if (enemy.IsAttacking() && !attackStart.Sleeping(enemy))
                {
                    attacking.Sleep((float)UnitDatabase.GetAttackPoint(enemy) * 1000, enemy);
                    attackStart.Sleep(enemy.AttacksPerSecond * 1000 - Game.Ping, enemy);
                }
                else if (!enemy.IsAttacking() && attackStart.Sleeping(enemy))
                {
                    attackStart.Reset(enemy);
                    attacking.Sleep((float)UnitDatabase.GetAttackBackswing(enemy) * 1000, enemy);
                }
            }

            if (Sleeper.Sleeping)
            {
                return;
            }

            var heroProjectiles =
                ObjectManager.TrackingProjectiles.Where(x => x?.Target is Hero && x.Target.Equals(Hero)).ToList();

            var noProjectile =
                heroProjectiles.All(
                    x =>
                    x.Position.Distance2D(Hero) / x.Speed > 0.30 ||
                    x.Position.Distance2D(Hero) / x.Speed < Game.Ping / 1000);

            var noAutoAttack = nearEnemies.All(x => x.FindRelativeAngle(Hero.Position) > 0.5 || !attacking.Sleeping(x));

            if (Hero.Health < Menu.ArmetHpThreshold && noProjectile && noAutoAttack &&
                (nearEnemies.Any() || heroProjectiles.Any()))
            {
                Use(null, null);
            }
        }
Пример #8
0
        private static void LastHit()
        {
            if (PossibleMinion != null)
            {
                var CheckTime = (int)(UnitDatabase.GetAttackPoint(LocalHero) * 1000 + PipLHMenu.Item("delay").GetValue <Slider>().Value + Game.Ping / 2 +
                                      LocalHero.GetTurnTime(PossibleMinion) * 1000 +
                                      1000 * Math.Max(0, LocalHero.Distance2D(PossibleMinion)) / FixProjSpeed.ProjSpeed(LocalHero));

                var predHealth = PredictedHealth(PossibleMinion, CheckTime);

                if (_debug)
                {
                    if (Utils.SleepCheck("PrintMyInfo"))
                    {
                        Game.PrintMessage("My attack point: " + UnitDatabase.GetAttackPoint(LocalHero) * 1000, MessageType.LogMessage);
                        Game.PrintMessage("My delay + Ping: " + PipLHMenu.Item("delay").GetValue <Slider>().Value + " - " + Game.Ping / 2, MessageType.LogMessage);
                        Game.PrintMessage("My turntime to creep: " + LocalHero.GetTurnTime(PossibleMinion) * 1000, MessageType.LogMessage);
                        Game.PrintMessage("My proj speed: " + FixProjSpeed.ProjSpeed(LocalHero), MessageType.LogMessage);
                        Game.PrintMessage("My proj arrival time: " + 1000 * Math.Max(0, LocalHero.Distance2D(PossibleMinion) / FixProjSpeed.ProjSpeed(LocalHero)), MessageType.LogMessage);
                        Game.PrintMessage("Total time: " + (int)(UnitDatabase.GetAttackPoint(LocalHero) * 1000 + PipLHMenu.Item("delay").GetValue <Slider>().Value + Game.Ping +
                                                                 LocalHero.GetTurnTime(PossibleMinion) * 1000 + 1000 * Math.Max(0, LocalHero.Distance2D(PossibleMinion) / FixProjSpeed.ProjSpeed(LocalHero))), MessageType.LogMessage);

                        Utils.Sleep(1000, "PrintMyInfo");
                    }
                }


                if (predHealth > 0 && predHealth <= GetPhysDamage(PossibleMinion))
                {
                    if (LocalHero.CanAttack())
                    {
                        LocalHero.Attack(PossibleMinion);
                    }
                }
                else
                {
                    if (PipLHMenu.Item("LHHold").GetValue <KeyBind>().Active&& lastMoveT + 80 < Environment.TickCount)
                    {
                        lastMoveT = Environment.TickCount;
                        LocalHero.Move(Game.MousePosition);
                    }
                }
            }
            else
            {
                if (PipLHMenu.Item("LHHold").GetValue <KeyBind>().Active&& lastMoveT + 80 < Environment.TickCount)
                {
                    lastMoveT = Environment.TickCount;
                    LocalHero.Move(Game.MousePosition);
                }
            }
        }
Пример #9
0
 public override void Check()
 {
     if (StartCast <= 0 && !attackSleeper.Sleeping && kunkka.IsAttacking() && Ability.CanBeCasted() &&
         AbilityOwner.IsVisible)
     {
         StartCast     = Game.RawGameTime;
         StartPosition = AbilityOwner.InFront(GetRadius());
         EndCast       = StartCast + (float)UnitDatabase.GetAttackPoint(kunkka);
         Obstacle      = Pathfinder.AddObstacle(StartPosition, GetRadius(), Obstacle);
         attackSleeper.Sleep(kunkka.AttacksPerSecond * 1000);
     }
     else if (StartCast > 0 && Game.RawGameTime > EndCast)
     {
         End();
     }
 }
Пример #10
0
        private static void LastHit(bool deny)
        {
            var PossibleMinion = (deny) ? (ObjectMgr.GetEntities <Creep>()
                                           .Where(creep => creep.IsAlive && creep.IsValid && me.Distance2D(creep) < me.GetAttackRange()).OrderBy(creep => creep.Health).DefaultIfEmpty(null).FirstOrDefault()) :
                                 (ObjectMgr.GetEntities <Creep>()
                                  .Where(creep => creep.IsAlive && creep.IsValid && creep.Team == me.GetEnemyTeam() && me.Distance2D(creep) < me.GetAttackRange()).OrderBy(creep => creep.Health).DefaultIfEmpty(null).FirstOrDefault());

            if (PossibleMinion != null)
            {
                var CheckTime = UnitDatabase.GetAttackPoint(me) * 1000 - CustomWaitTime + Game.Ping + me.GetTurnTime(PossibleMinion) * 1000 + Math.Max(0,
                                                                                                                                                       me.Distance2D(PossibleMinion) / UnitDatabase.GetProjectileSpeed(me) * 1000);

                var predHealth = PredictedHealth(PossibleMinion, (int)CheckTime);

                if (predHealth > 0 && predHealth <= GetPhysDamage(PossibleMinion))
                {
                    if (me.CanAttack())
                    {
                        me.Attack(PossibleMinion);
                    }
                }
                else
                {
                    if (LHHold.IsActive && lastMoveT + 80 < Environment.TickCount)
                    {
                        lastMoveT = Environment.TickCount;
                        me.Move(Game.MousePosition);
                    }
                }
            }
            else
            {
                if (LHHold.IsActive && lastMoveT + 80 < Environment.TickCount)
                {
                    lastMoveT = Environment.TickCount;
                    me.Move(Game.MousePosition);
                }
            }
        }
Пример #11
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                me = ObjectMgr.LocalHero;

                if (!Game.IsInGame || Game.IsWatchingGame || me == null || Game.IsChatOpen)
                {
                    return;
                }

                loaded     = true;
                toggleText = "(" + toggleKey + ") Last Hit: On";
            }

            if (me == null || !me.IsValid)
            {
                loaded = false;
                me     = ObjectMgr.LocalHero;
                active = false;
            }

            if (Game.IsPaused)
            {
                return;
            }

            if (Game.IsKeyDown(toggleKey) && Utils.SleepCheck("toggle") && !Game.IsChatOpen && !Game.IsPaused && !Game.IsWatchingGame)
            {
                if (!active)
                {
                    active     = true;
                    toggleText = "(" + toggleKey + ") Last Hit: On";
                }
                else
                {
                    active     = false;
                    toggleText = "(" + toggleKey + ") Last Hit: Off";
                }

                Utils.Sleep(200, "toggle");
            }

            aPoint = ((UnitDatabase.GetAttackPoint(me) * 100) / (1 + me.AttackSpeedValue)) * 1000;
            aRange = me.AttackRange;
            bonus  = 0;
            buffer = 0;

            if (me.ClassID == ClassID.CDOTA_Unit_Hero_Sniper)
            {
                var takeAim  = me.Spellbook.SpellE;
                var aimRange = new[] { 100, 200, 300, 400 };

                if (takeAim.AbilityState != AbilityState.NotLearned && takeAim.Level > 0)
                {
                    bonus = aimRange[takeAim.Level - 1];
                }
            }

            if (me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin)
            {
                var psyBlade = me.Spellbook.SpellE;
                var psyRange = new[] { 60, 120, 180, 240 };

                if (psyBlade.AbilityState != AbilityState.NotLearned && psyBlade.Level > 0)
                {
                    bonus = psyRange[psyBlade.Level - 1];
                }
            }

            if (me.ClassID == ClassID.CDOTA_Unit_Hero_Kunkka)
            {
                var Tide = me.Spellbook.SpellW;

                if (Tide.AbilityState != AbilityState.NotLearned && Tide.Level > 0)
                {
                    if (Tide.Cooldown == 0)
                    {
                        TideBringer = true;
                    }
                    else
                    {
                        TideBringer = false;
                    }
                }
            }

            attackRange = aRange + bonus;

            if (active && target != null)
            {
                if ((target.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane ||
                     target.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege ||
                     target.ClassID == ClassID.CDOTA_BaseNPC_Tower) &&
                    (target.IsAlive && target.IsVisible && target != null))
                {
                    if (qblade != null &&
                        (!(bfury != null || TideBringer || target.ClassID == ClassID.CDOTA_BaseNPC_Tower ||
                           target.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege)))
                    {
                        if (attackRange > 195)
                        {
                            damage = (float)(me.MinimumDamage * 1.15 + me.BonusDamage);
                        }
                        else
                        {
                            damage = (float)(me.MinimumDamage * 1.40 + me.BonusDamage);
                        }
                    }

                    if (bfury != null &&
                        !(TideBringer || target.ClassID == ClassID.CDOTA_BaseNPC_Tower ||
                          target.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege))
                    {
                        if (attackRange > 195)
                        {
                            damage = (float)(me.MinimumDamage * 1.25 + me.BonusDamage);
                        }
                        else
                        {
                            damage = (float)(me.MinimumDamage * 1.60 + me.BonusDamage);
                        }
                    }

                    if (me.ClassID == ClassID.CDOTA_Unit_Hero_AntiMage)
                    {
                        var Manabreak = me.Spellbook.SpellQ;
                        var Manaburn  = new[] { 28, 40, 52, 64 };

                        if (Manabreak.AbilityState != AbilityState.NotLearned && Manabreak.Level > 0 &&
                            ((Unit)target).MaximumMana > 0 && ((Unit)target).Mana > 0 &&
                            target.Team != me.Team)
                        {
                            damage = (float)(damage + Manaburn[Manabreak.Level - 1] * 0.60);
                        }
                    }

                    if (me.ClassID == ClassID.CDOTA_Unit_Hero_Viper)
                    {
                        var Nethertoxin = me.Spellbook.SpellW;
                        var ToxinDamage = new[] { 2.2, 4.7, 7.2, 9.7 };

                        if (Nethertoxin.AbilityState != AbilityState.NotLearned && Nethertoxin.Level > 0 &&
                            target.Team != me.Team)
                        {
                            var    HPcent       = (target.Health / target.MaximumHealth) * 100;
                            double Netherdamage = 0;
                            if (HPcent > 80 && HPcent <= 100)
                            {
                                Netherdamage = ToxinDamage[Nethertoxin.Level - 1] * 0.5;
                            }
                            else if (HPcent > 60 && HPcent <= 80)
                            {
                                Netherdamage = ToxinDamage[Nethertoxin.Level - 1];
                            }
                            else if (HPcent > 40 && HPcent <= 60)
                            {
                                Netherdamage = ToxinDamage[Nethertoxin.Level - 1] * 2;
                            }
                            else if (HPcent > 20 && HPcent <= 40)
                            {
                                Netherdamage = ToxinDamage[Nethertoxin.Level - 1] * 4;
                            }
                            else if (HPcent > 0 && HPcent <= 20)
                            {
                                Netherdamage = ToxinDamage[Nethertoxin.Level - 1] * 8;
                            }
                            damage = (float)(damage + Netherdamage);
                        }
                    }

                    if (me.ClassID == ClassID.CDOTA_Unit_Hero_Ursa &&
                        !(target.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege ||
                          target.ClassID == ClassID.CDOTA_BaseNPC_Tower))
                    {
                        var Furyswipes = me.Spellbook.SpellE;
                        var Furybuff   =
                            ((Unit)target).Modifiers.Where(
                                x => x.Name == "modifier_ursa_fury_swipes_damage_increase").ToList();
                        var Furydamage = new[] { 15, 20, 25, 30 };

                        if (Furyswipes.Level > 0 && target.Team != me.Team)
                        {
                            if (Furybuff.Any())
                            {
                                damage = damage + Furydamage[Furyswipes.Level - 1] * (Furybuff.Count);
                            }
                            else
                            {
                                damage = damage + Furydamage[Furyswipes.Level - 1];
                            }
                        }
                    }

                    if (me.ClassID == ClassID.CDOTA_Unit_Hero_BountyHunter &&
                        !(target.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege ||
                          target.ClassID == ClassID.CDOTA_BaseNPC_Tower))
                    {
                        var jinada       = me.Spellbook.SpellW;
                        var jinadaDamage = new[] { 1.5, 1.75, 2, 2.25 };

                        if (jinada.AbilityState != AbilityState.NotLearned && jinada.Level > 0 &&
                            jinada.Cooldown == 0 && target.Team != me.Team)
                        {
                            damage = (float)(damage * (jinadaDamage[jinada.Level - 1]));
                        }
                    }

                    if (me.ClassID == ClassID.CDOTA_Unit_Hero_Weaver)
                    {
                        var gem = me.Spellbook.SpellE;

                        if (gem.AbilityState != AbilityState.NotLearned && gem.Level > 0 && gem.Cooldown == 0)
                        {
                            damage = (float)(damage * 1.8);
                        }
                    }

                    if ((me.ClassID == ClassID.CDOTA_Unit_Hero_SkeletonKing ||
                         me.ClassID == ClassID.CDOTA_Unit_Hero_ChaosKnight) &&
                        me.NetworkActivity == NetworkActivity.Crit &&
                        target.ClassID != ClassID.CDOTA_BaseNPC_Tower)
                    {
                        var critabil = me.Spellbook.SpellE;
                        var critmult = new[] { 1.5, 2, 2.5, 3 };

                        if (critabil.AbilityState != AbilityState.NotLearned && critabil.Level > 0 &&
                            target.Team != me.Team)
                        {
                            damage = (float)(damage * (critmult[critabil.Level - 1]));
                        }
                    }

                    if ((me.ClassID == ClassID.CDOTA_Unit_Hero_Juggernaut ||
                         me.ClassID == ClassID.CDOTA_Unit_Hero_Brewmaster) &&
                        me.NetworkActivity == NetworkActivity.Crit &&
                        target.ClassID != ClassID.CDOTA_BaseNPC_Tower)
                    {
                        var jugcrit = me.Spellbook.SpellE;

                        if (jugcrit.AbilityState != AbilityState.NotLearned && jugcrit.Level > 0 &&
                            target.Team != me.Team)
                        {
                            damage = damage * 2;
                        }
                    }

                    if (me.ClassID == ClassID.CDOTA_Unit_Hero_PhantomAssassin &&
                        me.NetworkActivity == NetworkActivity.Crit &&
                        target.ClassID != ClassID.CDOTA_BaseNPC_Tower)
                    {
                        var pacrit = me.Spellbook.SpellR;
                        var pamod  = new[] { 2.3, 3.4, 4.5 };

                        if (pacrit.AbilityState != AbilityState.NotLearned && pacrit.Level > 0 &&
                            target.Team != me.Team)
                        {
                            damage = (float)(damage * (pamod[pacrit.Level - 1]));
                        }
                    }

                    if (me.ClassID == ClassID.CDOTA_Unit_Hero_Riki &&
                        (target.ClassID != ClassID.CDOTA_BaseNPC_Creep_Siege ||
                         target.ClassID != ClassID.CDOTA_BaseNPC_Tower))
                    {
                        if ((me.Rotation + 180 > target.Rotation + 180 - (220 / 2) &&
                             me.Rotation + 180 < target.Rotation + 180 + (220 / 2)) &&
                            me.Spellbook.SpellE.Level > 0)
                        {
                            damage = (float)(damage + me.TotalAgility * (me.Spellbook.SpellE.Level * 0.25 + 0.25));
                        }
                    }

                    if (target.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege ||
                        target.ClassID == ClassID.CDOTA_BaseNPC_Tower)
                    {
                        damage = damage / 2;
                    }

                    if (target.Team == me.Team && qblade != null &&
                        target.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane)
                    {
                        damage = me.MinimumDamage + me.BonusDamage;
                    }

                    toggleText = "(" + toggleKey + ") Last Hit: ON | Target HP = " + target.Health +
                                 "| Damage = " +
                                 ((Unit)target).DamageTaken(damage, DamageType.Physical, me) + "";

                    if ((((target.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane ||
                           target.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege) &&
                          me.Distance2D(target) <= attackRange + 100) ||
                         (target.ClassID == ClassID.CDOTA_BaseNPC_Tower &&
                          me.Distance2D(target) <= attackRange + 300)) &&
                        (target.Health >
                         ((Unit)target).DamageTaken(damage, DamageType.Physical, me)))
                    {
                        if (Utils.SleepCheck("stop"))
                        {
                            if (me.ClassID == ClassID.CDOTA_Unit_Hero_Bristleback)
                            {
                                Utils.Sleep(aPoint * 0.80 + Game.Ping, "stop");
                            }
                            else
                            {
                                Utils.Sleep(aPoint + Game.Ping, "stop");
                            }
                            me.Hold();
                            me.Attack((Unit)target);
                        }
                    }
                    else if (target.Health <
                             ((Unit)target).DamageTaken(damage, DamageType.Physical, me) &&
                             Utils.SleepCheck("StopIt"))
                    {
                        me.Attack((Unit)target);
                        Utils.Sleep(250, "StopIt");
                    }
                }
            }
        }
Пример #12
0
        /// <summary>
        ///     The orbwalk.
        /// </summary>
        /// <param name="target">
        ///     The target.
        /// </param>
        /// <param name="movePosition">
        ///     The move Position.
        /// </param>
        /// <param name="bonusWindupMs">
        ///     The bonus windup ms.
        /// </param>
        /// <param name="bonusRange">
        ///     The bonus range.
        /// </param>
        /// <param name="attackmodifiers">
        ///     The attackmodifiers.
        /// </param>
        /// <param name="followTarget">
        ///     The follow target.
        /// </param>
        public void OrbwalkOn(
            Unit target,
            Vector3 movePosition,
            float bonusWindupMs  = 0,
            float bonusRange     = 0,
            bool attackmodifiers = true,
            bool followTarget    = false)
        {
            if (this.Unit == null || !this.Unit.IsValid)
            {
                return;
            }

            var targetHull = 0f;

            if (target != null)
            {
                targetHull = target.HullRadius;
            }

            float distance = 0;

            if (target != null)
            {
                var pos = Prediction.InFront(
                    this.Unit,
                    (float)(Game.Ping / 1000 + this.Unit.GetTurnTime(target.Position) * this.Unit.MovementSpeed));
                distance = pos.Distance2D(target) - this.Unit.Distance2D(target);
            }

            var isValid      = target != null && target.IsValid && target.IsAlive && target.IsVisible;
            var isAttackable = target != null && target.IsValid && !target.IsInvul() && !target.IsAttackImmune() &&
                               !target.HasModifiers(
                new[] { "modifier_ghost_state", "modifier_item_ethereal_blade_slow" },
                false) &&
                               target.Distance2D(this.Unit)
                               <= this.Unit.GetAttackRange() + this.Unit.HullRadius + 50 + targetHull + bonusRange
                               + Math.Max(distance, 0);

            if ((isValid && isAttackable) ||
                (!isAttackable && target != null && target.IsValid && this.Unit.IsAttacking() &&
                 this.Unit.GetTurnTime(target.Position) < 0.1))
            {
                var canAttack = !this.IsAttackOnCoolDown(target, bonusWindupMs) && this.Unit.CanAttack();
                if (canAttack && !this.attackSleeper.Sleeping && (!this.hero || Utils.SleepCheck("Orbwalk.Attack")))
                {
                    this.attacker.Attack(target, attackmodifiers);
                    this.AttackOrder();
                    this.attackSleeper.Sleep(
                        (float)
                        (UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000
                         + Game.Ping + 100));
                    this.moveSleeper.Sleep(
                        (float)
                        (UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000 + 50));
                    if (!this.hero)
                    {
                        return;
                    }

                    Utils.Sleep(
                        UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000 + Game.Ping
                        + 100,
                        "Orbwalk.Attack");
                    Utils.Sleep(
                        UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000 + 50,
                        "Orbwalk.Move");
                    return;
                }

                if (canAttack && !this.attackSleeper2.Sleeping)
                {
                    this.attacker.Attack(target, attackmodifiers);
                    this.AttackOrder();
                    this.attackSleeper2.Sleep(100);
                    return;
                }
            }

            var userdelay = this.setUserDelayManually ? this.UserDelay : UserDelay;
            var canCancel = (this.CanCancelAttack(userdelay) && this.IsAttackOnCoolDown(target, bonusWindupMs)) ||
                            ((!isValid || !isAttackable) &&
                             (!this.Unit.IsAttacking() || this.CanCancelAttack(userdelay)));

            if (!canCancel || this.moveSleeper.Sleeping || this.attackSleeper.Sleeping ||
                (this.hero && (!Utils.SleepCheck("Orbwalk.Move") || !Utils.SleepCheck("Orbwalk.Attack"))))
            {
                return;
            }

            if (followTarget && target != null)
            {
                var pos = target.NetworkActivity == NetworkActivity.Move
                              ? target.Predict(Game.Ping + 100)
                              : target.Position;
                this.Unit.Move(pos);
                this.customMovePosition = true;
                this.lastMovePosition   = pos;
            }
            else
            {
                this.Unit.Move(movePosition);
                if (movePosition != Game.MousePosition)
                {
                    this.customMovePosition = true;
                    this.lastMovePosition   = movePosition;
                }
                else
                {
                    this.customMovePosition = false;
                }
            }

            this.moveSleeper.Sleep(100);
        }
Пример #13
0
        public void Lane(Meepo me)
        {
            var handle         = me.Handle;
            var creeps         = Creeps.All.Where(x => x != null && x.IsValid && x.IsAlive && x.IsVisible).ToList();
            var creepsEnemy    = creeps.Where(x => x.Team != me.Team).ToList();
            var creepsAlly     = creeps.Where(x => x.Team == me.Team).ToList();
            var enemyHeroes    = Heroes.GetByTeam(me.GetEnemyTeam()).Where(x => x.IsAlive).ToList();
            var towers         = Towers.all.Where(x => x.Team != me.Team).Where(x => x.IsAlive).ToList();
            var creepWithEnemy =
                creepsAlly.FirstOrDefault(
                    x => x.MaximumHealth * 65 / 100 < x.Health && creepsEnemy.Any(y => y.Distance2D(x) <= 1000));
            var travelBoots = me.FindItem("item_travel_boots") ?? me.FindItem("item_travel_boots_2");

            if (travelBoots != null && creepWithEnemy != null && Variables.MenuManager.LanePushMenu.Item("AutoPush.TravelBoots").GetValue <bool>() && Utils.SleepCheck("TravelBoots." + handle))
            {
                if (travelBoots.CanBeCasted() && !creepsEnemy.Any(x => x.Distance2D(me) <= 1000))
                {
                    travelBoots.UseAbility(creepWithEnemy);
                    Utils.Sleep(500, "TravelBoots." + handle);
                    return;
                }
            }

            var nearestTower =
                towers.OrderBy(y => y.Distance2D(me))
                .FirstOrDefault() ?? Fountain.GetEnemyFountain();
            var fountain    = Fountain.GetAllyFountain();
            var curlane     = GetCurrentLane(me);
            var clospoint   = GetClosestPoint(curlane);
            var useThisShit = clospoint.Distance2D(fountain) - 250 > me.Distance2D(fountain);
            var name        = Variables.MeepoSet.Find(x => x.Handle == me.Handle).Handle.ToString();

            if (nearestTower != null && Utils.SleepCheck(name + "attack"))
            {
                var pos  = curlane == "mid" || !useThisShit ? nearestTower.Position : clospoint;
                var dist = Variables.MenuManager.LanePushMenu.Item("AutoPush.EscapeRange").GetValue <Slider>().Value;
                if (Variables.MenuManager.LanePushMenu.Item("AutoPush.EscapeFromAnyEnemyHero").GetValue <bool>() &&
                    enemyHeroes.Any(x => x.Distance2D(me) <= dist)) //escape from hero
                {
                    Variables.OrderStates[handle] = Variables.OrderState.Escape;
                    Variables.NeedHeal[handle]    = true;
                }
                else if (creepsAlly.Any(x => x.Distance2D(nearestTower) <= 800) ||
                         me.Distance2D(nearestTower) > 800)
                {
                    //under tower
                    var hpwasChanged = CheckForChangedHealth(me);
                    if (hpwasChanged)
                    {
                        var allyCreep = creepsAlly.OrderBy(x => x.Distance2D(me)).First();
                        if (allyCreep != null)
                        {
                            var towerPos = nearestTower.Position;
                            var ang      = allyCreep.FindAngleBetween(towerPos, true);
                            var p        = new Vector3((float)(allyCreep.Position.X - 250 * Math.Cos(ang)),
                                                       (float)(allyCreep.Position.Y - 250 * Math.Sin(ang)), 0);
                            me.Move(p);
                            me.Attack(allyCreep, true);
                            Utils.Sleep(1200, name + "attack");
                        }
                        else
                        {
                            var towerPos = nearestTower.Position;
                            var ang      = me.FindAngleBetween(towerPos, true);
                            var p        = new Vector3((float)(towerPos.X - 1250 * Math.Cos(ang)),
                                                       (float)(towerPos.Y - 1250 * Math.Sin(ang)), 0);
                            me.Move(p);
                            Utils.Sleep(500, name + "attack");
                        }
                    }
                    else
                    {
                        var act = me.NetworkActivity;
                        if (!Utils.SleepCheck("attack_time" + name))
                        {
                            return;
                        }

                        if (Variables.MenuManager.LanePushMenu.Item("AutoPush.LastHitMode").GetValue <bool>())
                        {
                            var bestEnemyCreep =
                                creepsEnemy.Where(x => x.Health < me.DamageAverage && x.Distance2D(me) <= 800)
                                .OrderBy(x => x.Distance2D(me))
                                .FirstOrDefault();
                            if (bestEnemyCreep != null)
                            {
                                me.Attack(bestEnemyCreep);
                                Utils.Sleep(UnitDatabase.GetAttackPoint(me) * 1000, "attack_time" + name);
                            }
                            else
                            {
                                /*if (act == NetworkActivity.Attack || act == NetworkActivity.Attack2)
                                 * {
                                 *  me.Stop();
                                 * }*/
                                if (act == NetworkActivity.Idle)
                                {
                                    me.Attack(pos);
                                }
                            }
                        }
                        else
                        {
                            if (act == NetworkActivity.Idle)
                            {
                                me.Attack(pos);
                            }
                        }

                        if (Variables.MenuManager.LanePushMenu.Item("AutoPush.AutoW").GetValue <bool>() && Variables.poofList[handle] != null)
                        {
                            var w         = Variables.poofList[handle];
                            var castRange = w.GetRealCastRange();
                            if (w.CanBeCasted() &&
                                creepsEnemy.Any(x => x.Distance2D(me) <= castRange && x.Health <= 60 + 20 * w.Level) &&
                                Utils.SleepCheck("w_push" + name))
                            {
                                w.Use(me);
                                Utils.Sleep(250, "w_push" + name);
                            }
                        }
                    }
                    Utils.Sleep(100, name + "attack");
                }
                else
                {
                    var towerPos = nearestTower.Position;
                    var ang      = me.FindAngleBetween(towerPos, true);
                    var p        = new Vector3((float)(me.Position.X - 1000 * Math.Cos(ang)),
                                               (float)(me.Position.Y - 1000 * Math.Sin(ang)), 0);
                    me.Move(p);
                    Utils.Sleep(200, name + "attack");
                }
            }
        }
Пример #14
0
        /// <summary>
        ///     The orbwalk.
        /// </summary>
        /// <param name="target">
        ///     The target.
        /// </param>
        /// <param name="movePosition">
        ///     The move Position.
        /// </param>
        /// <param name="bonusWindupMs">
        ///     The bonus windup ms.
        /// </param>
        /// <param name="bonusRange">
        ///     The bonus range.
        /// </param>
        /// <param name="attackmodifiers">
        ///     The attackmodifiers.
        /// </param>
        /// <param name="followTarget">
        ///     The follow target.
        /// </param>
        public void OrbwalkOn(
            Unit target,
            Vector3 movePosition,
            float bonusWindupMs  = 0,
            float bonusRange     = 0,
            bool attackmodifiers = true,
            bool followTarget    = false)
        {
            if (Unit == null || !Unit.IsValid)
            {
                return;
            }

            var targetHull = 0f;

            if (target != null)
            {
                targetHull = target.HullRadius;
            }

            float distance = 0;

            if (target != null)
            {
                var pos = Prediction.InFront(
                    Unit,
                    (float)((Game.Ping / 1000) + (Unit.GetTurnTime(target.Position) * Unit.MovementSpeed)));
                distance = pos.Distance2D(target) - Unit.Distance2D(target);
            }

            var isValid = target != null && target.IsValid && target.IsAlive && target.IsVisible && !target.IsInvul() &&
                          !target.HasModifiers(
                new[] { "modifier_ghost_state", "modifier_item_ethereal_blade_slow" },
                false) &&
                          target.Distance2D(Unit)
                          <= Unit.GetAttackRange() + Unit.HullRadius + 50 + targetHull + bonusRange
                          + Math.Max(distance, 0);

            if (isValid || (target != null && Unit.IsAttacking() && Unit.GetTurnTime(target.Position) < 0.1))
            {
                var canAttack = CanAttack(target, bonusWindupMs) && !target.IsAttackImmune() && !target.IsInvul() &&
                                Unit.CanAttack();
                if (canAttack && !attackSleeper.Sleeping && (!hero || Utils.SleepCheck("Orbwalk.Attack")))
                {
                    attacker.Attack(target, attackmodifiers);
                    attackSleeper.Sleep(
                        (float)
                        ((UnitDatabase.GetAttackPoint(Unit) * 1000) + (Unit.GetTurnTime(target) * 1000)
                         + Game.Ping + 100));
                    moveSleeper.Sleep(
                        (float)
                        ((UnitDatabase.GetAttackPoint(Unit) * 1000) + (Unit.GetTurnTime(target) * 1000) + 50));
                    if (!hero)
                    {
                        return;
                    }

                    Utils.Sleep(
                        (UnitDatabase.GetAttackPoint(Unit) * 1000) + (Unit.GetTurnTime(target) * 1000)
                        + Game.Ping + 100,
                        "Orbwalk.Attack");
                    Utils.Sleep(
                        (UnitDatabase.GetAttackPoint(Unit) * 1000) + (Unit.GetTurnTime(target) * 1000) + 50,
                        "Orbwalk.Move");
                    return;
                }

                if (canAttack && !attackSleeper2.Sleeping)
                {
                    attacker.Attack(target, attackmodifiers);
                    attackSleeper2.Sleep(100);
                    return;
                }
            }

            var canCancel = (CanCancelAttack() && !CanAttack(target, bonusWindupMs)) ||
                            (!isValid && !Unit.IsAttacking() && CanCancelAttack());

            if (!canCancel || moveSleeper.Sleeping || attackSleeper.Sleeping ||
                (hero && (!Utils.SleepCheck("Orbwalk.Move") || !Utils.SleepCheck("Orbwalk.Attack"))))
            {
                return;
            }

            if (followTarget)
            {
                Unit.Follow(target);
            }
            else
            {
                Unit.Move(movePosition);
            }

            moveSleeper.Sleep(100);
        }
Пример #15
0
 /// <summary>
 ///     The attack point.
 /// </summary>
 /// <param name="unit">
 ///     The unit.
 /// </param>
 /// <returns>
 ///     The <see cref="double" />.
 /// </returns>
 public static double AttackPoint(this Unit unit)
 {
     return(UnitDatabase.GetAttackPoint(unit));
 }
Пример #16
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                me = ObjectMgr.LocalHero;

                if (!Game.IsInGame || Game.IsWatchingGame || me == null || Game.IsChatOpen)
                {
                    return;
                }

                loaded = true;
            }

            if (me == null || !me.IsValid)
            {
                loaded = false;
                me     = ObjectMgr.LocalHero;
                active = false;
            }

            if (Game.IsPaused)
            {
                return;
            }

            if (Game.IsKeyDown(toggleKey) && Utils.SleepCheck("toggle"))
            {
                if (!active)
                {
                    active     = true;
                    toggleText = "(" + toggleKey + ") Last Hit: On";
                }
                else
                {
                    active     = false;
                    toggleText = "(" + toggleKey + ") Last Hit: Off";
                }

                Utils.Sleep(200, "toggle");
            }

            aPoint = ((UnitDatabase.GetAttackPoint(me) * 100) / (1 + me.AttackSpeedValue)) * 1000;
            aRange = me.AttackRange;
            bonus  = 0;
            buffer = 0;

            if (me.ClassID == ClassID.CDOTA_Unit_Hero_Sniper)
            {
                var takeAim  = me.Spellbook.SpellE;
                var aimRange = new[] { 100, 200, 300, 400 };

                if (takeAim.AbilityState != AbilityState.NotLearned && takeAim.Level > 0)
                {
                    bonus = aimRange[takeAim.Level - 1];
                }
            }

            if (me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin)
            {
                var psyBlade = me.Spellbook.SpellE;
                var psyRange = new[] { 60, 120, 180, 240 };

                if (psyBlade.AbilityState != AbilityState.NotLearned && psyBlade.Level > 0)
                {
                    bonus = psyRange[psyBlade.Level - 1];
                }
            }

            if (me.ClassID == ClassID.CDOTA_Unit_Hero_Kunkka)
            {
                var Tide = me.Spellbook.SpellW;

                if (Tide.AbilityState != AbilityState.NotLearned && Tide.Level > 0)
                {
                    if (Tide.Cooldown == 0)
                    {
                        TideBringer = true;
                    }
                    else
                    {
                        TideBringer = false;
                    }
                }
            }

            attackRange = aRange + bonus;
        }
Пример #17
0
 /// <summary>
 ///     The attack point.
 /// </summary>
 /// <param name="hero">
 ///     The hero.
 /// </param>
 /// <returns>
 ///     The <see cref="double" />.
 /// </returns>
 public static double AttackPoint(this Hero hero)
 {
     return(UnitDatabase.GetAttackPoint(hero));
 }