Example #1
0
        /// <summary>
        /// Processes the instagib mechanics.
        /// </summary>
        /// <returns>Task.</returns>
        private async Task ProcessInstagibMechanics()
        {
            foreach (var enemyHero in GameObjects.EnemyHeroes)
            {
                if (LocalHero.Distance(enemyHero) > WSpell.Range)
                {
                    continue;
                }

                var taskCheckKillableWithSpellWAndSpellRAndAuto =
                    await IsKillableWithSpellWAndSpellRAndAutoAttack(enemyHero);

                var taskCheckKillableWithSpellW = await IsKillableWithSpellW(enemyHero);

                var taskCheckKillableWithSpellR = await IsKillableWithSpellR(enemyHero);

                if (taskCheckKillableWithSpellWAndSpellRAndAuto)

                {
                    CastSpellR(enemyHero, SpellPriority.Combo);
                    CastSpellW(enemyHero, SpellPriority.Force);
                    continue;
                }

                if (taskCheckKillableWithSpellW)
                {
                    CastSpellW(enemyHero, SpellPriority.Force);
                    continue;
                }

                if (!taskCheckKillableWithSpellR)
                {
                    continue;
                }
                {
                    CastSpellR(enemyHero, SpellPriority.Combo);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Processes the trick trap mechanics.
        /// </summary>
        private void ProcessTrickTrapMechanics()
        {
            var panicMechanicsTask = Task.Factory.StartNew(() =>
            {
                if (LocalHero.HealthPercent() > 33)
                {
                    return;
                }

                foreach (var enemyHero in GameObjects.EnemyHeroes)
                {
                    if (LocalHero.Distance(enemyHero) >= LocalHeroTrueRange / 2 || !enemyHero.IsFacing(LocalHero) ||
                        enemyHero.HealthPercent() <= LocalHero.HealthPercent())
                    {
                        continue;
                    }

                    CastSpellR(enemyHero, SpellPriority.Force);
                    Krywalker.Orbwalk(enemyHero);
                }
            });

            var underTowerMechanicsTask = Task.Factory.StartNew(() =>
            {
                foreach (var enemyHero in GameObjects.EnemyHeroes)
                {
                    if (!enemyHero.IsUnderAllyTurret() || !IsValidTargetLocked(enemyHero, LocalHeroTrueRange) ||
                        !LocalHero.IsUnderAllyTurret())
                    {
                        continue;
                    }

                    CastSpellR(enemyHero, SpellPriority.Force);
                }
            });

            var onOpportunityMechanicsTask = Task.Factory.StartNew(() =>
            {
                foreach (var enemyHero in GameObjects.EnemyHeroes)
                {
                    if (!IsValidTargetLocked(enemyHero, WSpell.Range))
                    {
                        continue;
                    }

                    CastSpellW(enemyHero, SpellPriority.Combo);

                    if (!IsValidTargetLocked(enemyHero, LocalHeroTrueRange) ||
                        enemyHero.HealthPercent() > LocalHero.HealthPercent())
                    {
                        continue;
                    }
                    {
                        var zoneCircle = Geometry.GetNewCircleAtPoint(new Point(LocalHero.Position.X, 0, LocalHero.Position.Z),
                                                                      LocalHeroTrueRange * 3);

                        var allyHeroesCountTask =
                            Task <int> .Factory.StartNew(() => GetAllyHeroesCountInZone(ref zoneCircle));
                        var enemyHeroesCountTask =
                            Task <int> .Factory.StartNew(() => GetEnemyHeroesCountInZone(ref zoneCircle));
                        var allyMinionsCountTask =
                            Task <int> .Factory.StartNew(() => GetAllyMinionsCountInZone(ref zoneCircle));
                        var enemyMinionsCountTask =
                            Task <int> .Factory.StartNew(() => GetEnemyMinionsCountInZone(ref zoneCircle));

                        if (allyHeroesCountTask.Result < enemyHeroesCountTask.Result ||
                            allyMinionsCountTask.Result < enemyMinionsCountTask.Result ||
                            LocalHero.GetAutoAttackDamage(enemyHero) <= enemyHero.GetAutoAttackDamage(LocalHero) ||
                            LocalHero.IsUnderEnemyTurret())
                        {
                            continue;
                        }

                        if (IsValidTargetLocked(enemyHero, WSpell.Range / 2))
                        {
                            CastSpellR(enemyHero, SpellPriority.Combo);
                        }

                        if (!IsValidTargetLocked(enemyHero, LocalHeroTrueRange))
                        {
                            continue;
                        }

                        CastSpellQ(enemyHero, SpellPriority.Combo);

                        Krywalker.Orbwalk(enemyHero);
                    }
                }
            });

            panicMechanicsTask.Wait();
            underTowerMechanicsTask.Wait();
            onOpportunityMechanicsTask.Wait();
        }