Skip to content

Commit

Permalink
Merge pull request #314 from kaedys/bugfix/calcbestaction
Browse files Browse the repository at this point in the history
[BUGFIX] CalcBestAction and CooldownData
  • Loading branch information
MKhayle authored Jul 13, 2024
2 parents f601204 + d9aabb0 commit 5ff52e3
Show file tree
Hide file tree
Showing 19 changed files with 128 additions and 276 deletions.
8 changes: 4 additions & 4 deletions XIVComboExpanded/Combos/ADV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
(actionID == SGE.Egeiro && level >= SGE.Levels.Egeiro) ||
(actionID == WHM.Raise && level >= WHM.Levels.Raise))
{
if (level >= ADV.Levels.Swiftcast && IsOffCooldown(ADV.Swiftcast))
if (level >= ADV.Levels.Swiftcast && IsCooldownUsable(ADV.Swiftcast))
return ADV.Swiftcast;
}

Expand All @@ -57,7 +57,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
}
else if (!IsEnabled(CustomComboPreset.AdvDisableVerRaiseFeature))
{
if (level >= ADV.Levels.Swiftcast && IsOffCooldown(ADV.Swiftcast))
if (level >= ADV.Levels.Swiftcast && IsCooldownUsable(ADV.Swiftcast))
return ADV.Swiftcast;
}
}
Expand Down Expand Up @@ -116,7 +116,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
return GNB.RoyalGuard;
}

if (IsEnabled(CustomComboPreset.AdvStanceBackProvokeFeature) && IsOnCooldown(ADV.Provoke))
if (IsEnabled(CustomComboPreset.AdvStanceBackProvokeFeature) && !IsCooldownUsable(ADV.Provoke))
{
if (job == PLD.JobID && level >= PLD.Levels.IronWill)
return PLD.IronWillRemoval;
Expand All @@ -139,7 +139,7 @@ internal class ShirkStanceFeature : CustomCombo

protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level)
{
if (actionID == ADV.Shirk && IsOnCooldown(ADV.Shirk))
if (actionID == ADV.Shirk && !IsCooldownUsable(ADV.Shirk))
{
var job = LocalPlayer?.ClassJob.Id;

Expand Down
6 changes: 3 additions & 3 deletions XIVComboExpanded/Combos/AST.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (IsEnabled(CustomComboPreset.AstrologianMaleficArcanaFeature) && gauge.DrawnCrownCard == CardType.LORD && level >= AST.Levels.MinorArcana)
return OriginalHook(AST.MinorArcanaDT);

if (IsEnabled(CustomComboPreset.AstrologianDraw1Feature) && IsOriginal(AST.Play1) && (IsOffCooldown(AST.AstralDraw) || IsOffCooldown(AST.UmbralDraw)))
if (IsEnabled(CustomComboPreset.AstrologianDraw1Feature) && IsOriginal(AST.Play1) && (IsCooldownUsable(AST.AstralDraw) || IsCooldownUsable(AST.UmbralDraw)))
return gauge.ActiveDraw == DrawType.ASTRAL ? OriginalHook(AST.AstralDraw) : OriginalHook(AST.UmbralDraw);

if (IsOriginal(AST.Play1)
&& IsOriginal(AST.Play2)
&& IsOriginal(AST.Play3)
&& (IsOriginal(AST.MinorArcanaDT) || level < AST.Levels.MinorArcana)
&& (IsOffCooldown(AST.AstralDraw) || IsOffCooldown(AST.UmbralDraw)))
&& (IsCooldownUsable(AST.AstralDraw) || IsCooldownUsable(AST.UmbralDraw)))
return gauge.ActiveDraw == DrawType.ASTRAL ? OriginalHook(AST.AstralDraw) : OriginalHook(AST.UmbralDraw);
}

Expand All @@ -121,7 +121,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
&& IsOriginal(AST.Play2)
&& IsOriginal(AST.Play3)
&& (IsOriginal(AST.MinorArcanaDT) || level < AST.Levels.MinorArcana)
&& (IsOffCooldown(AST.AstralDraw) || IsOffCooldown(AST.UmbralDraw)))
&& (IsCooldownUsable(AST.AstralDraw) || IsCooldownUsable(AST.UmbralDraw)))
return gauge.ActiveDraw == DrawType.ASTRAL ? OriginalHook(AST.AstralDraw) : OriginalHook(AST.UmbralDraw);
}

Expand Down
12 changes: 6 additions & 6 deletions XIVComboExpanded/Combos/BRD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (IsEnabled(CustomComboPreset.BardShadowbiteBarrageFeature))
{
if (level >= BRD.Levels.Barrage && IsOffCooldown(BRD.Barrage))
if (level >= BRD.Levels.Barrage && IsCooldownUsable(BRD.Barrage))
return BRD.Barrage;
}

