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

Commit

Permalink
Merge commit 'refs/pull/1639/head' of https://github.com/Nik-Potokar/…
Browse files Browse the repository at this point in the history
  • Loading branch information
Taurenkey committed Aug 10, 2024
2 parents 7df3c0b + 4d7bba1 commit 67fc485
Show file tree
Hide file tree
Showing 3 changed files with 284 additions and 188 deletions.
6 changes: 1 addition & 5 deletions XIVSlothCombo/Combos/CustomComboPreset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2810,13 +2810,9 @@ The three digets after RDM.JobID can be used to reorder items in the list
RDM_ST_DPS = 13000,

[ParentCombo(RDM_ST_DPS)]
[CustomComboInfo("Balance Opener Option [Lv.90]", "Replaces Jolt with the Balance opener ending with Resolution.\n**Must move into melee range before melee combo**", RDM.JobID, 110)]
[CustomComboInfo("Balance Opener Option", "Replaces Jolt with the Balance opener.\n**Must move into melee range before melee combo**", RDM.JobID, 110)]
RDM_Balance_Opener = 13110,

[ParentCombo(RDM_Balance_Opener)]
[CustomComboInfo("Use Opener at any Mana Option", "Removes 0/0 Mana reqirement to reset opener\n**All other actions must be off cooldown**", RDM.JobID, 111)]
RDM_Balance_Opener_AnyMana = 13111,

[ParentCombo(RDM_ST_DPS)]
[CustomComboInfo("Verthunder/Veraero Option", "Replace Jolt with Verthunder and Veraero.", RDM.JobID, 210)]
RDM_ST_ThunderAero = 13210,
Expand Down
283 changes: 275 additions & 8 deletions XIVSlothCombo/Combos/JobHelpers/RDM.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using Dalamud.Game.ClientState.JobGauge.Types;
using ECommons.DalamudServices;
using System;
using System.Net.Quic;
using XIVSlothCombo.Combos.JobHelpers.Enums;
using XIVSlothCombo.Combos.PvE;
using XIVSlothCombo.CustomComboNS.Functions;
using XIVSlothCombo.Data;

namespace XIVSlothCombo.Combos.JobHelpers
{
internal class RDMHelper
internal class RDMHelper : RDM
{
static bool HasEffect(ushort id) => CustomComboFunctions.HasEffect(id);
static float GetBuffRemainingTime(ushort effectid) => CustomComboFunctions.GetBuffRemainingTime(effectid);
Expand All @@ -19,7 +23,7 @@ internal class RDMHelper
static bool TraitLevelChecked(uint id) => CustomComboFunctions.TraitLevelChecked(id);
static byte GetBuffStacks(ushort id) => CustomComboFunctions.GetBuffStacks(id);

internal class RDMMana : PvE.RDM
internal class RDMMana
{
private static RDMGauge Gauge => CustomComboFunctions.GetJobGauge<RDMGauge>();
internal static int ManaStacks => Gauge.ManaStacks;
Expand All @@ -39,7 +43,7 @@ private static int AdjustMana(byte mana)
1 => 15,
_ => 0
};
return (mana + magickedSwordMana);
return mana + magickedSwordMana;
}
else return mana;
}
Expand Down Expand Up @@ -109,7 +113,7 @@ public static (bool useFire, bool useStone, bool useThunder, bool useAero, bool
}
}

