private bool IgnoreCondition()
        {
            var isArcaneTorrentSelected = TrinityCombat.Targeting.CurrentPower?.SNOPower == SNOPower.Wizard_ArcaneTorrent;
            var isInAvoidance           = Core.Avoidance.InCriticalAvoidance(Player.Position);

            if (isArcaneTorrentSelected && TargetUtil.AnyMobsInRange(30f) && Player.CurrentHealthPct > 0.5f && !isInAvoidance)
            {
                return(true);
            }

            return(Player.IsChannelling && Player.CurrentHealthPct > 0.35);
        }
Exemple #2
0
        protected virtual bool ShouldRevenge(out Vector3 position)
        {
            position = Vector3.Zero;

            if (!Skills.Barbarian.Revenge.CanCast())
            {
                return(false);
            }

            position = TargetUtil.GetBestClusterPoint();
            return(position != Vector3.Zero);
        }
        protected override bool ShouldArcaneTorrent(out TrinityActor target)
        {
            target = null;

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

            target = TargetUtil.GetBestClusterUnit(15f, 40f) ?? CurrentTarget;
            return(target != null);
        }
Exemple #4
0
        private bool IgnoreCondition()
        {
            var isFirebatsSelected = TrinityCombat.Targeting.CurrentPower?.SNOPower == SNOPower.Witchdoctor_Firebats;
            var isInAvoidance      = Core.Avoidance.InCriticalAvoidance(Player.Position);

            if (isFirebatsSelected && TargetUtil.AnyMobsInRange(FireBatsRange) && Player.CurrentHealthPct > 0.5f && !isInAvoidance)
            {
                return(true);
            }

            return(Player.IsChannelling && Player.CurrentHealthPct > 0.35 && !Core.Avoidance.InCriticalAvoidance(Player.Position));
        }
Exemple #5
0
        protected virtual bool ShouldBlackHole(out TrinityActor target)
        {
            target = null;

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

            target = TargetUtil.GetBestClusterUnit() ?? CurrentTarget;
            return(target != null);
        }
Exemple #6
0
        protected virtual bool ShouldArchonDisintegrationWave(out TrinityActor target)
        {
            target = null;

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

            target = TargetUtil.GetBestClusterUnit() ?? CurrentTarget;
            return(target != null);
        }
Exemple #7
0
        public bool CanTeleportTo(Vector3 destination)
        {
            if (destination == Vector3.Zero)
            {
                return(false);
            }

            if (!CanTeleport)
            {
                return(false);
            }

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

            if (destinationDistance < 15f && !PlayerMover.IsBlocked)
            {
                return(false);
            }

            // Prevent moving away from stuff that needs to be interacted with.
            if (ZetaDia.Actors.GetActorsOfType <DiaGizmo>().Any(g => g.Distance < 10f && g.ActorInfo.GizmoType != GizmoType.DestroyableObject))
            {
                return(false);
            }

            if (!IsArchonActive)
            {
                // Prevent moving somewhere we'll just kite away from.
                if (KiteMode != KiteMode.Never && KiteDistance > 0 && TargetUtil.AnyMobsInRangeOfPosition(destination, KiteDistance) && Player.CurrentHealthPct > KiteHealthPct)
                {
                    return(false);
                }

                // Dont move from outside avoidance into avoidance.
                if (!Core.Avoidance.InAvoidance(ZetaDia.Me.Position) && Core.Avoidance.Grid.IsLocationInFlags(destination, AvoidanceFlags.Avoidance))
                {
                    return(false);
                }
            }

            // Don't move into molten core/arcane.
            if (!Core.Avoidance.InCriticalAvoidance(ZetaDia.Me.Position) && Core.Avoidance.Grid.IsIntersectedByFlags(ZetaDia.Me.Position, destination, AvoidanceFlags.CriticalAvoidance))
            {
                return(false);
            }

            if (Skills.Wizard.Teleport.TimeSinceUse < 200)
            {
                return(false);
            }

            return(true);
        }
Exemple #8
0
        protected virtual bool ShouldRainOfVengeance(out TrinityActor target)
        {
            target = null;

            if (!Skills.DemonHunter.RainOfVengeance.CanCast())
            {
                return(false);
            }

            target = TargetUtil.GetBestClusterUnit() ?? CurrentTarget;
            return(target != null);
        }
Exemple #9
0
        protected virtual bool ShouldEntanglingShot(out TrinityActor target)
        {
            target = null;

            if (!Skills.DemonHunter.EntanglingShot.CanCast())
            {
                return(false);
            }

            target = TargetUtil.GetBestClusterUnit() ?? CurrentTarget;
            return(target != null);
        }
