/// <summary>
        /// Returns an appropriately selected TrinityPower and related information
        /// </summary>
        /// <param name="IsCurrentlyAvoiding">Are we currently avoiding?</param>
        /// <param name="UseOOCBuff">Buff Out Of Combat</param>
        /// <param name="UseDestructiblePower">Is this for breaking destructables?</param>
        /// <returns></returns>
        internal static TrinityPower AbilitySelector(bool IsCurrentlyAvoiding = false, bool UseOOCBuff = false, bool UseDestructiblePower = false)
        {
            using (new PerformanceLogger("AbilitySelector"))
            {
                if (!UseOOCBuff && CurrentTarget == null)
                {
                    return(new TrinityPower());
                }

                // See if archon just appeared/disappeared, so update the hotbar
                if (ShouldRefreshHotbarAbilities || Trinity.HotbarRefreshTimer.ElapsedMilliseconds > 5000)
                {
                    PlayerInfoCache.RefreshHotbar();
                }

                // Switch based on the cached character class

                TrinityPower power = CombatBase.CurrentPower;


                using (new PerformanceLogger("AbilitySelector.ClassAbility"))
                {
                    switch (Player.ActorClass)
                    {
                    // Barbs
                    case ActorClass.Barbarian:
                        //power = GetBarbarianPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower);
                        power = BarbarianCombat.GetPower();
                        break;

                    // Crusader
                    case ActorClass.Crusader:
                        power = CrusaderCombat.GetPower();
                        break;

                    // Monks
                    case ActorClass.Monk:
                        power = GetMonkPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower);
                        break;

                    // Wizards
                    case ActorClass.Wizard:
                        power = GetWizardPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower);
                        break;

                    // Witch Doctors
                    case ActorClass.Witchdoctor:
                        power = WitchDoctorCombat.GetPower();
                        break;

                    // Demon Hunters
                    case ActorClass.DemonHunter:
                        power = GetDemonHunterPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower);
                        break;
                    }
                }
                // use IEquatable to check if they're equal
                if (CombatBase.CurrentPower == power)
                {
                    Logger.Log(TrinityLogLevel.Debug, LogCategory.Behavior, "Keeping {0}", CombatBase.CurrentPower.ToString());
                    return(CombatBase.CurrentPower);
                }
                else if (power != null && power.SNOPower != SNOPower.None)
                {
                    Logger.Log(TrinityLogLevel.Debug, LogCategory.Behavior, "Selected new {0}", power.ToString());
                    return(power);
                }
                else
                {
                    return(defaultPower);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Returns an appropriately selected TrinityPower and related information
        /// </summary>
        /// <param name="IsCurrentlyAvoiding">Are we currently avoiding?</param>
        /// <param name="UseOOCBuff">Buff Out Of Combat</param>
        /// <param name="UseDestructiblePower">Is this for breaking destructables?</param>
        /// <returns></returns>
        internal static TrinityPower AbilitySelector(bool IsCurrentlyAvoiding = false, bool UseOOCBuff = false, bool UseDestructiblePower = false)
        {
            using (new PerformanceLogger("AbilitySelector"))
            {
                if (!UseOOCBuff && CurrentTarget == null)
                {
                    return(new TrinityPower());
                }

                // Switch based on the cached character class
                TrinityPower power = CombatBase.CurrentPower;

                if (Player.PrimaryResource >= MinEnergyReserve)
                {
                    IsWaitingForSpecial = false;
                }

                if (Player.PrimaryResource < 20)
                {
                    IsWaitingForSpecial = true;
                }

                using (new PerformanceLogger("AbilitySelector.ClassAbility"))
                {
                    switch (Player.ActorClass)
                    {
                    // Barbs
                    case ActorClass.Barbarian:
                        power = BarbarianCombat.GetPower();
                        break;

                    // Crusader
                    case ActorClass.Crusader:
                        power = CrusaderCombat.GetPower();
                        break;

                    // Monks
                    case ActorClass.Monk:
                        power = MonkCombat.GetPower();
                        if (power != null && GetHasBuff(SNOPower.X1_Monk_Epiphany) && power.MinimumRange > 0)
                        {
                            power.MinimumRange = 75f;
                        }
                        break;

                    // Wizards
                    case ActorClass.Wizard:
                        power = WizardCombat.GetPower();
                        break;

                    // Witch Doctors
                    case ActorClass.Witchdoctor:
                        power = WitchDoctorCombat.GetPower();
                        break;

                    // Demon Hunters
                    case ActorClass.DemonHunter:
                        power = DemonHunterCombat.GetPower();
                        break;
                    }
                }

                // use IEquatable to check if they're equal
                if (CombatBase.CurrentPower == power)
                {
                    Logger.Log(TrinityLogLevel.Debug, LogCategory.Behavior, "Keeping {0}", CombatBase.CurrentPower.ToString());
                    return(CombatBase.CurrentPower);
                }
                else if (power != null && power.SNOPower != SNOPower.None)
                {
                    Logger.Log(TrinityLogLevel.Debug, LogCategory.Behavior, "Selected new {0}", power.ToString());
                    return(power);
                }
                else
                {
                    return(defaultPower);
                }
            }
        }