public TrinityPower GetOffensivePower() { TrinityActor target = CurrentTarget; Vector3 position = Vector3.Zero; if (CurrentTarget != null && (!CurrentTarget.IsBoss || (CurrentTarget.IsElite && CurrentTarget.EliteType == EliteTypes.Minion))) { target = TargetUtil.BestRangedAoeUnit(50) ?? CurrentTarget; } if (!Core.Buffs.HasBuff(445266) && Player.PrimaryResource > 36) { return(new TrinityPower(Skills.DemonHunter.Impale)); } position = MathEx.CalculatePointFrom(target.Position, ZetaDia.Me.Position, 15); if ((target.Distance > 15 || ((Legendary.ElusiveRing.IsEquipped || Legendary.ElusiveRing.IsEquippedInCube) && Skills.DemonHunter.Vault.TimeSinceUse > 6000)) && Core.Grids.CanRayWalk(Player.Position, position)) { return(Vault(position)); } if (Skills.DemonHunter.Impale.CanCast()) { return(new TrinityPower(Skills.DemonHunter.Impale, Player.CurrentHealthPct < 0.45 ? 30f : 15f, target.AcdId)); } return(null); }
private RunStatus Move() { if (Position.Distance2D(ZetaDia.Me.Position) > PathPrecision) { NavTarget = Position; double timeSinceLastGenerated = DateTime.Now.Subtract(lastGeneratedNavPoint).TotalMilliseconds; if (Position.Distance2D(ZetaDia.Me.Position) > PathPointLimit && timeSinceLastGenerated > maxNavPointAgeMs) { // generate a local client pathing point NavTarget = MathEx.CalculatePointFrom(ZetaDia.Me.Position, Position, Position.Distance2D(ZetaDia.Me.Position) - PathPointLimit); } if (StraightLinePathing) { // just "Click" Navigator.PlayerMover.MoveTowards(Position); } else { // Use the Navigator or PathFinder mr = QTNavigator.MoveTo(NavTarget, status(), true, UseNavigator); } LogStatus(); return(RunStatus.Success); } else { return(RunStatus.Failure); } }
private Vector3 CalculateAttackPosition(Vector3 destination) { if (Runes.Monk.SweepingArmada.IsActive && CurrentTarget?.Position.Distance(destination) <= 4f && CurrentTarget.IsUnit) return MathEx.CalculatePointFrom(CurrentTarget.Position, destination, AttackRange); return destination; }
private MoveResult Move() { if (Position.Distance2D(ZetaDia.Me.Position) <= PathPrecision) { return(MoveResult.ReachedDestination); } _navTarget = Position; double timeSinceLastGenerated = DateTime.UtcNow.Subtract(_lastGeneratedNavPoint).TotalMilliseconds; if (Position.Distance2D(ZetaDia.Me.Position) > PathPointLimit && timeSinceLastGenerated > MaxNavPointAgeMs) { // generate a local client pathing point _navTarget = MathEx.CalculatePointFrom(ZetaDia.Me.Position, Position, Position.Distance2D(ZetaDia.Me.Position) - PathPointLimit); } MoveResult moveResult; if (StraightLinePathing) { // just "Click" Navigator.PlayerMover.MoveTowards(Position); moveResult = MoveResult.Moved; } else { // Use the Navigator or PathFinder moveResult = _qtNavigator.MoveTo(_navTarget, Status()); } LogStatus(); return(moveResult); }
/// <summary> /// Safely Moves the player to the requested destination <seealso cref="MoveToMapMarker.PathPointLimit"/> /// </summary> /// <param name="newpos">Vector3 of the new position</param> /// <param name="destinationName">For logging purposes</param> /// <returns></returns> private bool Move(Vector3 newpos, string destinationName = "") { bool result = false; if (StraightLinePathing) { Navigator.PlayerMover.MoveTowards(newpos); lastMoveResult = MoveResult.Moved; result = true; } if (!ZetaDia.WorldInfo.IsGenerated) { if (clientNavFailed && PathPointLimit > 20) { PathPointLimit = PathPointLimit - 10; } else if (clientNavFailed && PathPointLimit <= 20) { PathPointLimit = 250; } if (newpos.Distance(ZetaDia.Me.Position) > PathPointLimit) { newpos = MathEx.CalculatePointFrom(ZetaDia.Me.Position, newpos, newpos.Distance(ZetaDia.Me.Position) - PathPointLimit); } } float destinationDistance = newpos.Distance(ZetaDia.Me.Position); lastMoveResult = QTNavigator.MoveTo(newpos, destinationName + String.Format(" distance={0:0}", destinationDistance), true); switch (lastMoveResult) { case MoveResult.Moved: case MoveResult.ReachedDestination: case MoveResult.UnstuckAttempt: clientNavFailed = false; result = true; break; case MoveResult.PathGenerated: case MoveResult.PathGenerating: case MoveResult.PathGenerationFailed: case MoveResult.Failed: Navigator.PlayerMover.MoveTowards(Position); result = false; clientNavFailed = true; break; } if (QuestTools.EnableDebugLogging) { Logging.WriteDiagnostic("[MoveToMapMarker] MoveResult: {0}, newpos={1} Distance={2}, destinationName={3}", lastMoveResult.ToString(), newpos, newpos.Distance(ZetaDia.Me.Position), destinationName); } return(result); }
private bool WithinInteractRange() { if (!ZetaDia.IsInGame) { return(false); } if (ZetaDia.IsLoadingWorld) { return(false); } if (ZetaDia.Me == null) { return(false); } if (!ZetaDia.Me.IsValid) { return(false); } if (ZetaDia.Me.HitpointsCurrent <= 0) { return(false); } if (actor != null && actor.IsValid) { float distance = ZetaDia.Me.Position.Distance2D(actor.Position); float radiusDistance = actor.Distance - actor.CollisionSphere.Radius; Vector3 radiusPoint = MathEx.CalculatePointFrom(actor.Position, ZetaDia.Me.Position, actor.CollisionSphere.Radius); if (moveResult == MoveResult.ReachedDestination) { interactReason = "ReachedDestination"; return(true); } if (distance < 7.5f) { interactReason = "Distance < 7.5f"; return(true); } if (distance < InteractRange && actor.InLineOfSight && !Navigator.Raycast(ZetaDia.Me.Position, radiusPoint)) { interactReason = "InLoSRaycast"; return(true); } if (radiusDistance < 5f) { interactReason = "Radius < 2.5f"; return(true); } return(false); } interactReason = "DefaultInteractRange"; return(ZetaDia.Me.Position.Distance(Position) < InteractRange); }
public override void Initialize() { Cooldown = 10000; ExecutionType = AbilityExecuteFlags.ClusterLocation | AbilityExecuteFlags.ZigZagPathing; WaitVars = new WaitLoops(1, 1, true); Range = 48; UseageType = AbilityUseage.Anywhere; IsASpecialMovementPower = true; Priority = AbilityPriority.High; PreCast = new SkillPreCast((AbilityPreCastFlags.CheckPlayerIncapacitated | AbilityPreCastFlags.CheckCanCast)); ClusterConditions = new SkillClusterConditions(5d, 48f, 2, false, minDistance: 15f); FcriteriaCombat = () => { return((Bot.Settings.Class.bTeleportFleeWhenLowHP && (Bot.Character.Data.dCurrentHealthPct < 0.5d) || (Bot.Targeting.Cache.RequiresAvoidance)) || (Bot.Settings.Class.bTeleportIntoGrouping && LastConditionPassed == ConditionCriteraTypes.Cluster) || (!Bot.Settings.Class.bTeleportFleeWhenLowHP && !Bot.Settings.Class.bTeleportIntoGrouping)); }; FCombatMovement = v => { float fDistanceFromTarget = Bot.Character.Data.Position.Distance(v); if (!Bot.Character.Class.bWaitingForSpecial && Funky.Difference(Bot.Character.Data.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 35f) { return(MathEx.CalculatePointFrom(v, Bot.Character.Data.Position, 35f)); } return(v); } return(Vector3.Zero); }; FOutOfCombatMovement = v => { float fDistanceFromTarget = Bot.Character.Data.Position.Distance(v); if (Funky.Difference(Bot.Character.Data.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 35f) { return(MathEx.CalculatePointFrom(v, Bot.Character.Data.Position, 35f)); } return(v); } return(Vector3.Zero); }; }
// KeyWardenGoToPosition public static void KeyWardenGoToPosition() { Vector3 NavTarget = _keywardenPosition; Vector3 MyPos = GilesTrinity.GilesTrinity.PlayerStatus.CurrentPosition; if (Vector3.Distance(MyPos, NavTarget) > 250) { NavTarget = MathEx.CalculatePointFrom(MyPos, NavTarget, Vector3.Distance(MyPos, NavTarget) - 250); } // Move to Warden Location Navigator.MoveTo(NavTarget); }
public override void Initialize() { Priority = SkillPriority.Medium; Range = 60; PreCast = new SkillPreCast(SkillPrecastFlags.CheckCanCast | SkillPrecastFlags.CheckPlayerIncapacitated); ClusterConditions.Add(new SkillClusterConditions(4d, Range, 3, false, useRadiusDistance: true)); var IntersectingUnitTargetConditions = new UnitTargetConditions { TrueConditionFlags = TargetProperties.None, MaximumDistance = Range, Criteria = (unit) => unit.TargetInfo.IntersectingUnits > 2 }; SingleUnitCondition.Add(IntersectingUnitTargetConditions); SingleUnitCondition.Add(new UnitTargetConditions(TargetProperties.None, Range, falseConditionalFlags: TargetProperties.Normal)); SingleUnitCondition.Add(new UnitTargetConditions(TargetProperties.Summoner, Range, falseConditionalFlags: TargetProperties.LowHealth)); SingleUnitCondition.Add(new UnitTargetConditions(TargetProperties.AvoidanceSummoner, Range, falseConditionalFlags: TargetProperties.LowHealth)); SingleUnitCondition.Add(new UnitTargetConditions(TargetProperties.Debuffing, Range, falseConditionalFlags: TargetProperties.LowHealth)); FCombatMovement = v => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (FunkyBaseExtension.Settings.General.OutOfCombatMovement && !FunkyGame.Hero.Class.bWaitingForSpecial && FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > Range) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, Range)); } return(v); } return(Vector3.Zero); }; FOutOfCombatMovement = v => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > Range) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, Range)); } return(v); } return(Vector3.Zero); }; }
public override void Initialize() { WaitVars = new WaitLoops(1, 1, true); Range = 48; Priority = SkillPriority.High; PreCast = new SkillPreCast((SkillPrecastFlags.CheckPlayerIncapacitated | SkillPrecastFlags.CheckCanCast)); ClusterConditions.Add(new SkillClusterConditions(5d, 48f, 2, false, minDistance: 15f)); FcriteriaCombat = (u) => { return((FunkyBaseExtension.Settings.Wizard.bTeleportFleeWhenLowHP && (FunkyGame.Hero.dCurrentHealthPct < 0.5d) || (FunkyGame.Targeting.Cache.RequiresAvoidance)) || (FunkyBaseExtension.Settings.Wizard.bTeleportIntoGrouping && LastConditionPassed == ConditionCriteraTypes.Cluster) || (!FunkyBaseExtension.Settings.Wizard.bTeleportFleeWhenLowHP && !FunkyBaseExtension.Settings.Wizard.bTeleportIntoGrouping)); }; FCombatMovement = v => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (!FunkyGame.Hero.Class.bWaitingForSpecial && FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 25f) { if (fDistanceFromTarget > 50f) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, 50f)); } return(v); } return(Vector3.Zero); }; FOutOfCombatMovement = v => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 50f) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, 50f)); } return(v); } return(Vector3.Zero); }; }
public override void Initialize() { Cooldown = 16000; ExecutionType = AbilityExecuteFlags.ClusterLocation | AbilityExecuteFlags.ZigZagPathing; WaitVars = new WaitLoops(0, 1, true); Cost = 15; Range = 35; UseageType = AbilityUseage.Combat; IsASpecialMovementPower = true; Priority = AbilityPriority.High; PreCast = new SkillPreCast((AbilityPreCastFlags.CheckPlayerIncapacitated | AbilityPreCastFlags.CheckCanCast | AbilityPreCastFlags.CheckEnergy)); ClusterConditions = new SkillClusterConditions(5d, 48f, 2, false); //TestCustomCombatConditionAlways=true, FcriteriaCombat = () => ((Bot.Settings.Class.bTeleportFleeWhenLowHP && Bot.Character.Data.dCurrentHealthPct < 0.5d) || (Bot.Settings.Class.bTeleportIntoGrouping && Bot.Targeting.Cache.Clusters.AbilityClusterCache(combatClusterCondition).Count > 0 && Bot.Targeting.Cache.Clusters.AbilityClusterCache(combatClusterCondition)[0].Midpoint.Distance( Bot.Character.Data.PointPosition) > 15f) || (!Bot.Settings.Class.bTeleportFleeWhenLowHP && !Bot.Settings.Class.bTeleportIntoGrouping)); FCombatMovement = v => { float fDistanceFromTarget = Bot.Character.Data.Position.Distance(v); if (!Bot.Character.Class.bWaitingForSpecial && Funky.Difference(Bot.Character.Data.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 35f) { return(MathEx.CalculatePointFrom(v, Bot.Character.Data.Position, 35f)); } return(v); } return(Vector3.Zero); }; FOutOfCombatMovement = v => { float fDistanceFromTarget = Bot.Character.Data.Position.Distance(v); if (Funky.Difference(Bot.Character.Data.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 35f) { return(MathEx.CalculatePointFrom(v, Bot.Character.Data.Position, 35f)); } return(v); } return(Vector3.Zero); }; }
public override void Initialize() { Cooldown = 10200; WaitVars = new WaitLoops(2, 2, true); ExecutionType = AbilityExecuteFlags.ClusterLocation | AbilityExecuteFlags.Location; Range = 35; Priority = AbilityPriority.Medium; UseageType = AbilityUseage.Combat; IsASpecialMovementPower = true; PreCast = new SkillPreCast((AbilityPreCastFlags.CheckPlayerIncapacitated | AbilityPreCastFlags.CheckRecastTimer | AbilityPreCastFlags.CheckCanCast)); ClusterConditions = new SkillClusterConditions(5d, 30, 2, true); SingleUnitCondition = new UnitTargetConditions(TargetProperties.IsSpecial, falseConditionalFlags: TargetProperties.Fast, MinimumDistance: 30); FCombatMovement = (v) => { float fDistanceFromTarget = Bot.Character.Data.Position.Distance(v); if (!Bot.Character.Class.bWaitingForSpecial && Funky.Difference(Bot.Character.Data.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 35f) { return(MathEx.CalculatePointFrom(v, Bot.Character.Data.Position, 35f)); } else { return(v); } } return(Vector3.Zero); }; FOutOfCombatMovement = (v) => { float fDistanceFromTarget = Bot.Character.Data.Position.Distance(v); if (Funky.Difference(Bot.Character.Data.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 35f) { return(MathEx.CalculatePointFrom(v, Bot.Character.Data.Position, 35f)); } else { return(v); } } return(Vector3.Zero); }; }
/// <summary> /// Where Spike trap should be cast /// </summary> private static Vector3 SpikeTrapTargetSelector(SkillMeta skillMeta) { // For distant monsters, try to target a little bit in-front of them (as they run towards us), if it's not a treasure goblin float reducedDistance = 0f; if (CurrentTarget.Distance > 17f && !CurrentTarget.IsTreasureGoblin) { reducedDistance = CurrentTarget.Distance - 17f; if (reducedDistance > 5f) { reducedDistance = 5f; } } return(MathEx.CalculatePointFrom(CurrentTarget.Position, Player.Position, CurrentTarget.Distance - reducedDistance)); }
private RunStatus MoveAwayFromKeywarden(object ret) { Vector3 NavTarget = Position; Vector3 MyPos = GilesTrinity.GilesTrinity.PlayerStatus.CurrentPosition; if (Vector3.Distance(MyPos, NavTarget) > 250) { NavTarget = MathEx.CalculatePointFrom(MyPos, NavTarget, Vector3.Distance(MyPos, NavTarget) - 250); } // Move Away from KeyWarden Navigator.MoveTo(NavTarget); return(RunStatus.Success); }
private async Task <bool> Moving() { if (_isPartialMove) { if (!await NavigationCoroutine.MoveTo(_partialMoveLocation, 10)) { return(false); } Core.Logger.Debug("Reverting after partial move"); _isPartialMove = false; } else { if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 10)) { return(false); } } if (AdvDia.MyPosition.Distance(_objectiveLocation) > 30 && NavigationCoroutine.LastResult == CoroutineResult.Failure) { _partialMovesCount++; if (_partialMovesCount < 4) { Core.Logger.Debug("Creating partial move segment"); _partialMoveLocation = MathEx.CalculatePointFrom(AdvDia.MyPosition, _objectiveLocation, 125f); _isPartialMove = true; return(false); } _previouslyFoundLocation = _objectiveLocation; _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond; _partialMovesCount = 0; _isPartialMove = false; _objectiveLocation = Vector3.Zero; _objectiveScanRange = ActorFinder.LowerSearchRadius(_objectiveScanRange); if (_objectiveScanRange <= 0) { _objectiveScanRange = 50; } State = States.Searching; return(false); } SafeZerg.Instance.DisableZerg(); State = States.Completed; return(false); }
public override void Initialize() { WaitVars = new WaitLoops(0, 1, true); Cost = 15; Range = 50; Priority = SkillPriority.High; PreCast = new SkillPreCast((SkillPrecastFlags.CheckPlayerIncapacitated | SkillPrecastFlags.CheckCanCast | SkillPrecastFlags.CheckEnergy)); ClusterConditions.Add(new SkillClusterConditions(5d, 48f, 2, false)); //TestCustomCombatConditionAlways=true, FcriteriaCombat = (u) => ((FunkyBaseExtension.Settings.Wizard.bTeleportFleeWhenLowHP && FunkyGame.Hero.dCurrentHealthPct < 0.5d) || (FunkyBaseExtension.Settings.Wizard.bTeleportIntoGrouping && FunkyGame.Targeting.Cache.Clusters.AbilityClusterCache(combatClusterCondition).Count > 0 && FunkyGame.Targeting.Cache.Clusters.AbilityClusterCache(combatClusterCondition)[0].Midpoint.Distance(FunkyGame.Hero.Position) > 15f) || (!FunkyBaseExtension.Settings.Wizard.bTeleportFleeWhenLowHP && !FunkyBaseExtension.Settings.Wizard.bTeleportIntoGrouping)); FCombatMovement = v => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (!FunkyGame.Hero.Class.bWaitingForSpecial && FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 25f) { if (fDistanceFromTarget > 50f) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, 50f)); } return(v); } return(Vector3.Zero); }; FOutOfCombatMovement = v => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 10f) { if (fDistanceFromTarget > 50f) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, 50f)); } return(v); } return(Vector3.Zero); }; }
private RunStatus GilesMoveToLocation(object ret) { // First check if we can skip ahead because we recently moved here if (!GilesTrinity.Settings.Combat.Misc.AllowBacktracking && (NoSkip == null || NoSkip.ToLower() != "true")) { if (GilesTrinity.hashSkipAheadAreaCache.Any()) { // Loop through all the skip ahead zones and see if one of them is within radius of our intended destination to skip ahead foreach (GilesObstacle thisObject in GilesTrinity.hashSkipAheadAreaCache) { if (thisObject.Location.Distance(Position) <= thisObject.Radius) { DbHelper.Log(TrinityLogLevel.Verbose, LogCategory.ProfileTag, "Skipping ahead from moveto {0} to next moveto.", Position); GilesTrinity.bSkipAheadAGo = true; return(RunStatus.Success); } } GilesTrinity.hashSkipAheadAreaCache = new HashSet <GilesObstacle>(); } } else { GilesTrinity.hashSkipAheadAreaCache = new HashSet <GilesObstacle>(); } // Now use Trinity movement to try a direct movement towards that location Vector3 NavTarget = Position; Vector3 MyPos = GilesTrinity.PlayerStatus.CurrentPosition; if (!ZetaDia.WorldInfo.IsGenerated && Vector3.Distance(MyPos, NavTarget) > 250) { NavTarget = MathEx.CalculatePointFrom(MyPos, NavTarget, Vector3.Distance(MyPos, NavTarget) - 250); } if (useNavigator != null && useNavigator.ToLower() == "false") { Navigator.PlayerMover.MoveTowards(NavTarget); } else { var positionName = this.getPosition() + " (" + this.Name + ")"; Navigator.MoveTo(NavTarget, positionName, true); } return(RunStatus.Success); }
public override void Initialize() { WaitVars = new WaitLoops(0, 0, true); Priority = SkillPriority.High; PreCast = new SkillPreCast((SkillPrecastFlags.CheckCanCast)); if (Equipment.CheckLegendaryItemCount(LegendaryItemTypes.RaimentoftheJadeHarvester, 6)) { IsSpecialMovementSkill = true; } //IsSpecialMovementSkill = true; //IsBuff=true; //FcriteriaBuff=() => FunkyBaseExtension.Settings.General.OutOfCombatMovement; //Use buff at location (no prediction required!) FOutOfCombatMovement = (v) => v; FCombatMovement = (v) => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (!FunkyGame.Hero.Class.bWaitingForSpecial && FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 35f) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, 35f)); } else { return(v); } } return(Vector3.Zero); }; Range = 6; ClusterConditions.Add(new SkillClusterConditions(7d, 30f, 4, false, 0, ClusterProperties.None, 10f, true)); FcriteriaCombat = (u) => ((LastConditionPassed == ConditionCriteraTypes.Cluster) || (FunkyGame.Hero.dCurrentHealthPct <= 0.35d) || (RuneIndex == 3 && FunkyGame.Hero.dCurrentEnergyPct < 0.25d) || (FunkyGame.Targeting.Cache.Environment.FleeTriggeringUnits.Count > 0) || (FunkyGame.Targeting.Cache.Environment.TriggeringAvoidances.Count > 0) || (FunkyGame.Hero.bIsIncapacitated || FunkyGame.Hero.bIsRooted)); }
protected virtual bool ShouldVault(out Vector3 destination) { // Note: This is for casting while not moving. // Routine GetMovermentPower() may cast for movement // (Its called directly by our IPlayerMover) destination = Vector3.Zero; if (!Skills.DemonHunter.Vault.CanCast()) { return(false); } // Find a safespot with no monsters within kite range. Core.Avoidance.Avoider.TryGetSafeSpot(out destination, 33f, 37f, Player.Position, node => !TargetUtil.AnyMobsInRangeOfPosition(node.NavigableCenter, KiteDistance)); // Vault is a fixed distance spell, predict our actual landing position destination = MathEx.CalculatePointFrom(destination, ZetaDia.Me.Position, 35); // Prevent vaulting 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); } // Don't vault into molten core/arcane. if (!Core.Avoidance.InCriticalAvoidance(ZetaDia.Me.Position) && Core.Avoidance.Grid.IsIntersectedByFlags(ZetaDia.Me.Position, destination, AvoidanceFlags.CriticalAvoidance)) { return(false); } // Prevent the bot from vaulting back and forth over and item without being able to pick it up. if (CurrentTarget?.Type == TrinityObjectType.Item && CurrentTarget.Distance < 35f) { return(false); } // Prevent trying to vault up walls; spider man he is not. if (Math.Abs(destination.Z - Core.Player.Position.Z) > 5) { return(false); } return(true); }
public override void Initialize() { Range = 45; Cost = 25; Priority = SkillPriority.High; PreCast = new SkillPreCast(SkillPrecastFlags.CheckCanCast); ClusterConditions.Add(new SkillClusterConditions(5d, 45, 6, true)); SingleUnitCondition.Add(new UnitTargetConditions(TargetProperties.None, maxdistance: 45, MinimumHealthPercent: 0.95d, falseConditionalFlags: TargetProperties.Normal)); FCombatMovement = (v) => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (!FunkyGame.Hero.Class.bWaitingForSpecial && FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 45f) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, 45f)); } else { return(v); } } return(Vector3.Zero); }; FOutOfCombatMovement = (v) => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 45f) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, 45f)); } else { return(v); } } return(Vector3.Zero); }; }
private bool Move(Vector3 NavTarget) { bool result = false; if (lastPosition != Vector3.Zero && lastPosition.Distance(ZetaDia.Me.Position) >= 1) { lastPosition = ZetaDia.Me.Position; } // DB 300+ always uses local nav! Yay :) if (NavTarget.Distance(ZetaDia.Me.Position) > pathPointLimit) { NavTarget = MathEx.CalculatePointFrom(ZetaDia.Me.Position, NavTarget, NavTarget.Distance(ZetaDia.Me.Position) - pathPointLimit); } if (StraightLinePathing) { Navigator.PlayerMover.MoveTowards(Position); moveResult = MoveResult.Moved; } else { moveResult = QTNavigator.MoveTo(NavTarget, Status(), true); } switch (moveResult) { case MoveResult.Moved: case MoveResult.ReachedDestination: case MoveResult.PathGenerated: case MoveResult.PathGenerating: result = true; break; case MoveResult.PathGenerationFailed: case MoveResult.UnstuckAttempt: case MoveResult.Failed: break; } lastPosition = ZetaDia.Me.Position; if (QuestTools.EnableDebugLogging) { Logger.Debug("MoveResult: {0} {1}", moveResult.ToString(), Status()); } return(result); }
public override void Initialize() { Range = 45; Priority = SkillPriority.Medium; PreCast = new SkillPreCast(SkillPrecastFlags.CheckPlayerIncapacitated | SkillPrecastFlags.CheckCanCast); ClusterConditions.Add(new SkillClusterConditions(6d, Range, 2, true, useRadiusDistance: true)); SingleUnitCondition.Add(new UnitTargetConditions(TargetProperties.None, falseConditionalFlags: TargetProperties.Normal)); SingleUnitCondition.Add(new UnitTargetConditions(TargetProperties.None, falseConditionalFlags: TargetProperties.LowHealth)); FCombatMovement = (v) => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (!FunkyGame.Hero.Class.bWaitingForSpecial && FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > Range) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, Range)); } else { return(v); } } return(Vector3.Zero); }; FOutOfCombatMovement = (v) => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > Range) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, Range)); } else { return(v); } } return(Vector3.Zero); }; }
private Vector3 GetFurthestPathPosition(IndexedList <Vector3> path, float maxDistance, RayType type, bool updatePath) { if (path == null || path.Count == 0) { return(Vector3.Zero); } Vector3 startPosition = Core.Player.Position; Vector3 reachablePosition = startPosition; Vector3 unreachablePosition = path.LastOrDefault(); // Find closest valid path point; for (int i = path.Index; i < path.Count; i++) { var point = path[i]; if (startPosition.Distance(point) > maxDistance || type == RayType.Cast && !CanRayCast(startPosition, point) || type == RayType.Walk && !CanRayWalk(startPosition, point)) { if (updatePath) { path.Index = i; } unreachablePosition = point; break; } reachablePosition = point; } var distance = reachablePosition.Distance(unreachablePosition); const float incrementDistance = 2f; var totalSegments = distance / incrementDistance; // Find closest valid portion of path. for (int i = 0; i < totalSegments; i++) { var point = MathEx.CalculatePointFrom(unreachablePosition, reachablePosition, i * incrementDistance); if (startPosition.Distance(point) > maxDistance || type == RayType.Cast && !CanRayCast(startPosition, point) || type == RayType.Walk && !CanRayWalk(startPosition, point)) { break; } reachablePosition = point; } return(reachablePosition); }
private RunStatus GilesMoveToLocation(object ret) { // First check if we can skip ahead because we recently moved here if (NoSkip == null || NoSkip.ToLower() != "true") { if (SkipAheadCache.CheckPositionForSkipping(Position)) { Logger.DBLog.DebugFormat("Finished Path {0} earlier due to SkipAreaCache find!", Position.ToString()); skippingAhead = true; } if (skippingAhead) { m_IsDone = true; return(RunStatus.Success); } } // Now use Trinity movement to try a direct movement towards that location var NavTarget = Position; var MyPos = Bot.Character.Data.Position; if (!ZetaDia.WorldInfo.IsGenerated && Vector3.Distance(MyPos, NavTarget) > 250) { NavTarget = MathEx.CalculatePointFrom(MyPos, NavTarget, Vector3.Distance(MyPos, NavTarget) - 250); } if (useNavigator != null && useNavigator.ToLower() == "false") { Navigator.PlayerMover.MoveTowards(NavTarget); } else { //Special cache for skipping locations visited. if (Bot.Settings.Debug.SkipAhead) { SkipAheadCache.RecordSkipAheadCachePoint(PathPrecision); } Navigator.MoveTo(NavTarget); } return(RunStatus.Success); }
public override void Initialize() { Cooldown = 500; ExecutionType = AbilityExecuteFlags.Target; WaitVars = new WaitLoops(1, 2, true); Cost = 20; Range = 35; UseageType = AbilityUseage.Combat; Priority = AbilityPriority.Medium; PreCast = new SkillPreCast((AbilityPreCastFlags.CheckRecastTimer | AbilityPreCastFlags.CheckEnergy | AbilityPreCastFlags.CheckCanCast | AbilityPreCastFlags.CheckPlayerIncapacitated)); ElitesWithinRangeConditions = new Tuple <RangeIntervals, int>(RangeIntervals.Range_25, 1); UnitsWithinRangeConditions = new Tuple <RangeIntervals, int>(RangeIntervals.Range_15, 3); SingleUnitCondition = new UnitTargetConditions(TargetProperties.IsSpecial, 15); FCombatMovement = v => { float fDistanceFromTarget = Bot.Character.Data.Position.Distance(v); if (!Bot.Character.Class.bWaitingForSpecial && Funky.Difference(Bot.Character.Data.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 35f) { return(MathEx.CalculatePointFrom(v, Bot.Character.Data.Position, 35f)); } return(v); } return(Vector3.Zero); }; FOutOfCombatMovement = v => { float fDistanceFromTarget = Bot.Character.Data.Position.Distance(v); if (Funky.Difference(Bot.Character.Data.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 20f) { if (fDistanceFromTarget > 35f) { return(MathEx.CalculatePointFrom(v, Bot.Character.Data.Position, 35f)); } return(v); } return(Vector3.Zero); }; }
public override void Initialize() { Range = 5; Cost = 10; Priority = SkillPriority.High; PreCast = new SkillPreCast((SkillPrecastFlags.CheckCanCast)); //We want to preform zig-zag movements when using rune Ramming Speed or Nightmare if (RuneIndex == 0 || RuneIndex == 4) { IsSpecialMovementSkill = true; } //return location (no prediction required!) FOutOfCombatMovement = (v) => v; FCombatMovement = (v) => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (!FunkyGame.Hero.Class.bWaitingForSpecial && FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 5f) { if (fDistanceFromTarget > 45f) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, 45f)); } else { return(v); } } return(Vector3.Zero); }; ClusterConditions.Add(new SkillClusterConditions(5d, 50, 7, true)); SingleUnitCondition.Add(new UnitTargetConditions(TargetProperties.None, maxdistance: 35, MinimumHealthPercent: 0.95d, falseConditionalFlags: TargetProperties.Normal)); //Reduced cool down.. lets use it more! if (Hotbar.PassivePowers.Contains(SNOPower.X1_Crusader_Passive_LordCommander)) { SingleUnitCondition.Add(new UnitTargetConditions(TargetProperties.None, maxdistance: 50, MinimumHealthPercent: 0d, falseConditionalFlags: TargetProperties.Weak)); } }
private void Move(Vector3 navTarget) { if (_lastPosition != Vector3.Zero && _lastPosition.Distance(ZetaDia.Me.Position) >= 1) { _lastPosition = ZetaDia.Me.Position; } // DB 300+ always uses local nav! Yay :) if (navTarget.Distance(ZetaDia.Me.Position) > PathPointLimit) { navTarget = MathEx.CalculatePointFrom(ZetaDia.Me.Position, navTarget, navTarget.Distance(ZetaDia.Me.Position) - PathPointLimit); } if (StraightLinePathing) { Navigator.PlayerMover.MoveTowards(Position); _moveResult = MoveResult.Moved; } else { _moveResult = _qtNavigator.MoveTo(navTarget, Status()); } switch (_moveResult) { case MoveResult.Moved: case MoveResult.ReachedDestination: case MoveResult.PathGenerated: case MoveResult.PathGenerating: break; case MoveResult.PathGenerationFailed: case MoveResult.UnstuckAttempt: case MoveResult.Failed: break; } _lastPosition = ZetaDia.Me.Position; if (QuestTools.EnableDebugLogging) { Logger.Debug("MoveResult: {0} {1}", _moveResult.ToString(), Status()); } }
public override void Initialize() { Cooldown = 400; ExecutionType = AbilityExecuteFlags.ZigZagPathing; WaitVars = new WaitLoops(1, 2, true); Cost = 8; SecondaryEnergy = true; Range = 20; UseageType = AbilityUseage.Combat; Priority = AbilityPriority.Medium; IsASpecialMovementPower = true; PreCast = new SkillPreCast((AbilityPreCastFlags.CheckPlayerIncapacitated | AbilityPreCastFlags.CheckCanCast | AbilityPreCastFlags.CheckEnergy | AbilityPreCastFlags.CheckRecastTimer)); //SingleUnitCondition=new UnitTargetConditions(TargetProperties.None, 10); //UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_6, 1); FCombatMovement = v => { float fDistanceFromTarget = Bot.Character.Data.Position.Distance(v); if (!Bot.Character.Class.bWaitingForSpecial && Funky.Difference(Bot.Character.Data.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 18f && (LastUsedMilliseconds >= Bot.Settings.Class.iDHVaultMovementDelay)) { return(MathEx.CalculatePointFrom(v, Bot.Character.Data.Position, Math.Max(fDistanceFromTarget, 35f))); } return(Vector3.Zero); }; FOutOfCombatMovement = v => { float fDistanceFromTarget = Bot.Character.Data.Position.Distance(v); if (Funky.Difference(Bot.Character.Data.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 18f && (LastUsedMilliseconds >= Bot.Settings.Class.iDHVaultMovementDelay)) { return(MathEx.CalculatePointFrom(v, Bot.Character.Data.Position, Math.Max(fDistanceFromTarget, 35f))); } return(Vector3.Zero); }; }
public override void Initialize() { Cooldown = 400; WaitVars = new WaitLoops(1, 2, true); Cost = 8; SecondaryEnergy = true; Range = 20; Priority = SkillPriority.Medium; PreCast = new SkillPreCast((SkillPrecastFlags.CheckPlayerIncapacitated | SkillPrecastFlags.CheckCanCast | SkillPrecastFlags.CheckEnergy | SkillPrecastFlags.CheckRecastTimer)); //SingleUnitCondition.Add(new UnitTargetConditions(TargetProperties.None, 10); //UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_6, 1); FCombatMovement = v => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (!FunkyGame.Hero.Class.bWaitingForSpecial && FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 18f && (LastUsedMilliseconds >= FunkyBaseExtension.Settings.DemonHunter.iDHVaultMovementDelay)) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, Math.Max(fDistanceFromTarget, 35f))); } return(Vector3.Zero); }; FOutOfCombatMovement = v => { float fDistanceFromTarget = FunkyGame.Hero.Position.Distance(v); if (FunkyBaseExtension.Difference(FunkyGame.Hero.Position.Z, v.Z) <= 4 && fDistanceFromTarget >= 18f && (LastUsedMilliseconds >= FunkyBaseExtension.Settings.DemonHunter.iDHVaultMovementDelay)) { return(MathEx.CalculatePointFrom(v, FunkyGame.Hero.Position, Math.Max(fDistanceFromTarget, 35f))); } return(Vector3.Zero); }; }
public TrinityPower GetMovementPower(Vector3 destination) { if (!Player.IsInTown) { if ((IsBlocked || IsStuck) && (Core.Buffs.HasBuff(445266) || Player.PrimaryResource > 36)) { return(Vault(MathEx.CalculatePointFrom(destination, ZetaDia.Me.Position, 25))); } if (!Core.Buffs.HasBuff(445266) && Player.PrimaryResource > 36) { return(new TrinityPower(Skills.DemonHunter.Impale)); } if ((Core.Buffs.HasBuff(445266) || Player.PrimaryResource > 36) && CanVaultTo(destination)) { return(Vault(destination)); } } return(Walk(destination)); }