Expand Down Expand Up @@ -384,13 +384,13 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (IsEnabled(CustomComboPreset.BardRadiantStrikesFeature))
{
if (level >= BRD.Levels.RagingStrikes && IsOffCooldown(BRD.RagingStrikes))
if (level >= BRD.Levels.RagingStrikes && IsCooldownUsable(BRD.RagingStrikes))
return BRD.RagingStrikes;
}

if (IsEnabled(CustomComboPreset.BardRadiantVoiceFeature))
{
if (level >= BRD.Levels.BattleVoice && IsOffCooldown(BRD.BattleVoice))
if (level >= BRD.Levels.BattleVoice && IsCooldownUsable(BRD.BattleVoice))
return BRD.BattleVoice;
}

Expand Down Expand Up @@ -447,7 +447,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (gauge.Song == Song.WANDERER && gauge.SongTimer >= remaining)
return BRD.WanderersMinuet;

if (IsOffCooldown(BRD.WanderersMinuet))
if (IsCooldownUsable(BRD.WanderersMinuet))
return BRD.WanderersMinuet;
}

Expand All @@ -456,7 +456,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (gauge.Song == Song.MAGE && gauge.SongTimer >= remaining)
return BRD.MagesBallad;

if (IsOffCooldown(BRD.MagesBallad))
if (IsCooldownUsable(BRD.MagesBallad))
return BRD.MagesBallad;
}

Expand All @@ -465,7 +465,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (gauge.Song == Song.ARMY && gauge.SongTimer >= remaining)
return BRD.ArmysPaeon;

if (IsOffCooldown(BRD.ArmysPaeon))
if (IsCooldownUsable(BRD.ArmysPaeon))
return BRD.ArmysPaeon;
}

Expand Down
10 changes: 5 additions & 5 deletions XIVComboExpanded/Combos/DRG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,14 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

if (IsEnabled(CustomComboPreset.DragoonStardiverNastrondFeature))
{
if (level >= DRG.Levels.Geirskogul && (!gauge.IsLOTDActive || IsOffCooldown(DRG.Nastrond) || IsOnCooldown(DRG.Stardiver)))
if (level >= DRG.Levels.Geirskogul && (!gauge.IsLOTDActive || IsCooldownUsable(DRG.Nastrond) || !IsCooldownUsable(DRG.Stardiver)))
// Nastrond
return OriginalHook(DRG.Geirskogul);
}

if (IsEnabled(CustomComboPreset.DragoonStardiverDragonfireDiveFeature))
{
if (level < DRG.Levels.Stardiver || !gauge.IsLOTDActive || IsOnCooldown(DRG.Stardiver) || (IsOffCooldown(DRG.DragonfireDive) && gauge.LOTDTimer > 7.5))
if (level < DRG.Levels.Stardiver || !gauge.IsLOTDActive || !IsCooldownUsable(DRG.Stardiver) || (IsCooldownUsable(DRG.DragonfireDive) && gauge.LOTDTimer > 7.5))
return DRG.DragonfireDive;
}
}
Expand All @@ -249,7 +249,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
? DRG.Nastrond
: DRG.Geirskogul;

if (IsOnCooldown(action))
if (!IsCooldownUsable(action))
return DRG.WyrmwindThrust;
}
}
Expand All @@ -267,10 +267,10 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (actionID == DRG.LanceCharge)
{
if (!IsOnCooldown(DRG.LanceCharge))
if (!!IsCooldownUsable(DRG.LanceCharge))
return DRG.LanceCharge;

if (level >= DRG.Levels.BattleLitany && !IsOnCooldown(DRG.BattleLitany))
if (level >= DRG.Levels.BattleLitany && !!IsCooldownUsable(DRG.BattleLitany))
return DRG.BattleLitany;
}

Expand Down
8 changes: 4 additions & 4 deletions XIVComboExpanded/Combos/DRK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (actionID == DRK.CarveAndSpit && level < DRK.Levels.CarveAndSpit)
return OriginalHook(DRK.BloodWeapon);

if (level >= DRK.Levels.BloodWeapon && IsOffCooldown(DRK.BloodWeapon))
if (level >= DRK.Levels.BloodWeapon && IsCooldownUsable(DRK.BloodWeapon))
return OriginalHook(DRK.BloodWeapon);
}
}
Expand All @@ -213,7 +213,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

if (IsEnabled(CustomComboPreset.DarkLivingShadowFeature))
{
if (level >= DRK.Levels.LivingShadow && gauge.Blood >= 50 && IsOffCooldown(DRK.LivingShadow))
if (level >= DRK.Levels.LivingShadow && gauge.Blood >= 50 && IsCooldownUsable(DRK.LivingShadow))
return DRK.LivingShadow;
}
}
Expand All @@ -234,13 +234,13 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

