Skip to content

Commit 6289556

Browse files
authored
Merge pull request #965 from TheDeadCode/more-ast-changes
Fix Heal cancellation when there is nothing to do.
2 parents 6ed7e5a + 34dbc27 commit 6289556

File tree

4 files changed

+17
-55
lines changed

4 files changed

+17
-55
lines changed

RotationSolver.Basic/Rotations/Basic/AstrologianRotation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public partial class AstrologianRotation
9999
public static bool HasEarthlyDominance => Player.HasStatus(true, StatusID.EarthlyDominance);
100100

101101
/// <summary>
102-
/// Has Macrocosmos.
102+
/// Has Synastry.
103103
/// </summary>
104104
public static bool HasSynastry => Player.HasStatus(true, StatusID.Synastry);
105105
#endregion

RotationSolver.Basic/Rotations/CustomRotation_GCD.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
public partial class CustomRotation
44
{
5+
/// <summary>
6+
/// Whether the player is currently doing nothing (and healing).
7+
/// </summary>
8+
public static bool HealingWhileDoingNothing =>
9+
_nextTimeToHeal + TimeSpan.FromSeconds(DataCenter.DefaultGCDTotal) > DateTime.Now;
10+
511
private static DateTime _nextTimeToHeal = DateTime.MinValue;
612
private static readonly Random _random = new();
713

RotationSolver/RebornRotations/Healer/AST_Reborn.cs

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -151,37 +151,11 @@ protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
151151

152152
if (SynastryPvE.CanUse(out act))
153153
{
154-
if (nextGCD.IsTheSameTo(false, AspectedBeneficPvE))
154+
if (CanCastSynastry(AspectedBeneficPvE, SynastryPvE, SynastryHeal, nextGCD) ||
155+
CanCastSynastry(BeneficIiPvE, SynastryPvE, SynastryHeal, nextGCD) ||
156+
CanCastSynastry(BeneficPvE, SynastryPvE, SynastryHeal, nextGCD))
155157
{
156-
if (SynastryPvE.Target.Target == AspectedBeneficPvE.Target.Target)
157-
{
158-
if (SynastryPvE.Target.Target.GetHealthRatio() < SynastryHeal)
159-
{
160-
return true;
161-
}
162-
}
163-
}
164-
165-
if (nextGCD.IsTheSameTo(false, BeneficIiPvE))
166-
{
167-
if (SynastryPvE.Target.Target == BeneficIiPvE.Target.Target)
168-
{
169-
if (SynastryPvE.Target.Target.GetHealthRatio() < SynastryHeal)
170-
{
171-
return true;
172-
}
173-
}
174-
}
175-
176-
if (nextGCD.IsTheSameTo(false, BeneficPvE))
177-
{
178-
if (SynastryPvE.Target.Target == BeneficPvE.Target.Target)
179-
{
180-
if (SynastryPvE.Target.Target.GetHealthRatio() < SynastryHeal)
181-
{
182-
return true;
183-
}
184-
}
158+
return true;
185159
}
186160
}
187161

@@ -196,6 +170,11 @@ protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
196170
}
197171

198172
return base.EmergencyAbility(nextGCD, out act);
173+
174+
static bool CanCastSynastry(IBaseAction actionCheck, IBaseAction synastry, float synastryHp, IAction next)
175+
=> next.IsTheSameTo(false, actionCheck) &&
176+
synastry.Target.Target == actionCheck.Target.Target &&
177+
synastry.Target.Target.GetHealthRatio() < synastryHp;
199178
}
200179

201180
[RotationDesc(ActionID.ExaltationPvE, ActionID.TheArrowPvE, ActionID.TheSpirePvE, ActionID.TheBolePvE, ActionID.TheEwerPvE)]
@@ -566,30 +545,6 @@ protected override bool HealSingleGCD(out IAction? act)
566545
return base.HealSingleGCD(out act);
567546
}
568547

569-
if (AspectedBeneficPvE.CanUse(out act) && (IsMoving || AspectedBeneficPvE.Target.Target?.GetHealthRatio() < AspectedBeneficHeal))
570-
{
571-
if (AspectedBeneficPvE.Target.Target.HasStatus(true, StatusID.Synastry_846))
572-
{
573-
return true;
574-
}
575-
}
576-
577-
if (BeneficIiPvE.CanUse(out act))
578-
{
579-
if (BeneficIiPvE.Target.Target.HasStatus(true, StatusID.Synastry_846))
580-
{
581-
return true;
582-
}
583-
}
584-
585-
if (BeneficPvE.CanUse(out act))
586-
{
587-
if (BeneficPvE.Target.Target.HasStatus(true, StatusID.Synastry_846))
588-
{
589-
return true;
590-
}
591-
}
592-
593548
if (AspectedBeneficPvE.CanUse(out act) && (IsMoving || AspectedBeneficPvE.Target.Target?.GetHealthRatio() < AspectedBeneficHeal))
594549
{
595550
return true;

RotationSolver/Updaters/MiscUpdater.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ private static unsafe void UpdateCancelCast()
218218
bool stopDueStatus = statusTimes.Length > 0 && minStatusTime > Player.Object.TotalCastTime - Player.Object.CurrentCastTime && minStatusTime < 5;
219219

220220
bool shouldStopHealing = Service.Config.StopHealingAfterThresholdExperimental && DataCenter.InCombat &&
221+
!CustomRotation.HealingWhileDoingNothing &&
221222
DataCenter.CommandNextAction?.AdjustedID != Player.Object.CastActionId &&
222223
((ActionID)Player.Object.CastActionId).GetActionFromID(true, RotationUpdater.CurrentRotationActions) is IBaseAction {Setting.IsFriendly: true} &&
223224
(DataCenter.MergedStatus & (AutoStatus.HealAreaSpell | AutoStatus.HealSingleSpell)) == 0;

0 commit comments

Comments
 (0)