Ejemplo n.º 1
0
 /// <summary>
 /// Determines whether [is killable with spell w and spell r and automatic attack] [the specified enemy hero].
 /// </summary>
 /// <param name="enemyHero">The enemy hero.</param>
 /// <returns>Task&lt;System.Boolean&gt;.</returns>
 private async Task <bool> IsKillableWithSpellWAndSpellRAndAutoAttack(Obj_AI_Base enemyHero)
 {
     return(await Task.FromResult(WSpell.Ready && RSpell.Ready &&
                                  LocalHero.GetSpellDamage(enemyHero, SpellSlot.W) +
                                  LocalHero.GetSpellDamage(enemyHero, SpellSlot.R) +
                                  LocalHero.GetAutoAttackDamage(enemyHero) >
                                  enemyHero.Health + enemyHero.PhysicalShield &&
                                  IsValidTargetLocked(enemyHero, WSpell.Range)));
 }
Ejemplo n.º 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();
        }