示例#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;
            }
        }
示例#2
0
        private async void UseItem(CancellationToken token)
        {
            // SoulRing
            if (SoulRing != null &&
                Config.ItemsToggler.Value.IsEnabled(SoulRing.Item.Name) &&
                SoulRing.CanBeCasted)
            {
                SoulRing.UseAbility();
                await Await.Delay(SoulRing.GetCastDelay(), token);
            }
            else
            {
                Elsecount += 1;
            }

            // MidnightPulse
            if (MidnightPulse != null &&
                Config.AbilityToggler.Value.IsEnabled(MidnightPulse.Ability.Name) &&
                MidnightPulse.CanBeCasted)
            {
                MidnightPulse.UseAbility(Output.CastPosition);
                await Await.Delay(MidnightPulse.GetCastDelay(Output.CastPosition), token);
            }
            else
            {
                Elsecount += 1;
            }

            // GlimmerCape
            if (GlimmerCape != null &&
                Config.ItemsToggler.Value.IsEnabled(GlimmerCape.Item.Name) &&
                GlimmerCape.CanBeCasted)
            {
                GlimmerCape.UseAbility(Owner);
                await Await.Delay(GlimmerCape.GetCastDelay(Owner), token);
            }
            else
            {
                Elsecount += 1;
            }

            // BKB
            if (BKB != null &&
                Config.ItemsToggler.Value.IsEnabled(BKB.Item.Name) &&
                BKB.CanBeCasted)
            {
                BKB.UseAbility();
                await Await.Delay(BKB.GetCastDelay(), token);
            }
            else
            {
                Elsecount += 1;
            }

            // Shivas
            if (Shivas != null &&
                Config.ItemsToggler.Value.IsEnabled(Shivas.Item.Name) &&
                Shivas.CanBeCasted)
            {
                Shivas.UseAbility();
                await Await.Delay(Shivas.GetCastDelay(), token);
            }
            else
            {
                Elsecount += 1;
            }

            // ArcaneBoots
            if (ArcaneBoots != null &&
                Config.ItemsToggler.Value.IsEnabled(ArcaneBoots.Item.Name) &&
                ArcaneBoots.CanBeCasted &&
                Owner.Mana * 100 / Owner.MaximumMana <= 92 &&
                Elsecount == 5)
            {
                ArcaneBoots.UseAbility();
                await Await.Delay(ArcaneBoots.GetCastDelay(), token);
            }

            // Guardian
            if (Guardian != null &&
                Config.ItemsToggler.Value.IsEnabled(Guardian.Item.Name) &&
                Guardian.CanBeCasted &&
                Owner.Mana * 100 / Owner.MaximumMana <= 92 &&
                Elsecount == 5)
            {
                Guardian.UseAbility();
                await Await.Delay(Guardian.GetCastDelay(), token);
            }

            // Veil
            if (Veil != null &&
                Config.ItemsToggler.Value.IsEnabled(Veil.Item.Name) &&
                Veil.CanBeCasted)
            {
                Veil.UseAbility(Output.CastPosition);
                await Await.Delay(Veil.GetCastDelay(Output.CastPosition), token);
            }
            else
            {
                Elsecount += 1;
            }
        }