Exemple #1
0
        private void AutoSaveUpdater()
        {
            if (localHero.HealthPercent() > (float)minHpPercentForSave.Value / 100)
            {
                return;
            }

            var isFacingFountain = localHero.InFront(localHero.Distance2D(myFountain)).Distance2D(myFountain.Position) < 500;

            if (!localHero.IsEnchanted() && enchant.CanBeCasted())
            {
                if (isFacingFountain)
                {
                    enchant.UseAbility(localHero);
                }
                else
                {
                    localHero.MoveToDirection(localHero.Position.Extend(myFountain.Position, 400));
                }
                return;
            }

            if (smash.CanBeCasted() && localHero.IsEnchanted() && isFacingFountain)
            {
                smash.Base.Cast();
            }
        }
        private void IngameUpdate()
        {
            if (!smash.CanBeCasted() || sleeper.Sleeping)
            {
                return;
            }

            var target = EntityManager.GetEntities <Hero>().FirstOrDefault(x => x.Distance2D(localHero) < 300 &&
                                                                           x.IsAlive &&
                                                                           (!x.IsIllusion || x.HasModifier("modifier_morphling_replicate")) &&
                                                                           x.IsEnemy(context.LocalHero) &&
                                                                           x.IsVisible);

            if (target == null)
            {
                return;
            }

            var allies = EntityManager.GetEntities <Hero>().Where(x => x.IsAlly(localHero) &&
                                                                  x.IsAlive &&
                                                                  !x.IsIllusion);

            if (modeSelector.Value == "Also with agha" && enchant.CanBeCasted())
            {
                var alliesAround = allies.Where(x => x.Distance2D(target) < 1000);

                foreach (var ally in allies.Where(x => x.Distance2D(localHero) < 3000 &&
                                                  x.Distance2D(localHero) > 1000))
                {
                    if (ally == null)
                    {
                        break;
                    }

                    var destinationWithAghanim   = target.Position.Extend(ally.Position, 2000);
                    var alliesArroundDestination = allies.Where(x => x.Distance2D(destinationWithAghanim) < 1000);

                    if (alliesArroundDestination.Count() < alliesAround.Count())
                    {
                        continue;
                    }

                    if (alliesArroundDestination.All(x => x.HealthPercent() > (float)minAllyHpPercent.Value / 100))
                    {
                        enchant.Base.Cast(target);
                        sleeper.Sleep(500);

                        UpdateManager.BeginInvoke(500, () =>
                        {
                            smash.UseAbility(localHero.Position.Extend(ally.Position, 400));
                        });
                        return;
                    }
                }
            }

            var range = smash.PushDistance;

            var destination = target.Position.Extend(localHero.Position, -range);

            var alliesNear            = allies.Where(x => x.Distance2D(localHero) < range / 1.5f);
            var alliesNearDestination = allies.Where(x => x.Position.Distance2D(destination) < range);

            if (alliesNearDestination.Any(x => x.HealthPercent() < (float)minAllyHpPercent.Value / 100) ||
                alliesNear.Count() >= alliesNearDestination.Count())
            {
                return;
            }

            smash.Base.Cast(target);
            sleeper.Sleep(500);
        }