Exemple #10
0
        protected virtual bool ShouldRevive(out Vector3 position)
        {
            position = Vector3.Zero;

            if (!Skills.Necromancer.Revive.CanCast())
            {
                return(false);
            }

            position = TargetUtil.GetBestCorpsePoint(80f, 20f);
            return(position != Vector3.Zero);
        }
Exemple #11
0
        protected virtual bool ShouldGrimScythe(out TrinityActor target)
        {
            target = null;

            if (!Skills.Necromancer.GrimScythe.CanCast())
            {
                return(false);
            }

            target = TargetUtil.GetBestClusterUnit() ?? CurrentTarget;
            return(target != null);
        }
Exemple #12
0
        protected virtual bool ShouldBombardment(out TrinityActor target)
        {
            target = null;

            if (!Skills.Crusader.Bombardment.CanCast())
            {
                return(false);
            }

            target = TargetUtil.GetBestClusterUnit() ?? CurrentTarget;
            return(target != null);
        }
        public TrinityPower GetOffensivePower()
        {
            TrinityPower power;
            TrinityActor target;
            Vector3      position;

            if (ShouldLeap(out position))
            {
                return(Leap(position));
            }

            // Siesemic Slam variant - Make sure damage buff is up before earthquake
            if (Legendary.GirdleOfGiants.IsEquipped && (Skills.Barbarian.Earthquake.CanCast() || Skills.Barbarian.Leap.IsActive) && !IsGirdleOfGiantsBuffActive)
            {
                return(SeismicSlam(TargetUtil.GetBestClusterUnit(30f) ?? CurrentTarget));
            }

            if (Skills.Barbarian.Avalanche.CanCast())
            {
                return(Avalanche(Player.Position));
            }

            // Use cave in rune to group monsters before spear.
            if (Skills.Barbarian.Earthquake.CanCast())
            {
                return(Earthquake(Player.Position));
            }

            // Spend resource to reduce leap cooldown
            if (ShouldAncientSpear(out target))
            {
                return(AncientSpear(target));
            }

            // Fallback to defaults in case of minor variations.
            if (TrySpecialPower(out power))
            {
                return(power);
            }

            if (TrySecondaryPower(out power))
            {
                return(power);
            }

            if (TryPrimaryPower(out power))
            {
                return(power);
            }

            return(Walk(Avoider.SafeSpot));
        }
Exemple #14
0
        protected override bool ShouldFuriousCharge(out Vector3 position)
        {
            position = Vector3.Zero;

            if (!Skills.Barbarian.FuriousCharge.CanCast())
            {
                return(false);
            }

            if (!TargetUtil.AnyMobsInRange(60f))
            {
                return(false);
            }

            if (Core.Avoidance.Grid.IsIntersectedByFlags(ZetaDia.Me.Position, position, AvoidanceFlags.CriticalAvoidance))
            {
                return(false);
            }

            // Try to charge to Occulus AoE before the Whack-a-mole frenzy begins
            Vector3 bestBuffedPosition;
            var     bestClusterPoint = TargetUtil.GetBestClusterPoint();

            if (TargetUtil.BestBuffPosition(60f, bestClusterPoint, false, out bestBuffedPosition) &&
                Player.Position.Distance2D(bestBuffedPosition) > 10f && bestBuffedPosition != Vector3.Zero &&
                !ShouldWaitForConventionofElements(Skills.Crusader.Provoke, Element.Fire, 350))
            {
                Core.Logger.Log($"Found buff position - distance: {Player.Position.Distance(bestBuffedPosition)} ({bestBuffedPosition})");
                position = bestBuffedPosition;

                return(position != Vector3.Zero);
            }

            var chargeStacks = Core.Buffs.GetBuffStacks(SNOPower.P2_ItemPassive_Unique_Ring_026);

            if (Core.Buffs.ConventionElement == Element.Fire && chargeStacks > 0)
            {
                return(false);
            }

            // Quickest way to build stacks is to charge in place (if we can get a refund for every charge)
            var twelveYardsUnitCount = TargetUtil.UnitsInRangeOfPosition(Player.Position, 12f).Count(u => u.IsUnit);
            var twentyYardsUnitCount = TargetUtil.UnitsInRangeOfPosition(Player.Position, 20f).Count(u => u.IsUnit);

            if (twelveYardsUnitCount >= 3 || twentyYardsUnitCount == 1)
            {
                position = Player.Position;
            }
            position = TargetUtil.GetBestClusterPoint(15f, 20f, true, false);

            return(position != Vector3.Zero);
        }