internal class MeleeFinisher : PvE.RDM
internal class MeleeFinisher
{
internal static bool CanUse(in uint lastComboMove, out uint actionID)
{
Expand All @@ -122,7 +126,7 @@ internal static bool CanUse(in uint lastComboMove, out uint actionID)
{
if ((!HasEffect(Buffs.Embolden) || GetBuffRemainingTime(Buffs.Embolden) < 10)
&& !HasEffect(Buffs.VerfireReady)
&& (HasEffect(Buffs.VerstoneReady) && GetBuffRemainingTime(Buffs.VerstoneReady) >= 10)
&& HasEffect(Buffs.VerstoneReady) && GetBuffRemainingTime(Buffs.VerstoneReady) >= 10
&& (blackmana - whitemana <= 18))
{
actionID = Verflare;
Expand All @@ -134,7 +138,7 @@ internal static bool CanUse(in uint lastComboMove, out uint actionID)
else if (LevelChecked(Verflare))
{
if ((!HasEffect(Buffs.Embolden) || GetBuffRemainingTime(Buffs.Embolden) < 10)
&& (HasEffect(Buffs.VerfireReady) && GetBuffRemainingTime(Buffs.VerfireReady) >= 10)
&& HasEffect(Buffs.VerfireReady) && GetBuffRemainingTime(Buffs.VerfireReady) >= 10
&& !HasEffect(Buffs.VerstoneReady)
&& LevelChecked(Verholy)
&& (whitemana - blackmana <= 18))
Expand Down Expand Up @@ -165,7 +169,7 @@ internal static bool CanUse(in uint lastComboMove, out uint actionID)
}
}

internal class OGCDHelper : PvE.RDM
internal class OGCDHelper
{
internal static bool CanUse(in uint actionID, in bool SingleTarget, out uint newActionID)
{
Expand Down Expand Up @@ -251,7 +255,7 @@ internal static bool CanUse(in uint actionID, in bool SingleTarget, out uint new
}
}

internal class RDMLucid : PvE.RDM
internal class RDMLucid
{
internal static bool SafetoUse(in uint lastComboMove)
{
Expand All @@ -265,5 +269,268 @@ internal static bool SafetoUse(in uint lastComboMove)
&& lastComboMove != Scorch; // Change abilities to Lucid Dreaming for entire weave window
}
}

internal class RDMOpenerLogic
{
private static bool HasCooldowns()
{
if (CustomComboFunctions.GetRemainingCharges(Acceleration) < 2)
return false;

if (CustomComboFunctions.GetRemainingCharges(Corpsacorps) < 2)
return false;

if (CustomComboFunctions.GetRemainingCharges(Engagement) < 2)
return false;

if (!CustomComboFunctions.ActionReady(Embolden))
return false;

if (!CustomComboFunctions.ActionReady(Manafication))
return false;

if (!CustomComboFunctions.ActionReady(Fleche))
return false;

if (!CustomComboFunctions.ActionReady(ContreSixte))
return false;

if (!CustomComboFunctions.ActionReady(All.Swiftcast))
return false;

return true;
}

private static uint OpenerLevel => 100;

public uint PrePullStep = 0;

public uint OpenerStep = 0;

public static bool LevelChecked => CustomComboFunctions.LocalPlayer.Level >= OpenerLevel;

private static bool CanOpener => HasCooldowns() && LevelChecked;

private OpenerState currentState = OpenerState.PrePull;

public OpenerState CurrentState
{
get
{
return currentState;
}
set
{
if (value != currentState)
{
if (value == OpenerState.PrePull)
{
Svc.Log.Debug($"Entered PrePull Opener");
}
if (value == OpenerState.InOpener) OpenerStep = 1;
if (value == OpenerState.OpenerFinished || value == OpenerState.FailedOpener)
{
if (value == OpenerState.FailedOpener)
Svc.Log.Information($"Opener Failed at step {OpenerStep}");

ResetOpener();
}
if (value == OpenerState.OpenerFinished) Svc.Log.Information("Opener Finished");

currentState = value;
}
}
}

private bool DoPrePullSteps(ref uint actionID)
{
if (!LevelChecked)
return false;

if (CanOpener && PrePullStep == 0)
{
PrePullStep = 1;
}

if (!HasCooldowns())
{
PrePullStep = 0;
}

if (CurrentState == OpenerState.PrePull && PrePullStep > 0)
{
if (CustomComboFunctions.LocalPlayer.CastActionId == Veraero3 && PrePullStep == 1) CurrentState = OpenerState.InOpener;
else if (PrePullStep == 1) actionID = Veraero3;

if (ActionWatching.CombatActions.Count > 2 && CustomComboFunctions.InCombat())
CurrentState = OpenerState.FailedOpener;

return true;
}
PrePullStep = 0;
return false;
}

private bool DoOpener(ref uint actionID)
{
if (!LevelChecked)
return false;

if (currentState == OpenerState.InOpener)
{
if (CustomComboFunctions.WasLastAction(Verthunder3) && OpenerStep == 1) OpenerStep++;
else if (OpenerStep == 1) actionID = Verthunder3;

if (CustomComboFunctions.WasLastAction(All.Swiftcast) && OpenerStep == 2) OpenerStep++;
else if (OpenerStep == 2) actionID = All.Swiftcast;

if (CustomComboFunctions.WasLastAction(Verthunder3) && OpenerStep == 3) OpenerStep++;
else if (OpenerStep == 3) actionID = Verthunder3;

if (CustomComboFunctions.WasLastAction(Fleche) && OpenerStep == 4) OpenerStep++;
else if (OpenerStep == 4) actionID = Fleche;

if (CustomComboFunctions.WasLastAction(Acceleration) && OpenerStep == 5) OpenerStep++;
else if (OpenerStep == 5) actionID = Acceleration;

if (CustomComboFunctions.WasLastAction(Verthunder3) && OpenerStep == 6) OpenerStep++;
else if (OpenerStep == 6) actionID = Verthunder3;

if (CustomComboFunctions.WasLastAction(Embolden) && OpenerStep == 7) OpenerStep++;
else if (OpenerStep == 7) actionID = Embolden;

if (CustomComboFunctions.WasLastAction(Manafication) && OpenerStep == 8) OpenerStep++;
else if (OpenerStep == 8) actionID = Manafication;

if (CustomComboFunctions.WasLastAction(EnchantedRiposte) && OpenerStep == 9) OpenerStep++;
else if (OpenerStep == 9) actionID = EnchantedRiposte;

if (CustomComboFunctions.WasLastAction(ContreSixte) && OpenerStep == 10) OpenerStep++;
else if (OpenerStep == 10) actionID = ContreSixte;

if (CustomComboFunctions.WasLastAction(EnchantedZwerchhau) && OpenerStep == 11) OpenerStep++;
else if (OpenerStep == 11) actionID = EnchantedZwerchhau;

if (CustomComboFunctions.WasLastAction(Engagement) && OpenerStep == 12) OpenerStep++;
else if (OpenerStep == 12) actionID = Engagement;

if (CustomComboFunctions.WasLastAction(EnchantedRedoublement) && OpenerStep == 13) OpenerStep++;
else if (OpenerStep == 13) actionID = EnchantedRedoublement;

if (CustomComboFunctions.WasLastAction(Corpsacorps) && OpenerStep == 14) OpenerStep++;
else if (OpenerStep == 14) actionID = Corpsacorps;

if (CustomComboFunctions.WasLastAction(Verholy) && OpenerStep == 15) OpenerStep++;
else if (OpenerStep == 15) actionID = Verholy;

if (CustomComboFunctions.WasLastAction(ViceOfThorns) && OpenerStep == 16) OpenerStep++;
else if (OpenerStep == 16) actionID = ViceOfThorns;

if (CustomComboFunctions.WasLastAction(Scorch) && OpenerStep == 17) OpenerStep++;
else if (OpenerStep == 17) actionID = Scorch;

if (CustomComboFunctions.WasLastAction(Engagement) && OpenerStep == 18) OpenerStep++;
else if (OpenerStep == 18) actionID = Engagement;

if (CustomComboFunctions.WasLastAction(Corpsacorps) && OpenerStep == 19) OpenerStep++;
else if (OpenerStep == 19) actionID = Corpsacorps;

if (CustomComboFunctions.WasLastAction(Resolution) && OpenerStep == 20) OpenerStep++;
else if (OpenerStep == 20) actionID = Resolution;

if (CustomComboFunctions.WasLastAction(Prefulgence) && OpenerStep == 21) OpenerStep++;
else if (OpenerStep == 21) actionID = Prefulgence;

if (CustomComboFunctions.WasLastAction(GrandImpact) && OpenerStep == 22) OpenerStep++;
else if (OpenerStep == 22) actionID = GrandImpact;

if (CustomComboFunctions.WasLastAction(Acceleration) && OpenerStep == 23) OpenerStep++;
else if (OpenerStep == 23) actionID = Acceleration;

if (CustomComboFunctions.WasLastAction(Verfire) && OpenerStep == 24) OpenerStep++;
else if (OpenerStep == 24) actionID = Verfire;

if (CustomComboFunctions.WasLastAction(GrandImpact) && OpenerStep == 25) OpenerStep++;
else if (OpenerStep == 25) actionID = GrandImpact;

if (CustomComboFunctions.WasLastAction(Verthunder3) && OpenerStep == 26) OpenerStep++;
else if (OpenerStep == 26) actionID = Verthunder3;

if (CustomComboFunctions.WasLastAction(Fleche) && OpenerStep == 27) OpenerStep++;
else if (OpenerStep == 27) actionID = Fleche;

if (CustomComboFunctions.WasLastAction(Veraero3) && OpenerStep == 28) OpenerStep++;
else if (OpenerStep == 28) actionID = Veraero3;

if (CustomComboFunctions.WasLastAction(Verfire) && OpenerStep == 29) OpenerStep++;
else if (OpenerStep == 29) actionID = Verfire;

if (CustomComboFunctions.WasLastAction(Verthunder3) && OpenerStep == 30) OpenerStep++;
else if (OpenerStep == 30) actionID = Verthunder3;

if (CustomComboFunctions.WasLastAction(Verstone) && OpenerStep == 31) OpenerStep++;
else if (OpenerStep == 31) actionID = Verstone;

if (CustomComboFunctions.WasLastAction(Veraero3) && OpenerStep == 32) OpenerStep++;
else if (OpenerStep == 32) actionID = Veraero3;

if (CustomComboFunctions.WasLastAction(All.Swiftcast) && OpenerStep == 33) OpenerStep++;
else if (OpenerStep == 33) actionID = All.Swiftcast;

if (CustomComboFunctions.WasLastAction(Veraero3) && OpenerStep == 34) OpenerStep++;
else if (OpenerStep == 34) actionID = Veraero3;

if (CustomComboFunctions.WasLastAction(ContreSixte) && OpenerStep == 35) CurrentState = OpenerState.OpenerFinished;
else if (OpenerStep == 35) actionID = ContreSixte;

if (ActionWatching.TimeSinceLastAction.TotalSeconds >= 5)
CurrentState = OpenerState.FailedOpener;

if (((actionID == Embolden && CustomComboFunctions.IsOnCooldown(Embolden)) ||
(actionID == Manafication && CustomComboFunctions.IsOnCooldown(Manafication)) ||
(actionID == Fleche && CustomComboFunctions.IsOnCooldown(Fleche)) ||
(actionID == ContreSixte && CustomComboFunctions.IsOnCooldown(ContreSixte)) ||
(actionID == All.Swiftcast && CustomComboFunctions.IsOnCooldown(All.Swiftcast)) ||
(actionID == Acceleration && CustomComboFunctions.GetRemainingCharges(Acceleration) < 2) ||
(actionID == Corpsacorps && CustomComboFunctions.GetRemainingCharges(Corpsacorps) < 2) ||
(actionID == Engagement && CustomComboFunctions.GetRemainingCharges(Engagement) < 2)) && ActionWatching.TimeSinceLastAction.TotalSeconds >= 3)
{
CurrentState = OpenerState.FailedOpener;
return false;
}
return true;
}
return false;
}

private void ResetOpener()
{
PrePullStep = 0;
OpenerStep = 0;
}

public bool DoFullOpener(ref uint actionID)
{
if (!LevelChecked)
return false;

if (CurrentState == OpenerState.PrePull)
if (DoPrePullSteps(ref actionID))
return true;

if (CurrentState == OpenerState.InOpener)
{
if (DoOpener(ref actionID))
return true;
}

if (!CustomComboFunctions.InCombat())
{
ResetOpener();
CurrentState = OpenerState.PrePull;
}
return false;
}
}
}
}
Loading

0 comments on commit 67fc485

Please sign in to comment.