Skip to content

Commit

Permalink
Merge pull request #611 from FFXIV-CombatReborn/PLD-AOEfix
Browse files Browse the repository at this point in the history
Refactor TTK methods and update conditions
  • Loading branch information
LTS-FFXIV authored Feb 2, 2025
2 parents 5047caa + 95dd2a0 commit 1a3c1b1
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion BasicRotations/Tank/PLD_Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ protected override bool GeneralGCD(out IAction? act)
(HasAtonementReady && !HasDivineMight)) &&
!Player.HasStatus(true, StatusID.Medicated) && !HasFightOrFlight && !RageOfHalonePvE.CanUse(out act, skipComboCheck: false))
{
if (RiotBladePvE.CanUse(out act) || FastBladePvE.CanUse(out act)) return true;
if (!TotalEclipsePvE.CanUse(out _) && (RiotBladePvE.CanUse(out act) || FastBladePvE.CanUse(out act))) return true;
}
if ((RageOfHalonePvE.CanUse(out _, skipComboCheck: false) || HasFightOrFlight || Player.WillStatusEndGCD(1, 0, true, StatusID.SupplicationReady)) && SupplicationPvE.CanUse(out act)) return true;
if (RequiescatStacks > 0 && IsLastGCD(true, SupplicationPvE) && !HasFightOrFlight && HolySpiritPvE.CanUse(out act, skipCastingCheck: true)) return true;
Expand Down
2 changes: 1 addition & 1 deletion ECommons
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/ActionTargetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private bool CheckResistance(IGameObject gameObject)
private bool CheckTimeToKill(IGameObject gameObject)
{
if (gameObject is not IBattleChara b) return false;
var time = b.GetTimeToKill();
var time = b.GetTTK();
return float.IsNaN(time) || time >= action.Config.TimeToKill;
}

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/BaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public bool CanUse(out IAction act, bool isLastAbility = false, bool isFirstAbil

private bool IsTimeToKillValid()
{
return DataCenter.AverageTimeToKill >= Config.TimeToKill && DataCenter.AverageTimeToKill >= Config.TimeToUntargetable;
return DataCenter.AverageTTK >= Config.TimeToKill && DataCenter.AverageTTK >= Config.TimeToUntargetable;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ private bool CheckTimeToKill(IBattleChara tar)
{
return Param2 switch
{
0 => tar.GetTimeToKill() > DistanceOrTime,
1 => tar.GetTimeToKill() < DistanceOrTime,
2 => tar.GetTimeToKill() == DistanceOrTime,
0 => tar.GetTTK() > DistanceOrTime,
1 => tar.GetTTK() < DistanceOrTime,
2 => tar.GetTTK() == DistanceOrTime,
_ => false,
};
}
Expand Down
15 changes: 9 additions & 6 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -467,18 +467,18 @@ public static float JobRange
}
}

public static float AverageTimeToKill
public static float AverageTTK
{
get
{
float total = 0;
int count = 0;
foreach (var b in AllHostileTargets)
{
var timeToKill = b.GetTimeToKill();
if (!float.IsNaN(timeToKill))
var tTK = b.GetTTK();
if (!float.IsNaN(tTK))
{
total += timeToKill;
total += tTK;
count++;
}
}
Expand Down Expand Up @@ -841,14 +841,17 @@ public static bool IsCastingAreaVfx()

public static bool IsCastingVfx(List<VfxNewData> vfxDataQueueCopy, Func<VfxNewData, bool> isVfx)
{
// Create a copy of the list to avoid modification during enumeration
var vfxDataQueueSnapshot = new List<VfxNewData>(vfxDataQueueCopy);

// Ensure the list is not empty
if (vfxDataQueueCopy.Count == 0)
if (vfxDataQueueSnapshot.Count == 0)
{
return false;
}

// Iterate over the copied list
foreach (var vfx in vfxDataQueueCopy)
foreach (var vfx in vfxDataQueueSnapshot)
{
if (isVfx(vfx))
{
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver.Basic/Helpers/ObjectHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ public static bool IsBossFromTTK(this IBattleChara obj)
if (obj.IsDummy()) return true;

//Fate
return obj.GetTimeToKill(true) >= Service.Config.BossTimeToKill;
return obj.GetTTK(true) >= Service.Config.BossTimeToKill;
}

/// <summary>
Expand All @@ -619,7 +619,7 @@ public static bool IsBossFromIcon(this IBattleChara obj)
public static bool IsDying(this IBattleChara b)
{
if (b == null || b.IsDummy()) return false;
return b.GetTimeToKill() <= Service.Config.DyingTimeToKill || b.GetHealthRatio() < Service.Config.IsDyingConfig;
return b.GetTTK() <= Service.Config.DyingTimeToKill || b.GetHealthRatio() < Service.Config.IsDyingConfig;
}

/// <summary>
Expand All @@ -645,7 +645,7 @@ internal static unsafe bool InCombat(this IBattleChara obj)
/// <returns>
/// The estimated time to kill the battle character in seconds, or <see cref="float.NaN"/> if the calculation cannot be performed.
/// </returns>
internal static float GetTimeToKill(this IBattleChara b, bool wholeTime = false)
internal static float GetTTK(this IBattleChara b, bool wholeTime = false)
{
if (b == null) return float.NaN;
if (b.IsDummy()) return 999.99f;
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public static bool CanHitPositional(EnemyPositional positional, IBattleChara ene
/// Average time to kill for all targets.
/// </summary>
[Description("Average time to kill")]
public static float AverageTimeToKill => DataCenter.AverageTimeToKill;
public static float AverageTTK => DataCenter.AverageTTK;

/// <summary>
/// The level of the LB.
Expand All @@ -209,14 +209,14 @@ public unsafe static byte LimitBreakLevel
}

/// <summary>
/// Is the <see cref="AverageTimeToKill"/> larger than <paramref name="time"/>.
/// Is the <see cref="AverageTTK"/> larger than <paramref name="time"/>.
/// </summary>
/// <param name="time">Time</param>
/// <returns>Is Longer.</returns>
public static bool IsLongerThan(float time)
{
if (IsInHighEndDuty) return true;
return AverageTimeToKill > time;
return AverageTTK > time;
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2855,7 +2855,7 @@ private static unsafe void DrawTargetData()
{
ImGui.Text($"HP: {battleChara.CurrentHp} / {battleChara.MaxHp}");
ImGui.Text($"Is Current Focus Target: {battleChara.IsFocusTarget()}");
ImGui.Text($"TTK: {battleChara.GetTimeToKill()}");
ImGui.Text($"TTK: {battleChara.GetTTK()}");
ImGui.Text($"Is Boss TTK: {battleChara.IsBossFromTTK()}");
ImGui.Text($"Is Boss Icon: {battleChara.IsBossFromIcon()}");
ImGui.Text($"Rank: {battleChara.GetObjectNPC()?.Rank.ToString() ?? string.Empty}");
Expand Down

0 comments on commit 1a3c1b1

Please sign in to comment.