Exemple #15
0
 public virtual async Task <bool> HandleOutsideCombat()
 {
     if (!Core.Player.IsCasting &&
         (!TargetUtil.AnyMobsInRange(20f) ||
          !Core.Player.IsTakingDamage))
     {
         if (await Behaviors.MoveToMarker.While(m => m.MarkerType == WorldMarkerType.LegendaryItem || m.MarkerType == WorldMarkerType.SetItem))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #16
0
 public TrinityPower GetMovementPower(Vector3 destination)
 {
     if (CanChargeTo(destination) && AllowedToUse(Settings.FuriousCharge, Skills.Barbarian.FuriousCharge) &&
         Skills.Barbarian.FuriousCharge.Charges > 1)
     {
         if (IsInCombat && TargetUtil.PierceHitsMonster(destination) ||
             Player.Position.Distance(destination) > 20f)
         {
             return(FuriousCharge(destination));
         }
     }
     return(Walk(destination));
 }
Exemple #17
0
        protected override bool ShouldHammerOfTheAncients(out TrinityActor target)
        {
            target = null;
            var skill = Skills.Barbarian.HammerOfTheAncients;

            if (!skill.CanCast() || Player.PrimaryResource < PrimaryEnergyReserve)
            {
                return(false);
            }

            target = TargetUtil.ClosestUnit(30f, u => u.IsInLineOfSight) ?? CurrentTarget;
            return(target != null);
        }
Exemple #18
0
        protected virtual bool ShouldTempestRush(out Vector3 position)
        {
            position = Vector3.Zero;

            if (!Skills.Monk.TempestRush.CanCast())
            {
                return(false);
            }

            position = TargetUtil.GetBestPiercePoint(50f);

            return(position != Vector3.Zero);
        }
        protected override bool ShouldWallOfDeath(out TrinityActor target)
        {
            target = null;

            if (!Skills.WitchDoctor.WallOfDeath.CanCast())
            {
                return(false);
            }

            target = TargetUtil.BestAoeUnit(35, true);

            return(target != null);
        }
        protected override bool ShouldLeap(out Vector3 position)
        {
            // Always Leap

            position = Vector3.Zero;
            if (!Skills.Barbarian.Leap.CanCast())
            {
                return(false);
            }

            position = TargetUtil.GetBestClusterPoint();
            return(position != Vector3.Zero);
        }
Exemple #21
0
        protected bool IsReasonToUse(SkillSettings settings, Skill skill)
        {
            var routine = Core.Routines.CurrentRoutine;

            if (settings.Reasons.HasFlag(UseReasons.Elites) && TargetUtil.AnyElitesInRange(40f))
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Trash) && TargetUtil.ClusterExists(routine.TrashRange, routine.TrashRange, routine.ClusterSize))
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Surrounded) && TargetUtil.NumMobsInRange(25f) >= Math.Max(ClusterSize, 5))
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Avoiding) && IsCurrentlyAvoiding)
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Blocked) && PlayerMover.IsBlocked)
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.DumpResource) && Player.PrimaryResourcePct < 0.8f)
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Goblins) && WeightedUnits.Any(u => u.IsTreasureGoblin))
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.HealthEmergency) && Player.CurrentHealthPct < TrinityCombat.Routines.Current.EmergencyHealthPct)
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Buff) && settings.BuffCondition != null && settings.BuffCondition())
            {
                return(true);
            }

            return(false);
        }
        public TrinityPower GetBuffPower()
        {
            Vector3 position;

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

            if (ShouldGargantuan(out position))
            {
                return(IsInCombat ? Gargantuan(position) : Gargantuan());
            }

            if (Settings.SpiritWalk.UseMode == UseTime.Always && !Player.IsInTown && Skills.WitchDoctor.SpiritWalk.CanCast())
            {
                return(SpiritWalk());
            }

            if (ShouldSpiritWalk())
            {
                return(SpiritWalk());
            }

            if (ShouldFetishArmy())
            {
                return(FetishArmy());
            }

            if (Skills.WitchDoctor.WallOfDeath.CanCast() && IsInCombatOrBeingAttacked)
            {
                return(WallOfDeath(TargetUtil.GetBestClusterPoint()));
            }

            if (Skills.WitchDoctor.SoulHarvest.CanCast() && (!IsChannellingFirebats || Player.CurrentHealthPct < 0.4f) && HostileMonsters.Any(u => u.Distance < 16f))
            {
                // Refresh the buff time to avoid losing 10 stacks.
                if (Skills.WitchDoctor.SoulHarvest.TimeSinceUse > 4500)
                {
                    return(SoulHarvest());
                }

                // Build some stacks
                if (Skills.WitchDoctor.SoulHarvest.BuffStacks < MaxSoulHarvestStacks)
                {
                    return(SoulHarvest());
                }
            }

            return(null);
        }
