protected bool TryTeleportMovement(Vector3 destination, out TrinityPower trinityPower)
        {
            trinityPower = null;

            if (!Skills.Wizard.Teleport.CanCast())
            {
                return(false);
            }

            var path = Core.DBNavProvider.CurrentPath;

            if (path != null && path.Contains(destination))
            {
                var projectedPosition = IsBlocked
                                        ? Core.Grids.Avoidance.GetPathCastPosition(50f, true)
                                        : Core.Grids.Avoidance.GetPathWalkPosition(50f, true);

                if (projectedPosition != Vector3.Zero)
                {
                    var distance          = projectedPosition.Distance(Player.Position);
                    var inFacingDirection = Core.Grids.Avoidance.IsInPlayerFacingDirection(projectedPosition, 90);
                    var TPRecastDelayMs   = Legendary.AetherWalker.IsEquipped ? 1500 : 200;
                    if ((distance > 15f || IsBlocked && distance > 5f) && inFacingDirection && Skills.Wizard.Teleport.TimeSinceUse > TPRecastDelayMs)
                    {
                        trinityPower = Teleport(projectedPosition);
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
        public bool CastPower(TrinityPower power)
        {
            if (power.SNOPower != SNOPower.None && Core.GameIsReady)
            {
                if (GameData.InteractPowers.Contains(power.SNOPower))
                {
                    power.TargetPosition = Vector3.Zero;
                }
                else if (power.TargetPosition == Vector3.Zero)
                {
                    power.TargetPosition = Core.Player.Position;
                }

                if (ZetaDia.Me.UsePower(power.SNOPower, power.TargetPosition, Core.Player.WorldDynamicId, power.TargetAcdId))
                {
                    if (GameData.ResetNavigationPowers.Contains(power.SNOPower))
                    {
                        Navigator.Clear();
                    }

                    SpellHistory.RecordSpell(power);
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
        protected bool TryPrimaryPower(out TrinityPower power)
        {
            TrinityActor target;

            power = null;

            if (ShouldPunish(out target))
            {
                power = Punish(target);
            }

            else if (ShouldSmite(out target))
            {
                power = Smite(target);
            }

            else if (ShouldSlash(out target))
            {
                power = Slash(target);
            }

            else if (ShouldJustice(out target))
            {
                power = Justice(target);
            }

            return(power != null);
        }
Ejemplo n.º 4
0
        protected bool TryPrimaryPower(out TrinityPower power)
        {
            TrinityActor target;

            power = null;

            if (ShouldPoisonDart(out target))
            {
                power = PoisonDart(target);
            }

            else if (ShouldCorpseSpiders(out target))
            {
                power = CorpseSpiders(target);
            }

            else if (ShouldPlagueOfToads(out target))
            {
                power = PlagueOfToads(target);
            }

            else if (ShouldFirebomb(out target))
            {
                power = Firebomb(target);
            }

            return(power != null);
        }
Ejemplo n.º 5
0
        protected bool TryBloodrushMovement(Vector3 destination, out TrinityPower trinityPower)
        {
            trinityPower = null;

            if (!Skills.Necromancer.BloodRush.IsActive)
            {
                return(false);
            }

            var path = Core.DBNavProvider.CurrentPath;

            if (path != null && path.Contains(destination) && Skills.Necromancer.BloodRush.CanCast())
            {
                var projectedPosition = IsBlocked
                    ? Core.Grids.Avoidance.GetPathCastPosition(50f, true)
                    : Core.Grids.Avoidance.GetPathWalkPosition(50f, true);

                if (projectedPosition != Vector3.Zero)
                {
                    var distance          = projectedPosition.Distance(Player.Position);
                    var inFacingDirection = Core.Grids.Avoidance.IsInPlayerFacingDirection(projectedPosition, 90);
                    if ((distance > 15f || IsBlocked && distance > 5f) && inFacingDirection)
                    {
                        trinityPower = BloodRush(projectedPosition);
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 6
0
        protected bool TrySecondaryPower(out TrinityPower power)
        {
            TrinityActor target;

            power = null;

            if (ShouldShieldBash(out target))
            {
                power = ShieldBash(target);
            }

            else if (ShouldSweepAttack(out target))
            {
                power = SweepAttack(target);
            }

            else if (ShouldFistOfTheHeavens(out target))
            {
                power = FistOfTheHeavens(target);
            }

            else if (ShouldBlessedShield(out target))
            {
                power = BlessedShield(target);
            }

            else if (ShouldBlessedHammer(out target))
            {
                power = BlessedHammer(target);
            }

            return(power != null);
        }
Ejemplo n.º 7
0
        public bool TryMovementPower(Vector3 destination, out TrinityPower power)
        {
            power = null;

            var destinationDistance = Player.Position.Distance(destination);

            if (destinationDistance < 10f)
            {
                return(false);
            }

            if (CurrentTarget?.Type == TrinityObjectType.Item && destinationDistance < 20f)
            {
                return(false);
            }

            if (Math.Abs(destination.Z - Core.Player.Position.Z) > 5)
            {
                return(false);
            }

            if (Skills.Monk.DashingStrike.CanCast())
            {
                if (Sets.ThousandStorms.IsFullyEquipped && Skills.Monk.DashingStrike.Charges < 2 && !PlayerMover.IsBlocked)
                {
                    return(false);
                }

                power = DashingStrike(destination);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 8
0
        protected bool TryReanimationPower(out TrinityPower power)
        {
            TrinityActor target;
            Vector3      position;

            power = null;

            if (ShouldCommandSkeletons(out target))
            {
                power = CommandSkeletons(target);
            }

            else if (ShouldCommandGolem(out target))
            {
                power = CommandGolem(target);
            }

            else if (ShouldArmyOfTheDead(out target))
            {
                power = ArmyOfTheDead(target);
            }

            else if (ShouldLandOfTheDead(out target))
            {
                power = LandOfTheDead(target);
            }

            return(power != null);
        }
Ejemplo n.º 9
0
        private bool TryPrimaryClosestTarget(out TrinityPower power)
        {
            TrinityActor closestTarget = TargetUtil.ClosestUnit(30f);
            TrinityActor bestTarget;

            power = null;

            if (ShouldFistsOfThunder(out bestTarget))
            {
                power = FistsOfThunder(closestTarget ?? bestTarget);
            }

            else if (ShouldDeadlyReach(out bestTarget))
            {
                power = DeadlyReach(closestTarget ?? bestTarget);
            }

            else if (ShouldCripplingWave(out bestTarget))
            {
                power = CripplingWave(closestTarget ?? bestTarget);
            }

            else if (ShouldWayOfTheHundredFists(out bestTarget))
            {
                power = WayOfTheHundredFists(closestTarget ?? bestTarget);
            }

            return(power != null);
        }
Ejemplo n.º 10
0
        protected bool TrySecondaryPower(out TrinityPower power)
        {
            TrinityActor target;
            Vector3      position;

            power = null;

            if (ShouldTempestRush(out position))
            {
                power = TempestRush(position);
            }

            else if (ShouldDashingStrike(out position))
            {
                power = DashingStrike(position);
            }

            else if (ShouldSevenSidedStrike(out target))
            {
                power = SevenSidedStrike(target);
            }

            else if (ShouldWaveOfLight(out target))
            {
                power = WaveOfLight(target);
            }

            else if (ShouldLashingTailKick(out target))
            {
                power = LashingTailKick(target);
            }

            return(power != null);
        }
Ejemplo n.º 11
0
        private TrinityPower GetExplodingPalmPrimary()
        {
            TrinityPower power = null;

            var target         = TargetUtil.LowestHealthTarget(6f, CurrentTarget.Position, SNOPower.Monk_ExplodingPalm);
            var targetTeleport = TargetUtil.LowestHealthTarget(20f, CurrentTarget.Position, SNOPower.Monk_ExplodingPalm);

            if (IsEpiphanyActive)
            {
                target = targetTeleport;
            }

            if (Skills.Monk.FistsOfThunder.CanCast())
            {
                power = FistsOfThunder(targetTeleport);
            }

            else if (Skills.Monk.DeadlyReach.CanCast())
            {
                power = DeadlyReach(target);
            }

            else if (Skills.Monk.CripplingWave.CanCast())
            {
                power = CripplingWave(target);
            }

            else if (Skills.Monk.WayOfTheHundredFists.CanCast())
            {
                power = WayOfTheHundredFists(target);
            }

            return(power);
        }
Ejemplo n.º 12
0
        public bool IsInRange(TrinityActor target, TrinityPower power)
        {
            if (target == null || target.IsSafeSpot)
            {
                return(false);
            }

            if (CurrentPower != null && CurrentPower.IsCastOnSelf)
            {
                return(true);
            }

            if (GameData.ForceSameZDiffSceneSnoIds.Contains(Core.Player.CurrentSceneSnoId) && Math.Abs(target.Position.Z - Core.Player.Position.Z) > 2)
            {
                return(false);
            }

            var objectRange = Math.Max(2f, target.RequiredRadiusDistance);

            var spellRange = CurrentPower != null?Math.Max(2f, CurrentPower.MinimumRange) : objectRange;

            var targetRangeRequired = target.IsHostile || target.IsDestroyable ? spellRange : objectRange;

            Core.Logger.Verbose(LogCategory.Targetting, $">> CurrentPower={TrinityCombat.Targeting.CurrentPower} CurrentTarget={target} RangeReq:{targetRangeRequired} RadDist:{target.RadiusDistance}");


            // Handle Belial differently, he's never in LineOfSight.
            if (Core.Player.IsInBossEncounter && target.ActorSnoId == (int)SNOActor.Belial)
            {
                return(target.RadiusDistance <= targetRangeRequired);
            }

            return(target.RadiusDistance <= targetRangeRequired && IsInLineOfSight(target));
        }
Ejemplo n.º 13
0
        => Core.Buffs.GetBuffStacks((SNOPower)445274);     //P4_ItemPassive_Unique_Ring_007


        #endregion

        #region Helpers

        protected bool TryPrimaryPower(out TrinityPower power)
        {
            TrinityActor target;

            power = null;

            if (ShouldHungeringArrow(out target))
            {
                power = HungeringArrow(target);
            }

            else if (ShouldEntanglingShot(out target))
            {
                power = EntanglingShot(target);
            }

            else if (ShouldBolas(out target))
            {
                power = Bolas(target);
            }

            else if (ShouldGrenade(out target))
            {
                power = Grenade(target);
            }

            else if (ShouldEvasiveFire(out target))
            {
                power = EvasiveFire(target);
            }

            return(power != null);
        }
Ejemplo n.º 14
0
        public bool TryKamakaziPower(TrinityActor target, TrinityPower routinePower, out TrinityPower power)
        {
            // The routine may want us attack something other than current target, like best cluster, whatever.
            // But for goblin kamakazi we need a special exception to force it to always target the goblin.

            power = null;
            if (!target.IsTreasureGoblin ||
                Core.Settings.Weighting.GoblinPriority != TargetPriority.Kamikaze ||
                target.Position == Vector3.Zero)
            {
                return(false);
            }

            Core.Logger.Log(LogCategory.Targetting, $"Forcing Kamakazi Target on {target}, routineProvided={routinePower}");

            TrinityPower kamaKaziPower = DefaultPower;

            if (routinePower != null)
            {
                routinePower.SetTarget(target);
                kamaKaziPower = routinePower;
            }

            power = kamaKaziPower;
            return(true);
        }
Ejemplo n.º 15
0
        protected bool TrySecondaryPower(out TrinityPower power)
        {
            TrinityActor target;

            power = null;

            if (ShouldArcaneOrb(out target))
            {
                power = ArcaneOrb(target);
            }

            else if (ShouldRayOfFrost(out target))
            {
                power = RayOfFrost(target);
            }

            else if (ShouldArcaneTorrent(out target))
            {
                power = ArcaneTorrent(target);
            }

            else if (ShouldDisintegrate(out target))
            {
                power = Disintegrate(target);
            }

            return(power != null);
        }
Ejemplo n.º 16
0
        protected bool TryPrimaryPower(out TrinityPower power)
        {
            TrinityActor target;

            power = null;

            if (ShouldElectrocute(out target))
            {
                power = Electrocute(target);
            }

            else if (ShouldShockPulse(out target))
            {
                power = ShockPulse(target);
            }

            else if (ShouldMagicMissile(out target))
            {
                power = MagicMissile(target);
            }

            else if (ShouldSpectralBlade(out target))
            {
                power = SpectralBlade(target);
            }

            return(power != null);
        }
Ejemplo n.º 17
0
        protected bool TryPredictiveTeleport(Vector3 destination, out TrinityPower trinityPower)
        {
            trinityPower = null;

            var path = Core.DBNavProvider.CurrentPath;

            if (path != null && path.Contains(destination) && CanTeleport)
            {
                // The destination is often the next point along a jagged navigation path,
                // which could be very close. Instead of going to the given destination,
                // the idea here is to look through the path and find a better (further away) position.
                // It also advances the current path to skip the points we'll miss by teleporting to
                // prevent the bot from backtracking (DB's navigator doesn't update itself to reflect
                // having past a point and clearing the path appears to be delayed and/or not working)

                var projectedPosition = IsBlocked
                    ? Core.Grids.Avoidance.GetPathCastPosition(50f, true)
                    : Core.Grids.Avoidance.GetPathWalkPosition(50f, true);

                if (projectedPosition != Vector3.Zero)
                {
                    var distance          = projectedPosition.Distance(Player.Position);
                    var inFacingDirection = Core.Grids.Avoidance.IsInPlayerFacingDirection(projectedPosition, 90);
                    if ((distance > 15f || IsBlocked && distance > 5f) && inFacingDirection)
                    {
                        trinityPower = Teleport(projectedPosition);
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 18
0
        private TrinityPower GetPrimary()
        {
            TrinityPower power = null;

            var target = TargetUtil.GetBestClusterUnit() ?? CurrentTarget;

            if (Skills.Monk.FistsOfThunder.CanCast())
            {
                power = FistsOfThunder(target);
            }

            else if (Skills.Monk.DeadlyReach.CanCast())
            {
                power = DeadlyReach(target);
            }

            else if (Skills.Monk.CripplingWave.CanCast())
            {
                power = CripplingWave(target);
            }

            else if (Skills.Monk.WayOfTheHundredFists.CanCast())
            {
                power = WayOfTheHundredFists(target);
            }

            return(power);
        }
Ejemplo n.º 19
0
        public TrinityPower GetOffensivePower()
        {
            TrinityActor target;
            TrinityPower power = null;
            Vector3      position;

            if (ShouldDashingStrike(out position))
            {
                return(DashingStrike(position));
            }

            if (ShouldCycloneStrike())
            {
                return(CycloneStrike());
            }

            if (ShouldSevenSidedStrike(out target))
            {
                return(SevenSidedStrike(target));
            }

            if (!WeightedUnits.Any(u => u.Distance < 20f && HasEP(u)))
            {
                return(GetExplodingPalmPrimary());
            }

            return(GetPrimary());
        }
Ejemplo n.º 20
0
        protected bool TryBuffPower(out TrinityPower power)
        {
            power = null;
            Vector3 position;

            if (ShouldSummonZombieDogs(out position))
            {
                power = IsInCombat ? SummonZombieDogs(position) : SummonZombieDogs();
            }

            else if (ShouldGargantuan(out position))
            {
                power = IsInCombat ? Gargantuan(position) : Gargantuan();
            }

            else if (ShouldSpiritWalk())
            {
                power = SpiritWalk();
            }

            else if (ShouldFetishArmy())
            {
                power = FetishArmy();
            }

            return(power != null);
        }
Ejemplo n.º 21
0
        => Player.HasBuff((SNOPower)451237);     //P42_ItemPassive_Unique_Ring_002' (451237)


        #endregion

        #region Helpers

        protected bool TryPrimaryPower(out TrinityPower power)
        {
            TrinityActor target;

            power = null;

            if (ShouldBash(out target))
            {
                power = Bash(target);
            }

            else if (ShouldCleave(out target))
            {
                power = Cleave(target);
            }

            else if (ShouldFrenzy(out target))
            {
                power = Frenzy(target);
            }

            else if (ShouldWeaponThrow(out target))
            {
                power = WeaponThrow(target);
            }

            return(power != null);
        }
Ejemplo n.º 22
0
        protected bool TryPrimaryPower(out TrinityPower power)
        {
            TrinityActor target;

            power = null;

            if (ShouldFistsOfThunder(out target))
            {
                power = FistsOfThunder(target);
            }

            else if (ShouldDeadlyReach(out target))
            {
                power = DeadlyReach(target);
            }

            else if (ShouldCripplingWave(out target))
            {
                power = CripplingWave(target);
            }

            else if (ShouldWayOfTheHundredFists(out target))
            {
                power = WayOfTheHundredFists(target);
            }

            return(power != null);
        }
Ejemplo n.º 23
0
        public static void RecordSpell(TrinityPower power)
        {
            if (_history.Count >= SpellHistorySize)
            {
                _history.RemoveAt(0);
            }

            var skill = SkillUtils.ById(power.SNOPower);

            if (skill.IsAttackSpender)
            {
                _lastSpenderCast = DateTime.UtcNow;
            }

            if (skill.IsGeneratorOrPrimary)
            {
                _lastGeneratorCast = DateTime.UtcNow;
            }

            _history.Add(new SpellHistoryItem
            {
                Power          = power,
                UseTime        = DateTime.UtcNow,
                MyPosition     = Trinity.Player.Position,
                TargetPosition = power.TargetPosition
            });

            Logger.LogVerbose(LogCategory.Targetting, "Recorded {0}", power);

            CacheData.AbilityLastUsed[power.SNOPower] = DateTime.UtcNow;
            Trinity.LastPowerUsed = power.SNOPower;
        }
Ejemplo n.º 24
0
        protected bool TryMantra(out TrinityPower power)
        {
            power = null;

            if (ShouldMantraOfConviction())
            {
                power = MantraOfConviction();
            }

            if (ShouldMantraOfHealing())
            {
                power = MantraOfHealing();
            }

            if (ShouldMantraOfRetribution())
            {
                power = MantraOfRetribution();
            }

            if (ShouldMantraOfSalvation())
            {
                power = MantraOfSalvation();
            }

            return(power != null);
        }
Ejemplo n.º 25
0
        public static void RecordSpell(TrinityPower power)
        {
            if (_historyQueue.Count >= SpellHistorySize)
                _historyQueue.RemoveAt(_historyQueue.Count() - 1);

            var skill = SkillUtils.ById(power.SNOPower);
            
            if(skill.IsAttackSpender)
                _lastSpenderCast = DateTime.UtcNow;

            if (skill.IsGeneratorOrPrimary)
                _lastGeneratorCast = DateTime.UtcNow;

            _historyQueue.Add(new SpellHistoryItem
            {
                Power = power,
                UseTime = DateTime.UtcNow,
                MyPosition = Trinity.Player.Position,
                TargetPosition = power.TargetPosition
            });
            //Logger.Log("Recorded {0}", power);

            CacheData.AbilityLastUsed[power.SNOPower] = DateTime.UtcNow;
            Trinity.LastPowerUsed = power.SNOPower;
        }
Ejemplo n.º 26
0
        protected bool TryCorpsePower(out TrinityPower power)
        {
            TrinityActor target;
            Vector3      position;

            power = null;

            if (ShouldCorpseExplosion(out position))
            {
                power = CorpseExplosion(position);
            }

            else if (ShouldCorpseLance(out target))
            {
                power = CorpseLance(target);
            }

            else if (ShouldDevour())
            {
                power = Devour();
            }

            else if (ShouldRevive(out position))
            {
                power = Revive(position);
            }

            return(power != null);
        }
Ejemplo n.º 27
0
        protected bool TryBloodPower(out TrinityPower power)
        {
            TrinityActor target;
            Vector3      position;

            power = null;

            if (ShouldBoneArmor())
            {
                power = BoneArmor();
            }

            else if (ShouldBloodRush(out position))
            {
                power = BloodRush(position);
            }

            else if (ShouldSimulacrum(out position))
            {
                power = Simulacrum(position);
            }

            else if (ShouldBoneSpirit(out target))
            {
                power = BoneSpirit(target);
            }

            return(power != null);
        }
Ejemplo n.º 28
0
        protected bool TrySpecialPower(out TrinityPower power)
        {
            TrinityActor target;
            Vector3      position;

            power = null;

            if (ShouldHorrify())
            {
                power = Horrify();
            }

            else if (ShouldBigBadVoodoo(out position))
            {
                power = BigBadVoodoo(position);
            }

            else if (ShouldWallOfDeath(out target))
            {
                power = WallOfDeath(target);
            }

            else if (ShouldExplodeChicken(out position))
            {
                power = ExplodeChicken(position);
            }

            else if (ShouldHex(out position))
            {
                power = Hex(position);
            }

            else if (ShouldAcidCloud(out target))
            {
                power = AcidCloud(target);
            }

            else if (ShouldSacrifice())
            {
                power = Sacrifice();
            }

            else if (ShouldMassConfusion())
            {
                power = MassConfusion();
            }

            else if (ShouldPiranhas(out target))
            {
                power = Piranhas(target);
            }

            else if (ShouldSoulHarvest(out position))
            {
                power = SoulHarvest(position);
            }

            return(power != null);
        }
Ejemplo n.º 29
0
 public void SetCurrentPower(TrinityPower power)
 {
     if (CurrentPower != null)
     {
         LastPower = CurrentPower;
     }
     CurrentPower = power;
 }
Ejemplo n.º 30
0
        public bool IsInRange(Vector3 position, TrinityPower power)
        {
            if (position == Vector3.Zero)
            {
                return(false);
            }

            if (power == null ||
                power.SNOPower == SNOPower.None)
            {
                return(false);
            }

            if (power.IsCastOnSelf)
            {
                return(true);
            }

            if (power.CastWhenBlocked &&
                PlayerMover.IsBlocked)
            {
                return(true);
            }

            if (GameData.ForceSameZDiffSceneSnoIds.Contains(Core.Player.CurrentSceneSnoId) &&
                Math.Abs(position.Z - Core.Player.Position.Z) > 2)
            {
                return(false);
            }

            var rangeRequired = Math.Max(1f, power.MinimumRange);
            var distance      = position.Distance(Core.Player.Position);

            TrinityActor currentTarget = TrinityCombat.Targeting.CurrentTarget;

            if (Core.Player.IsInBossEncounter &&
                currentTarget != null)
            {
                var positionIsBoss = currentTarget.IsBoss &&
                                     currentTarget.Position.Distance(position) < 10f;
                if (positionIsBoss)
                {
                    rangeRequired += currentTarget.CollisionRadius;
                }
            }

            s_logger.Verbose($"[{nameof(IsInRange)}] >> CurrentPower={power} CurrentTarget={position} RangeReq:{rangeRequired} Dist:{distance}");

            // Handle Belial differently, he's never in LineOfSight.
            if (Core.Player.IsInBossEncounter &&
                currentTarget != null &&
                currentTarget.ActorSnoId == SNOActor.Belial)
            {
                return(distance <= rangeRequired);
            }

            return(distance <= rangeRequired && (distance <= 7.0f || IsInLineOfSight(position)));
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Returns an appropriately selected TrinityPower and related information
        /// </summary>
        /// <returns></returns>
        internal static TrinityPower AbilitySelector()
        {
            using (new PerformanceLogger("AbilitySelector"))
            {
                // See if archon just appeared/disappeared, so update the hotbar
                if (Trinity.ShouldRefreshHotbarAbilities || Trinity.HotbarRefreshTimer.ElapsedMilliseconds > 5000)
                {
                    PlayerInfoCache.RefreshHotbar();
                }

                // Switch based on the cached character class

                TrinityPower power = CurrentPower;

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

                    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 = GetWitchDoctorPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower);
                        //    break;
                        //// Demon Hunters
                        //case ActorClass.DemonHunter:
                        //    power = GetDemonHunterPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower);
                        //    break;
                    }
                }
                // use IEquatable to check if they're equal
                if (CurrentPower == power)
                {
                    Logger.Log(TrinityLogLevel.Debug, LogCategory.Behavior, "Keeping {0}", CurrentPower.ToString());
                    return(CurrentPower);
                }
                if (power != null)
                {
                    Logger.Log(TrinityLogLevel.Debug, LogCategory.Behavior, "Selected new {0}", power.ToString());
                    return(power);
                }
                return(DefaultPower);
            }
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Check if a power is null
 /// </summary>
 /// <param name="power"></param>
 protected static bool IsNull(TrinityPower power)
 {
     return power == null;
 }
Ejemplo n.º 33
0
        public static TrinityPower GetPower()
        {
            TrinityPower power;

            if (UseDestructiblePower)
                return DestroyObjectPower;

            if (UseOOCBuff)
            {
                // Call of The Ancients
                if (CanUseCallOfTheAncients && Sets.ImmortalKingsCall.IsFullyEquipped)
                    return PowerCallOfTheAncients;

                // Sprint OOC
                if (CanUseSprintOOC)
                    return PowerSprint;
            }
            else
            {
                if (QueuedPower != null && !Player.IsIncapacitated && PowerManager.CanCast(QueuedPower.SNOPower) && !Player.IsCastingOrLoading)
                {
                    Logger.LogVerbose(LogCategory.Behavior, "Casting Queued Power {0}", QueuedPower);
                    var next = QueuedPower;
                    QueuedPower.MaxFailedCastReTryAttempts = 5;
                    QueuedPower.WaitBeforeUseDelay = 750;
                    QueuedPower = null;
                    return next;
                }
            }

            // Ignore Pain when near Frozen
            if ((ZetaDia.Me.IsFrozen || ZetaDia.Me.IsRooted || Trinity.ObjectCache.Any(o => o.AvoidanceType == AvoidanceType.IceBall)) && CanCastIgnorePain)
            {
                Logger.Log("Used Ignore Pain to prevent Frozen");
                return PowerIgnorePain;
            }

            if (!UseOOCBuff)
            {
                // Refresh Frenzy
                if (CanCast(SNOPower.Barbarian_Frenzy) && TimeSincePowerUse(SNOPower.Barbarian_Frenzy) > 3000 && TimeSincePowerUse(SNOPower.Barbarian_Frenzy) < 4000)
                    return PowerFrenzy;

                // Refresh Bash - Punish
                if (CanCast(SNOPower.Barbarian_Bash) && TimeSincePowerUse(SNOPower.Barbarian_Bash) > 4000 && TimeSincePowerUse(SNOPower.Barbarian_Bash) < 5000)
                    return PowerBash;
            }

            // Ignore Pain when low on health
            if (CanCastIgnorePain)
                return PowerIgnorePain;

            // WOTB
            if (CanUseWrathOfTheBerserker)
                return PowerWrathOfTheBerserker;

            // Call of the Ancients
            if (CanUseCallOfTheAncients)
                return PowerCallOfTheAncients;

            // Leap with Earth Set.
            if (CanUseLeap && Sets.MightOfTheEarth.IsThirdBonusActive)
                return PowerLeap;

            // Earthquake
            if (CanUseEarthquake)
                return PowerEarthquake;

            // Avalanche
            if (CanUseAvalanche)
                return PowerAvalanche;

            // War Cry
            if (CanUseWarCry)
                return PowerWarCry;

            // Battle Rage
            if (CanUseBattleRage)
                return PowerBattleRage;

            // Rend
            if (CanUseRend)
                return PowerRend;

            // Overpower
            if (CanUseOverPower)
                return PowerOverpower;

            // Threatening Shout
            if (CanUseThreatingShout)
                return PowerThreateningShout;

            // Ground Stomp
            if (CanUseGroundStomp)
                return PowerGroundStomp;

            // Revenge
            if (CanUseRevenge)
                return PowerRevenge;

            // Ancient Spear
            if (CanUseAncientSpear)
                return PowerAncientSpear;

            // Sprint
            if (CanUseSprint)
                return PowerSprint;

            // Furious Charge
            if (CanUseFuriousCharge)
                return PowerFuriousCharge;

            // Leap
            if (CanUseLeap)
                return PowerLeap;

            // Seismic Slam
            if (CanUseSeismicSlam)
                return PowerSeismicSlam;

            // Bash to 3 stacks (Punish)
            if (CanUseBashTo3)
                return PowerBash;

            // Frenzy to 5 stacks (Maniac)
            if (CanUseFrenzyTo5)
                return PowerFrenzy;

            // HOTA Elites
            if (CanUseHammerOfTheAncientsElitesOnly)
                return PowerHammerOfTheAncients;

            // Whirlwind
            if (CanUseWhirlwind)
                return PowerWhirlwind;

            // Hammer of the Ancients
            if (CanUseHammerOfTheAncients)
                return PowerHammerOfTheAncients;

            // Weapon Throw
            if (CanUseWeaponThrow)
                return PowerWeaponThrow;

            // Frenzy Fury Generator
            if (CanUseFrenzy)
                return PowerFrenzy;

            // Bash Fury Generator
            if (CanUseBash)
                return PowerBash;

            // Cleave Fury Generator
            if (CanUseCleave)
                return PowerCleave;

            // Default Attacks
            return DefaultPower;

            return power;
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Cast this speed using TrinityPower
 /// </summary>
 public void Cast(TrinityPower power)
 {
     Cast(power.TargetPosition, power.TargetACDGUID);
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Some sugar for Null/Invalid checking on given power;
 /// </summary>
 public static bool TryGetPower(TrinityPower powerToCheck, out TrinityPower power)
 {
     power = powerToCheck;
     return (power != null && power.SNOPower != SNOPower.None && power != DefaultPower);
 }