Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #253 from RiotNOR/dev
Browse files Browse the repository at this point in the history
feat: added secondary NumberOfHostiles and HasHostilesInRange for max range, and updated Prevent to use this variable.
  • Loading branch information
ArchiDog1998 authored Apr 26, 2023
2 parents 00c881b + 90c70aa commit 14397b5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ public static void SetSpecialType(SpecialCommandType specialType)

public static uint[] TreasureCharas { get; set; } = new uint[0];
public static bool HasHostilesInRange => NumberOfHostilesInRange > 0;
public static bool HasHostilesInMaxRange => NumberOfHostilesInMaxRange > 0;
public static int NumberOfHostilesInRange { get; set; }
public static int NumberOfHostilesInMaxRange { get; set; }

public static bool IsHostileCastingAOE { get; set; }

Expand Down
5 changes: 5 additions & 0 deletions RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public abstract partial class CustomRotation
/// </summary>
protected static int NumberOfHostilesInRange => DataCenter.NumberOfHostilesInRange;

/// <summary>
/// How many hostile targets in max range (25 yalms) regardless of job
/// </summary>
protected static int NumberOfHostilesInMaxRange => DataCenter.NumberOfHostilesInMaxRange;

protected static IEnumerable<BattleChara> HostileTargets => DataCenter.HostileTargets;

#endregion
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ private unsafe void DrawStatus()

ImGui.Text("Have pet: " + DataCenter.HasPet.ToString());
ImGui.Text("Hostile Near Count: " + DataCenter.NumberOfHostilesInRange.ToString());
ImGui.Text("Hostile Near Count Max Range: " + DataCenter.NumberOfHostilesInMaxRange.ToString());
ImGui.Text("Have Companion: " + DataCenter.HasCompanion.ToString());
ImGui.Text("Targetable: " + Service.Player.IsTargetable().ToString());

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/MajorUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal static class MajorUpdater
{
public static bool IsValid => Service.Conditions.Any() && Service.Player != null && !SocialUpdater.InPvp;
public static bool ShouldPreventActions => Service.Config.GetValue(SettingsCommand.PreventActions)
&& !DataCenter.HasHostilesInRange;
&& !DataCenter.HasHostilesInMaxRange;

#if DEBUG
private static readonly Dictionary<int, bool> _values = new Dictionary<int, bool>();
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ private unsafe static void UpdateHostileTargets(IEnumerable<BattleChara> allTarg

DataCenter.NumberOfHostilesInRange = DataCenter.HostileTargets.Count(o => o.DistanceToPlayer() <= JobRange);

DataCenter.NumberOfHostilesInMaxRange = DataCenter.HostileTargets.Count(o => o.DistanceToPlayer() <= 25);

if (DataCenter.HostileTargets.Count() == 1)
{
var tar = DataCenter.HostileTargets.FirstOrDefault();
Expand Down

0 comments on commit 14397b5

Please sign in to comment.