Exemple #23
0
        public virtual bool CanStrafeTo(Vector3 destination)
        {
            if (!Skills.DemonHunter.Strafe.CanCast())
            {
                return(false);
            }

            if (!TargetUtil.AnyMobsInRange(50f))
            {
                return(false);
            }

            return(true);
        }
Exemple #24
0
        protected virtual bool ShouldDeathNova()
        {
            if (!Skills.Necromancer.DeathNova.CanCast())
            {
                return(false);
            }

            if (Player.PrimaryResource < PrimaryEnergyReserve)
            {
                return(false);
            }

            return(TargetUtil.AnyMobsInRange(15f));
        }
Exemple #25
0
        protected virtual bool ShouldHorrify()
        {
            if (!Skills.WitchDoctor.Horrify.CanCast())
            {
                return(false);
            }

            if (!TargetUtil.AnyMobsInRange(15f))
            {
                return(false);
            }

            return(true);
        }
Exemple #26
0
        protected virtual bool ShouldMirrorImage()
        {
            if (!Skills.Wizard.MirrorImage.CanCast())
            {
                return(false);
            }

            if (!TargetUtil.AnyMobsInRange(30f))
            {
                return(false);
            }

            return(true);
        }
        public TrinityPower GetOffensivePower()
        {
            Vector3      position;
            TrinityActor target;
            TrinityPower power;

            if (ShouldContinueChanneling(out target))
            {
                return(ArcaneTorrent(target));
            }

            if (ShouldWalkToTarget(out target))
            {
                return(Walk(target));
            }

            if (ShouldTeleport(out position))
            {
                return(Teleport(position));
            }

            if (ShouldFrostNova())
            {
                return(FrostNova());
            }

            if (ShouldFamiliar())
            {
                return(Familiar());
            }

            if (ShouldMeteor(out target))
            {
                return(Meteor(target));
            }

            if (ShouldArcaneTorrent(out target))
            {
                return(ArcaneTorrent(target));
            }

            if (TryPrimaryPower(out power))
            {
                return(power);
            }

            Core.Avoidance.Avoider.TryGetSafeSpot(out position, 15f, 40f, Player.Position,
                                                  node => !TargetUtil.AnyMobsInRangeOfPosition(node.NavigableCenter));
            return(Walk(position));
        }
        protected override bool ShouldFrostNova()
        {
            if (!Skills.Wizard.FrostNova.CanCast())
            {
                return(false);
            }

            if (!TargetUtil.AnyMobsInRange(60f))
            {
                return(false);
            }

            return(true);
        }
        public TrinityPower GetBuffPower()
        {
            Vector3 position;

            if (!IsArchonActive && Skills.Wizard.Archon.CanCast() && !Player.IsInTown)
            {
                if (Settings.GetStacksBeforeArchon && !HasTalRashaStacks)
                {
                    //Core.Logger.Log($"Building Tal'Rasha Set Stacks ({TalRashaStacks})");

                    var target = TargetUtil.GetBestClusterUnit(70f) ?? Player.Actor;
                    if (target == null || !target.IsValid)
                    {
                        return(DefaultBuffPower());
                    }

                    if (Skills.Wizard.FrostNova.CanCast())
                    {
                        return(FrostNova());
                    }

                    if (Skills.Wizard.Blizzard.CanCast())
                    {
                        return(Blizzard(target));
                    }

                    if (Skills.Wizard.BlackHole.CanCast())
                    {
                        return(BlackHole(target));
                    }

                    if (TalRashaStacks == 2 && Skills.Wizard.Teleport.CanCast())
                    {
                        return(Teleport(target.Position));
                    }

                    // AT is never on cooldown so we can use it last.
                    if (TalRashaStacks == 3 && Skills.Wizard.ArcaneTorrent.CanCast())
                    {
                        return(ArcaneTorrent(target));
                    }
                }
                else
                {
                    return(Archon());
                }
            }

            return(DefaultBuffPower());
        }
        protected override bool ShouldLawsOfHope()
        {
            if (!Skills.Crusader.LawsOfHope.CanCast())
            {
                return(false);
            }

            if (!TargetUtil.AnyMobsInRange(25f))
            {
                return(false);
            }

            return(true);
        }