Ejemplo n.º 1
0
                /// <summary>
                /// Does the multitarget rotation.
                /// </summary>
                /// <returns><c>true</c>, if a spell was cast, <c>false</c> otherwise.</returns>
                /// <param name="mobsInFrontOfMe">Mobs in front of me.</param>
                bool DoMultitargetRotation(int mobsInFrontOfMe)
                {
                    if (
                        mobsInFrontOfMe >= 3 &&// Got a Group
                        HasFelguard() &&// and Has a Felguard
                        Cast("Command Demon") && HasGlobalCooldown())
                    {
                        return(true);
                    }

                    /*
                     * Against 5 or more enemies, you will need to start using Soulburn with Seed of Corruption
                     */
                    if (mobsInFrontOfMe >= 5)
                    {
                        CastSelf(
                            "Mannoroth's Fury",
                            () => HasSpell("Mannoroth's Fury") && !Me.HasAura("Mannoroth's Fury")
                            );
                        CastSelf("Soulburn", () => !Me.HasAura("Soulburn"));
                    }

                    if (Me.HasAura("Soulburn"))
                    {
                        if (CastSpellOnBestAoETarget(
                                "Seed of Corruption",
                                add => !add.HasAura("Seed of Corruption"),
                                add => !add.HasAura("Seed of Corruption")
                                ))
                        {
                            return(true);
                        }
                    }

                    /*
                     * Against 2 enemies, use your normal rotation on one of them and keep your DoTs up on the other.
                     * Against 3 or 4 enemies, keep your DoTs up and cast Drain Soul Icon Drain Soul.
                     * Against 5 or more enemies, While Seed of Corruption is ticking, you should maintain your DoTs on as many targets as possible.
                     */
                    foreach (var add1 in Adds.Where(x => x.IsInCombatRangeAndLoS))
                    {
                        if (DoDotting(add1))
                        {
                            return(true);
                        }
                    }

                    if (mobsInFrontOfMe >= 3)
                    {
                        /*
                         * Against 3 or 4 enemies, keep your DoTs up and cast Drain Soul Icon Drain Soul.
                         */
                        if (Cast("Drain Soul"))
                        {
                            return(true);
                        }
                    }

                    return(false);
                }
        /// <summary>
        /// Casts the given spell on the best target.
        /// If none is found it will always fallback to Target.
        /// </summary>
        /// <returns><c>true</c>, if spell on best target was cast, <c>false</c> otherwise.</returns>
        /// <param name="spellName">Spell name.</param>
        /// <param name="castWhen">onlyCastWhen condition for Cast()</param>
        /// <param name="bestTargetCondition">Condition to limit the UnitObjects for a bestTarget</param>
        /// <param name="preventTime">Milliseconds in which the spell won't be cast again</param>
        /// <param name="targetOverride">Spell will be cast on this target</param>
        public bool CastSpellOnBestAoETarget(string spellName, Func <UnitObject, bool> castWhen = null, Func <UnitObject, bool> bestTargetCondition = null, int preventTime = 0, UnitObject targetOverride = null)
        {
            if (castWhen == null)
            {
                castWhen = (_ => true);
            }

            if (bestTargetCondition == null)
            {
                bestTargetCondition = (_ => true);
            }

            var aoeRange   = SpellAoERange(spellName);
            var bestTarget = targetOverride ?? Adds
                             .Where(u => u.IsInCombatRangeAndLoS && u.DistanceSquared <= SpellMaxRangeSq(spellName) && bestTargetCondition(u))
                             .OrderByDescending(u => Adds.Count(o => Vector3.DistanceSquared(u.Position, o.Position) <= aoeRange)).FirstOrDefault() ?? Target;

            if (preventTime == 0)
            {
                return(SpellIsCastOnTerrain(spellName) ? CastOnTerrain(
                           spellName,
                           bestTarget.Position,
                           () => castWhen(bestTarget)
                           ) : Cast(
                           spellName,
                           bestTarget,
                           () => castWhen(bestTarget)
                           ));
            }

            return(SpellIsCastOnTerrain(spellName) ? CastOnTerrainPreventDouble(
                       spellName,
                       bestTarget.Position,
                       () => castWhen(bestTarget),
                       preventTime
                       ) : CastPreventDouble(
                       spellName,
                       () => castWhen(bestTarget),
                       bestTarget,
                       preventTime
                       ));
        }
Ejemplo n.º 3
0
 public ImmutableHashSet <OUR_SetWithVCElement <TestType> > GetAdds(Guid id)
 {
     return(Adds.Where(a => a.ValueId == id).ToImmutableHashSet());
 }