if (IsEnabled(CustomComboPreset.DarkLivingShadowbringerFeature))
{
if (level >= DRK.Levels.Shadowbringer && gauge.ShadowTimeRemaining > 0 && HasCharges(DRK.Shadowbringer))
if (level >= DRK.Levels.Shadowbringer && gauge.ShadowTimeRemaining > 0 && IsCooldownUsable(DRK.Shadowbringer))
return DRK.Shadowbringer;
}

if (IsEnabled(CustomComboPreset.DarkLivingShadowbringerHpFeature))
{
if (level >= DRK.Levels.Shadowbringer && HasCharges(DRK.Shadowbringer) && IsOnCooldown(DRK.LivingShadow))
if (level >= DRK.Levels.Shadowbringer && IsCooldownUsable(DRK.Shadowbringer) && !IsCooldownUsable(DRK.LivingShadow))
return DRK.Shadowbringer;
}
}
Expand Down
4 changes: 2 additions & 2 deletions XIVComboExpanded/Combos/GNB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

if (IsEnabled(CustomComboPreset.GunbreakerDoubleDownFeature))
{
if (level >= GNB.Levels.DoubleDown && gauge.Ammo >= 2 && IsOffCooldown(GNB.DoubleDown))
if (level >= GNB.Levels.DoubleDown && gauge.Ammo >= 2 && IsCooldownUsable(GNB.DoubleDown))
return GNB.DoubleDown;
}

Expand Down Expand Up @@ -245,7 +245,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (level >= GNB.Levels.NoMercy && HasEffect(GNB.Buffs.NoMercy))
{
if (level >= GNB.Levels.DoubleDown && gauge.Ammo >= 2 && IsOffCooldown(GNB.DoubleDown))
if (level >= GNB.Levels.DoubleDown && gauge.Ammo >= 2 && IsCooldownUsable(GNB.DoubleDown))
return GNB.DoubleDown;
}
}
Expand Down
14 changes: 6 additions & 8 deletions XIVComboExpanded/Combos/MCH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ internal class MachinistGaussRoundRicochet : CustomCombo

protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level)
{
var richochet = level < MCH.Levels.CheckMate ? MCH.Ricochet : MCH.Checkmate;
var gaussRound = level < MCH.Levels.DoubleCheck ? MCH.GaussRound : MCH.DoubleCheck;
if (actionID == MCH.GaussRound || actionID == richochet)
if (actionID == MCH.GaussRound || actionID == MCH.Ricochet)
{
var gauge = GetJobGauge<MCHGauge>();

Expand All @@ -151,9 +149,9 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
}

if (level >= MCH.Levels.Ricochet)
return CalcBestAction(actionID, gaussRound, richochet);
return OriginalHook(CalcBestAction(actionID, MCH.GaussRound, MCH.Ricochet));

return gaussRound;
return OriginalHook(MCH.Ricochet);
}

return actionID;
Expand All @@ -168,10 +166,10 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (actionID == MCH.Hypercharge)
{
if (level >= MCH.Levels.Wildfire && IsOffCooldown(MCH.Wildfire) && HasTarget())
if (level >= MCH.Levels.Wildfire && IsCooldownUsable(MCH.Wildfire) && HasTarget())
return MCH.Wildfire;

if (level >= MCH.Levels.Wildfire && IsOnCooldown(MCH.Hypercharge) && !IsOriginal(MCH.Wildfire))
if (level >= MCH.Levels.Wildfire && !IsCooldownUsable(MCH.Hypercharge) && !IsOriginal(MCH.Wildfire))
return MCH.Detonator;
}

Expand All @@ -191,7 +189,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

if (IsEnabled(CustomComboPreset.MachinistHyperfireFeature))
{
if (level >= MCH.Levels.Wildfire && IsOffCooldown(MCH.Wildfire) && HasTarget())
if (level >= MCH.Levels.Wildfire && IsCooldownUsable(MCH.Wildfire) && HasTarget())
return MCH.Wildfire;
}

Expand Down
2 changes: 1 addition & 1 deletion XIVComboExpanded/Combos/PCT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (gauge.MooglePortraitReady || gauge.MadeenPortraitReady)
{
if (IsOffCooldown(PCT.MogOftheAges))
if (IsCooldownUsable(PCT.MogOftheAges))
return OriginalHook(PCT.MogOftheAges);
}
}
Expand Down
2 changes: 1 addition & 1 deletion XIVComboExpanded/Combos/PLD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (actionID == PLD.ShieldBash)
{
if (level >= PLD.Levels.LowBlow && IsOffCooldown(PLD.LowBlow))
if (level >= PLD.Levels.LowBlow && IsCooldownUsable(PLD.LowBlow))
return PLD.LowBlow;
}

