Ejemplo n.º 1
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;
            }
        }