Ejemplo n.º 4
0
 public ImmutableHashSet <OR_SetElement <TestType> > GetAdds(Guid id)
 {
     return(Adds.Where(x => x.ValueId == id).ToImmutableHashSet());
 }
            /// <summary>
            /// This will try to cast a fear spell.
            ///
            /// It will hereby utilize a FearBanList for players, so it won't try to fear all the time.
            /// </summary>
            /// <returns><c>true</c>, if a fear spell was cast, <c>false</c> otherwise.</returns>
            protected bool CastFearIfFeasible()
            {
                if (!FearDoFear)
                {
                    return(false);
                }

                try {
                    FearTrackingList = FearTrackingList.Where(x => !x.IsExpired()).ToList(); // trim the list to all non expired feared objects.

                    var FearableAdds = Adds.Where(x => x.DistanceSquared < 11 * 11);
                    if (CastSelf("Howl of Terror", () => FearableAdds.Count() >= 2))
                    {
                        foreach (var fearedAdd in FearableAdds.Where(x => x.IsPlayer))
                        {
                            FearTrackingList.Add(new ExpirableObject(fearedAdd, FearBanTime));
                        } // Do not fear them again (at least not with feat, howl of terror won't be affected by its fear descision, for the moment...)
                        return(true);
                    }

                    foreach (var add in Adds.Where(x => x.IsPlayer && x.HasAura("Fear")))
                    {
                        // Add feared adds which were not feared by us
                        //if(FearTrackingList.Count(y => y.Unit == x) == 0)
                        var alreadyAdded = FearTrackingList.FirstOrDefault(y => add.Equals(y.ExpiringObject));
                        if (alreadyAdded != null)
                        {
                            alreadyAdded.ResetTime();
                        }
                        else
                        {
                            FearTrackingList.Add(new ExpirableObject(add, FearBanTime));
                        }
                    }
                } catch (Exception e) { // catch everything
                    API.PrintError(
                        "Got an error in fear management logic. Disabling fear for now... Please Report to Avoloos.",
                        e
                        );
                    FearDoFear = false;
                }

                UnitObject add2 = Adds.FirstOrDefault(x => x.Target != null && x.DistanceSquared <= SpellMaxRangeSq("Fear"));

                if (add2 != null && add2.DistanceSquared < SpellMaxRangeSq("Fear"))
                {
                    var add = add2;
                    // Fear only real close targets which attack us
                    if (CastPreventDouble(
                            "Fear", () =>
                            (!add.HasAura("Fear") &&// its not already feared by other ppl.
                             !add.HasAura("Howl of Terror") &&// and its not already feared by howl
                             Target.DistanceSquared <= 6.5 * 6.5 &&// and its close
                             add.Target == Me ||// and its targetting me
                             add.IsCastingAndInterruptible()) &&// or its casting and we can interrupt it with fear :D
                            (FearDoFear && FearTrackingList.Count(x => add.Equals(x.ExpiringObject)) == 0)  // and its not banned from fear
                            , add, 1000
                            ))
                    {
                        return(true);
                    }
                }

                return(false);
            }
                /// <summary>
                /// Does the multitarget rotation.
                /// </summary>
                /// <returns><c>true</c>, if a spell was cast, <c>false</c> otherwise.</returns>
                /// <param name="mobsInFrontOfMe">Mobs in front of me.</param>
                bool DoMultitargetRotation(int mobsInFrontOfMe)
                {
                    int burningEmbers = Me.GetPower(WoWPowerType.WarlockDestructionBurningEmbers);

                    if (mobsInFrontOfMe >= 3)
                    {
                        CastSelf(
                            "Mannoroth's Fury",
                            () => HasSpell("Mannoroth's Fury") && !Me.HasAura("Mannoroth's Fury")
                            );
                    }

                    // Priority #1
                    if (CastSpellOnBestAoETarget(
                            "Rain of Fire",
                            u => !HasAura("Rain of Fire") && (HasAura("Mannoroth's Fury") || mobsInFrontOfMe >= 5)
                            ))
                    {
                        return(true);
                    }

                    // Priority #2
                    if (
                        SpellCooldown("Havoc") <= 0.01 && burningEmbers >= 1 && mobsInFrontOfMe < 12)
                    {
                        // Dont waste Havoc apply it to one of the mid-enemies (high max health, low current health)
                        var havocAdd = Me.Focus;

                        if (!UseHavocOnFocus)
                        {
                            havocAdd = Adds
                                       .OrderByDescending(x => x.Health)
                                       .FirstOrDefault(x => x.HealthFraction <= HavocHealthPercentage / 100f && x.IsInLoS && x.DistanceSquared <= SpellMaxRangeSq("Havoc")) ?? Adds.FirstOrDefault();
                        }

                        if (havocAdd != null && havocAdd.IsFriendly)
                        {
                            havocAdd = havocAdd.Target;
                        }

                        if (havocAdd != null && Cast("Havoc", havocAdd))
                        {
                            return(true);
                        }
                    }

                    // cast Chaosbolt or shadowburn on target as soon as possible and if feasible
                    if (Adds.Count(x => x.HasAura("Havoc", true)) > 0 || burningEmbers >= 4)
                    {
                        var shadowBurnTarget = Adds
                                               .Where(x => x.HealthFraction <= 0.2 && !x.HasAura("Havoc") && x.IsInLoS && x.DistanceSquared <= SpellMaxRangeSq("Shadowburn"))
                                               .OrderBy(x => x.Health)
                                               .FirstOrDefault() ?? Target;

                        if (Cast("Shadowburn", () => mobsInFrontOfMe < 12, shadowBurnTarget))
                        {
                            return(true);
                        }
                        if (Cast("Chaos Bolt", () => mobsInFrontOfMe < 6))
                        {
                            return(true);
                        }
                    }

                    if (mobsInFrontOfMe >= 3)
                    {
                        // Apply Immolate to all adds through Cataclysm
                        if (CastSpellOnBestAoETarget("Cataclysm"))
                        {
                            return(true);
                        }
                    }

                    // Priority #3
                    var countAddsInRange = Adds.Count(x => x.DistanceSquaredTo(Target) <= SpellAoERange("Conflagrate"));

                    if ((burningEmbers >= 2 && countAddsInRange > 2) ||
                        (burningEmbers >= 1 && countAddsInRange >= 8))
                    {
                        // Ensure Fire and Brimstone!
                        CastSelf("Fire and Brimstone", () => !HasAura("Fire and Brimstone"));

                        if (CastSpellOnBestAoETarget("Conflagrate"))
                        {
                            return(true);
                        }
                        if (CastSpellOnBestAoETarget(
                                "Immolate",
                                y => !y.HasAura("Immolate") && y.HpLessThanOrElite(0.15)
                                ))
                        {
                            return(true);
                        }
                        if (CastSpellOnBestAoETarget("Incinerate"))
                        {
                            return(true);
                        }
                    }

                    return(false);
                }