Expand Down
8 changes: 4 additions & 4 deletions XIVComboExpanded/Combos/RDM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,14 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (IsEnabled(CustomComboPreset.RedMageAccelerationSwiftcastOption))
{
if (IsOffCooldown(RDM.Acceleration) && IsOffCooldown(ADV.Swiftcast))
if (IsCooldownUsable(RDM.Acceleration) && IsCooldownUsable(ADV.Swiftcast))
return ADV.Swiftcast;
}

if (IsOffCooldown(RDM.Acceleration))
if (IsCooldownUsable(RDM.Acceleration))
return RDM.Acceleration;

if (IsOffCooldown(ADV.Swiftcast))
if (IsCooldownUsable(ADV.Swiftcast))
return ADV.Swiftcast;
}

Expand All @@ -416,7 +416,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (actionID == RDM.Embolden)
{
if (level >= RDM.Levels.Manafication && IsOffCooldown(RDM.Manafication) && !IsOffCooldown(RDM.Embolden))
if (level >= RDM.Levels.Manafication && IsCooldownUsable(RDM.Manafication) && !IsCooldownUsable(RDM.Embolden))
return RDM.Manafication;
}

Expand Down
8 changes: 4 additions & 4 deletions XIVComboExpanded/Combos/RPR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (IsEnabled(CustomComboPreset.ReaperBloodStalkGluttonyFeature))
{
if (level >= RPR.Levels.Gluttony && gauge.Soul >= 50 && gauge.EnshroudedTimeRemaining == 0 && IsOffCooldown(RPR.Gluttony))
if (level >= RPR.Levels.Gluttony && gauge.Soul >= 50 && gauge.EnshroudedTimeRemaining == 0 && IsCooldownUsable(RPR.Gluttony))
return RPR.Gluttony;
}

Expand Down Expand Up @@ -389,7 +389,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (IsEnabled(CustomComboPreset.ReaperGrimSwatheGluttonyFeature))
{
if (level >= RPR.Levels.Gluttony && gauge.Soul >= 50 && gauge.EnshroudedTimeRemaining == 0 && IsOffCooldown(RPR.Gluttony))
if (level >= RPR.Levels.Gluttony && gauge.Soul >= 50 && gauge.EnshroudedTimeRemaining == 0 && IsCooldownUsable(RPR.Gluttony))
return RPR.Gluttony;
}

Expand All @@ -414,7 +414,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

if (IsEnabled(CustomComboPreset.ReaperBloodStalkGluttonyFeature))
{
if (level >= RPR.Levels.Gluttony && gauge.Soul >= 50 && IsOffCooldown(RPR.Gluttony) && gauge.EnshroudedTimeRemaining == 0)
if (level >= RPR.Levels.Gluttony && gauge.Soul >= 50 && IsCooldownUsable(RPR.Gluttony) && gauge.EnshroudedTimeRemaining == 0)
return RPR.Gluttony;
}

Expand All @@ -441,7 +441,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

if (IsEnabled(CustomComboPreset.ReaperGrimSwatheGluttonyFeature))
{
if (level >= RPR.Levels.Gluttony && gauge.Soul >= 50 && IsOffCooldown(RPR.Gluttony) && gauge.EnshroudedTimeRemaining == 0)
if (level >= RPR.Levels.Gluttony && gauge.Soul >= 50 && IsCooldownUsable(RPR.Gluttony) && gauge.EnshroudedTimeRemaining == 0)
return RPR.Gluttony;
}

Expand Down
6 changes: 3 additions & 3 deletions XIVComboExpanded/Combos/SAM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,12 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

if (IsEnabled(CustomComboPreset.SamuraiShintenSeneiFeature))
{
if (level >= SAM.Levels.HissatsuSenei && IsOffCooldown(SAM.HissatsuSenei))
if (level >= SAM.Levels.HissatsuSenei && IsCooldownUsable(SAM.HissatsuSenei))
return SAM.HissatsuSenei;

if (IsEnabled(CustomComboPreset.SamuraiSeneiGurenFeature))
{
if (level >= SAM.Levels.HissatsuGuren && level < SAM.Levels.HissatsuSenei && IsOffCooldown(SAM.HissatsuGuren))
if (level >= SAM.Levels.HissatsuGuren && level < SAM.Levels.HissatsuSenei && IsCooldownUsable(SAM.HissatsuGuren))
return SAM.HissatsuGuren;
}
}
Expand Down Expand Up @@ -340,7 +340,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

if (IsEnabled(CustomComboPreset.SamuraiKyutenGurenFeature))
{
if (level >= SAM.Levels.HissatsuGuren && IsOffCooldown(SAM.HissatsuGuren))
if (level >= SAM.Levels.HissatsuGuren && IsCooldownUsable(SAM.HissatsuGuren))
return SAM.HissatsuGuren;
}
}
Expand Down
Loading

0 comments on commit 5ff52e3

Please sign in to comment.