Exemple #3
0
        private void UpdateManager_IngameUpdate()
        {
            var target = TargetSelector.CurrentTarget;

            if (target == null || !target.IsAlive || target.IsEnchanted())
            {
                return;
            }

            if (!OrbWalkerSleeper.Sleeping)
            {
                OrbwalkerManager.OrbwalkTo(target, GameManager.MousePosition);
                OrbWalkerSleeper.Sleep(200);
                return;
            }

            if (AbilitySleeper.Sleeping || localHero.IsRooted())
            {
                return;
            }

            var distanceToTarget = localHero.Distance2D(target);
            var blinkRange       = Blink?.Range;

            //blink logic
            if (Blink != null &&
                Blink.CanBeCasted())
            {
                if (Roll.CanBeCasted() &&
                    blinkRange < distanceToTarget &&
                    blinkRange + Roll.Range > distanceToTarget &&
                    Blink.UseAbility(target))
                {
                    Stone.Sleeper.Sleep(300);
                    Roll.Sleeper.Sleep(300);
                    AbilitySleeper.Sleep(200);
                    return;
                }

                if (!Roll.CanBeCasted() &&
                    distanceToTarget > blinkRange / 3 &&
                    distanceToTarget < blinkRange &&
                    Blink.UseAbility(target))
                {
                    Stone.Sleeper.Sleep(300);
                    Roll.Sleeper.Sleep(300);
                    AbilitySleeper.Sleep(200);
                    return;
                }
            }

            if (VeilOfDiscord != null &&
                VeilOfDiscord.UseAbility(target))
            {
                AbilitySleeper.Sleep(100);
                return;
            }

            if (Hex != null &&
                Hex.UseAbility(target))
            {
                AbilitySleeper.Sleep(100);
                return;
            }

            if (Abyssal != null &&
                Abyssal.UseAbility(target))
            {
                AbilitySleeper.Sleep(100);
                return;
            }

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

            var firstStoneNearEnemy = StoneExtensions.FirstUnitInRange(target.Position, StoneExtensions.StoneName, 500);
            var firstStoneNearHero  = StoneExtensions.FirstUnitInRange(localHero.Position, StoneExtensions.StoneName, 250);

            // roll logic
            if (Roll.CanBeCasted())
            {
                var rudePredict   = target.IsMoving ? target.InFront(150) : target.Position;
                var prediction    = Smash.GetPrediction(target);
                var distToPredict = prediction.Distance2D(localHero.Position);

                if (firstStoneNearHero == null &&
                    firstStoneNearEnemy == null &&
                    !target.IsInvulnerable() &&
                    !context.AutoPushInTowerDirection.CanPushInTower &&
                    distToPredict < 600f &&
                    Grip.CanBeCasted() &&
                    Smash.CanBeCasted() &&
                    Stone.UseAbility(localHero.Position.Extend(rudePredict, 100)))
                {
                    Blink?.Sleeper.Sleep(300);
                    Grip.Sleeper.Sleep(distToPredict / Grip.Speed * 1000);
                    Stone.Sleeper.Sleep(500);
                    Roll.Sleeper.Sleep(300 + distToPredict / Grip.Speed * 1000);
                    AbilitySleeper.Sleep(100);
                    return;
                }

                var stoneBetween = StoneExtensions.FirstUnitBetween(localHero.Position, rudePredict, StoneExtensions.StoneName, 250, 350);

                if (firstStoneNearEnemy != null &&
                    firstStoneNearEnemy.Distance2D(localHero) < 1000f &&
                    stoneBetween == null &&
                    Grip.UseAbility(firstStoneNearEnemy.Position))
                {
                    Blink?.Sleeper.Sleep(300);
                    AbilitySleeper.Sleep(100);
                    return;
                }
                else if (firstStoneNearEnemy == null &&
                         distToPredict < 900f &&
                         !target.IsInvulnerable() &&
                         stoneBetween == null &&
                         !localHero.IsInRollPhase() &&
                         Grip.CanBeCasted() &&
                         Stone.UseAbility(rudePredict))
                {
                    Blink?.Sleeper.Sleep(300);
                    Stone.Sleeper.Sleep(500);
                    AbilitySleeper.Sleep(200);
                    return;
                }

                if (!localHero.IsInRollPhase() &&
                    Roll.UseAbility(target))
                {
                    Smash.Sleeper.Sleep(1000);
                    Blink?.Sleeper.Sleep(300);
                    AbilitySleeper.Sleep(800);
                    return;
                }
            }

            var intersectingStone = EntityManager.GetEntities <Unit>()
                                    .FirstOrDefault(x => x.Distance2D(target) < Grip.Range &&
                                                    x.Name == StoneExtensions.StoneName &&
                                                    x.IsAlive &&
                                                    StoneExtensions.FirstUnitBetween(localHero.Position, x.Position, target.Name, 200, Grip.Range) == target);

            if (intersectingStone != null &&
                !target.IsInvulnerable() &&
                Grip.UseAbility(intersectingStone.Position))
            {
                Smash.Sleeper.Sleep(intersectingStone.Distance2D(localHero) / Grip.Speed * 1100);
                AbilitySleeper.Sleep(200);
                return;
            }

            if (Orchid != null &&
                Orchid.UseAbility(target))
            {
                AbilitySleeper.Sleep(100);
                return;
            }

            if (Halberd != null &&
                Halberd.UseAbility(target))
            {
                AbilitySleeper.Sleep(100);
                return;
            }

            if (Shivas != null &&
                Shivas.UseAbility(target))
            {
                AbilitySleeper.Sleep(100);
                return;
            }


            if (distanceToTarget < Smash.Range * 0.4f &&
                !target.IsInvulnerable() &&
                Smash.UseAbilityOnStone(target))
            {
                AbilitySleeper.Sleep(200);
                return;
            }

            if (distanceToTarget < Smash.Range * 0.4f &&
                !localHero.IsInRollPhase() &&
                !target.IsInvulnerable() &&
                Grip.CanBeCasted() &&
                Smash.CanBeCasted() &&
                Stone.UseAbility())

            {
                Stone.Sleeper.Sleep(300);
                AbilitySleeper.Sleep(200);
                return;
            }

            if (distanceToTarget < Smash.Range * 0.4f &&
                firstStoneNearHero == null &&
                !target.IsInvulnerable() &&
                (Grip.Base.Cooldown > Smash.Base.CooldownLength ||
                 (!Grip.CanBeCasted() && Grip.Base.Cooldown == 0)) &&
                !localHero.IsInRollPhase() &&
                Smash.CanBeCasted() &&
                !context.AutoPushInTowerDirection.CanPushInTower &&
                Stone.UseAbility())
            {
                Stone.Sleeper.Sleep(300);
                AbilitySleeper.Sleep(100);
                return;
            }

            if (SpiritVessel != null &&
                SpiritVessel.UseAbility(target))
            {
                AbilitySleeper.Sleep(100);
                return;
            }
        }
        private void IngameUpdate()
        {
            if (!smash.CanBeCasted())
            {
                CanPushInTower = false;
                return;
            }

            var nearestEnemyes = EntityManager.GetEntities <Hero>()
                                 .Where(x => x.Distance2D(localHero) < 350 &&
                                        x.IsEnemy(localHero) &&
                                        !x.IsMagicImmune() &&
                                        !x.IsIllusion &&
                                        x.IsVisible &&
                                        x.IsAlive);

            if (!nearestEnemyes.Any())
            {
                return;
            }

            if (modeSelector.Value == "Also with agha")
            {
                var tower = GetGoodTowerForAgha();

                if (tower != null)
                {
                    if (enchant.CanBeCasted())
                    {
                        CanPushInTower = true;
                        var firstEnemy = nearestEnemyes.First();

                        if (enchant.UseAbility(firstEnemy))
                        {
                            return;
                        }
                    }

                    if (nearestEnemyes.Any(x => x.IsEnchanted()))
                    {
                        CanPushInTower = true;
                        smash.Base.Cast(localHero.Position.Extend(tower.Position, 400));
                        return;
                    }
                }
            }

            var target = nearestEnemyes.First();

            var nearestTower = EntityManager.GetEntities <Tower>()
                               .FirstOrDefault(x => x.Distance2D(target) < 700 + smash.PushDistance + additionalRange.Value && //700 is tower attack range
                                               x.IsAlly(localHero) &&
                                               x.IsAlive);


            if (nearestTower == null)
            {
                CanPushInTower = false;
                return;
            }
            else if (localHero.Distance2D(target.Position.Extend(nearestTower.Position, -150)) < 250)
            {
                CanPushInTower = true;
            }

            var pushTargets = nearestEnemyes.Where(x => x.Position.Extend(localHero.Position, -smash.PushDistance).Distance2D(nearestTower.Position) < 700 + additionalRange.Value); //700 is tower attack range

            var pushTarget = pushTargets.FirstOrDefault(x => x.Position.Extend(localHero.Position, -smash.PushDistance).Distance2D(nearestTower.Position) < x.Distance2D(nearestTower));

            if (pushTarget != null)
            {
                smash.Base.Cast(pushTarget);
            }
        }