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

Commit

Permalink
Merge pull request #1856 from Kagekazu/MCH_Queen
Browse files Browse the repository at this point in the history
[MCH] Cleanup + Refactoring
  • Loading branch information
Taurenkey authored Nov 17, 2024
2 parents fcf8fbc + d146cb6 commit c06f763
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 126 deletions.
2 changes: 1 addition & 1 deletion ECommons
Submodule ECommons updated 144 files
33 changes: 24 additions & 9 deletions XIVSlothCombo/Combos/JobHelpers/MCH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,34 @@
using ECommons.DalamudServices;
using FFXIVClientStructs.FFXIV.Client.Game;
using XIVSlothCombo.Combos.JobHelpers.Enums;
using XIVSlothCombo.Combos.PvE;
using XIVSlothCombo.Data;
using static XIVSlothCombo.Combos.PvE.MCH;
using static XIVSlothCombo.CustomComboNS.Functions.CustomComboFunctions;

namespace XIVSlothCombo.Combos.JobHelpers;

internal abstract class MCHHelpers
internal class MCH
{
// MCH Gauge & Extensions
public static MCHOpenerLogic MCHOpener = new();

public static float GCD = GetCooldown(OriginalHook(SplitShot)).CooldownTotal;
public static float heatblastRC = GetCooldown(Heatblast).CooldownTotal;
public static bool drillCD = !LevelChecked(Drill) || (!TraitLevelChecked(Traits.EnhancedMultiWeapon) &&
GetCooldownRemainingTime(Drill) > heatblastRC * 6) ||
(TraitLevelChecked(Traits.EnhancedMultiWeapon) &&
GetRemainingCharges(Drill) < GetMaxCharges(Drill) &&
GetCooldownRemainingTime(Drill) > heatblastRC * 6);
public static bool anchorCD = !LevelChecked(AirAnchor) ||
(LevelChecked(AirAnchor) && GetCooldownRemainingTime(AirAnchor) > heatblastRC * 6);
public static bool sawCD = !LevelChecked(Chainsaw) ||
(LevelChecked(Chainsaw) && GetCooldownRemainingTime(Chainsaw) > heatblastRC * 6);
public static bool interruptReady = ActionReady(All.HeadGraze) && CanInterruptEnemy() &&
CanDelayedWeave(ActionWatching.LastWeaponskill);
public static MCHGauge Gauge = GetJobGauge<MCHGauge>();
public static int BSUsed => ActionWatching.CombatActions.Count(x => x == BarrelStabilizer);

internal class MCHOpenerLogic
{
private OpenerState currentState = OpenerState.PrePull;
Expand Down Expand Up @@ -254,25 +274,20 @@ public bool DoFullOpener(ref uint actionID)
}
}

internal static class MCHExtensions
internal static class MCHHelper
{
public static unsafe bool IsComboExpiring(float Times)
{
float GCD = GetCooldown(OriginalHook(SplitShot)).CooldownTotal * Times;

if (ActionManager.Instance()->Combo.Timer != 0 && ActionManager.Instance()->Combo.Timer < GCD)
return true;

return false;
return ActionManager.Instance()->Combo.Timer != 0 && ActionManager.Instance()->Combo.Timer < GCD;
}

public static bool UseQueen(MCHGauge gauge)
{
int BSUsed = ActionWatching.CombatActions.Count(x => x == BarrelStabilizer);

if (!ActionWatching.HasDoubleWeaved() && !gauge.IsOverheated && !HasEffect(Buffs.Wildfire) &&
!JustUsed(OriginalHook(Heatblast)) && LevelChecked(OriginalHook(RookAutoturret)) &&
!gauge.IsRobotActive && gauge.Battery >= 50)
gauge is { IsRobotActive: false, Battery: >= 50 })
{
if (LevelChecked(FullMetalField))
{
Expand Down
190 changes: 74 additions & 116 deletions XIVSlothCombo/Combos/PvE/MCH.cs
Original file line number Diff line number Diff line change
@@ -1,83 +1,16 @@
using System.Linq;
using Dalamud.Game.ClientState.JobGauge.Types;
using ECommons.DalamudServices;
using XIVSlothCombo.Combos.PvE.Content;
using XIVSlothCombo.CustomComboNS;
using XIVSlothCombo.CustomComboNS.Functions;
using XIVSlothCombo.Data;
using XIVSlothCombo.Extensions;
using static XIVSlothCombo.Combos.JobHelpers.MCHHelpers;
using static XIVSlothCombo.CustomComboNS.Functions.CustomComboFunctions;
using static XIVSlothCombo.Combos.JobHelpers.MCH;

namespace XIVSlothCombo.Combos.PvE;

internal class MCH
{
public const byte JobID = 31;

public const uint
CleanShot = 2873,
HeatedCleanShot = 7413,
SplitShot = 2866,
HeatedSplitShot = 7411,
SlugShot = 2868,
HeatedSlugShot = 7412,
GaussRound = 2874,
Ricochet = 2890,
Reassemble = 2876,
Drill = 16498,
HotShot = 2872,
AirAnchor = 16500,
Hypercharge = 17209,
Heatblast = 7410,
SpreadShot = 2870,
Scattergun = 25786,
AutoCrossbow = 16497,
RookAutoturret = 2864,
RookOverdrive = 7415,
AutomatonQueen = 16501,
QueenOverdrive = 16502,
Tactician = 16889,
Chainsaw = 25788,
BioBlaster = 16499,
BarrelStabilizer = 7414,
Wildfire = 2878,
Dismantle = 2887,
Flamethrower = 7418,
BlazingShot = 36978,
DoubleCheck = 36979,
CheckMate = 36980,
Excavator = 36981,
FullMetalField = 36982;

protected static MCHGauge? Gauge = GetJobGauge<MCHGauge>();

public static class Buffs
{
public const ushort
Reassembled = 851,
Tactician = 1951,
Wildfire = 1946,
Overheated = 2688,
Flamethrower = 1205,
Hypercharged = 3864,
ExcavatorReady = 3865,
FullMetalMachinist = 3866;
}

public static class Debuffs
{
public const ushort
Dismantled = 2887,
Bioblaster = 1866;
}

public static class Traits
{
public const ushort
EnhancedMultiWeapon = 605;
}

public static class Config
{
public static UserInt
Expand All @@ -101,29 +34,10 @@ public static UserBool

internal class MCH_ST_SimpleMode : CustomCombo
{
internal static MCHOpenerLogic MCHOpener = new();

protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.MCH_ST_SimpleMode;

protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level)
{
bool interruptReady = ActionReady(All.HeadGraze) && CanInterruptEnemy() && CanDelayedWeave(actionID);
float heatblastRC = GetCooldown(Heatblast).CooldownTotal;

bool drillCD = !LevelChecked(Drill) || (!TraitLevelChecked(Traits.EnhancedMultiWeapon) &&
GetCooldownRemainingTime(Drill) > heatblastRC * 6) ||
(TraitLevelChecked(Traits.EnhancedMultiWeapon) &&
GetRemainingCharges(Drill) < GetMaxCharges(Drill) &&
GetCooldownRemainingTime(Drill) > heatblastRC * 6);

bool anchorCD = !LevelChecked(AirAnchor) ||
(LevelChecked(AirAnchor) && GetCooldownRemainingTime(AirAnchor) > heatblastRC * 6);

bool sawCD = !LevelChecked(Chainsaw) ||
(LevelChecked(Chainsaw) && GetCooldownRemainingTime(Chainsaw) > heatblastRC * 6);
float GCD = GetCooldown(OriginalHook(SplitShot)).CooldownTotal;
int BSUsed = ActionWatching.CombatActions.Count(x => x == BarrelStabilizer);

if (actionID is SplitShot or HeatedSplitShot)
{
if (IsEnabled(CustomComboPreset.MCH_Variant_Cure) &&
Expand Down Expand Up @@ -158,7 +72,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
return BarrelStabilizer;

// Hypercharge
if ((Gauge.Heat >= 50 || HasEffect(Buffs.Hypercharged)) && !MCHExtensions.IsComboExpiring(6) &&
if ((Gauge.Heat >= 50 || HasEffect(Buffs.Hypercharged)) && !MCHHelper.IsComboExpiring(6) &&
LevelChecked(Hypercharge) && !Gauge.IsOverheated)
{
// Ensures Hypercharge is double weaved with WF
Expand All @@ -176,8 +90,8 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
}

//Queen
if (MCHExtensions.UseQueen(Gauge) &&
GetCooldownRemainingTime(Wildfire) > GCD)
if (MCHHelper.UseQueen(Gauge) &&
(GetCooldownRemainingTime(Wildfire) > GCD || !LevelChecked(Wildfire)))
return OriginalHook(RookAutoturret);

// Gauss Round and Ricochet during HC
Expand Down Expand Up @@ -318,36 +232,17 @@ private static bool ReassembledTools(ref uint actionID, MCHGauge gauge)

internal class MCH_ST_AdvancedMode : CustomCombo
{
internal static MCHOpenerLogic MCHOpener = new();

protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.MCH_ST_AdvancedMode;

protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level)
{
bool interruptReady = ActionReady(All.HeadGraze) && CanInterruptEnemy() && CanDelayedWeave(actionID);
float heatblastRC = GetCooldown(Heatblast).CooldownTotal;

bool drillCD = !LevelChecked(Drill) || (!TraitLevelChecked(Traits.EnhancedMultiWeapon) &&
GetCooldownRemainingTime(Drill) > heatblastRC * 6) ||
(TraitLevelChecked(Traits.EnhancedMultiWeapon) &&
GetRemainingCharges(Drill) < GetMaxCharges(Drill) &&
GetCooldownRemainingTime(Drill) > heatblastRC * 6);

bool anchorCD = !LevelChecked(AirAnchor) ||
(LevelChecked(AirAnchor) && GetCooldownRemainingTime(AirAnchor) > heatblastRC * 6);

bool sawCD = !LevelChecked(Chainsaw) ||
(LevelChecked(Chainsaw) && GetCooldownRemainingTime(Chainsaw) > heatblastRC * 6);
float GCD = GetCooldown(OriginalHook(SplitShot)).CooldownTotal;

bool reassembledExcavator =
(IsEnabled(CustomComboPreset.MCH_ST_Adv_Reassemble) && Config.MCH_ST_Reassembled[0] &&
(HasEffect(Buffs.Reassembled) || !HasEffect(Buffs.Reassembled))) ||
(IsEnabled(CustomComboPreset.MCH_ST_Adv_Reassemble) && !Config.MCH_ST_Reassembled[0] &&
!HasEffect(Buffs.Reassembled)) ||
(!HasEffect(Buffs.Reassembled) && GetRemainingCharges(Reassemble) <= Config.MCH_ST_ReassemblePool) ||
!IsEnabled(CustomComboPreset.MCH_ST_Adv_Reassemble);
int BSUsed = ActionWatching.CombatActions.Count(x => x == BarrelStabilizer);

if (actionID is SplitShot or HeatedSplitShot)
{
Expand Down Expand Up @@ -393,7 +288,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

// Hypercharge
if (IsEnabled(CustomComboPreset.MCH_ST_Adv_Hypercharge) &&
(Gauge.Heat >= 50 || HasEffect(Buffs.Hypercharged)) && !MCHExtensions.IsComboExpiring(6) &&
(Gauge.Heat >= 50 || HasEffect(Buffs.Hypercharged)) && !MCHHelper.IsComboExpiring(6) &&
LevelChecked(Hypercharge) && !Gauge.IsOverheated &&
GetTargetHPPercent() >= Config.MCH_ST_HyperchargeHP)
{
Expand All @@ -413,8 +308,8 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

// Queen
if (IsEnabled(CustomComboPreset.MCH_Adv_TurretQueen) &&
MCHExtensions.UseQueen(Gauge) &&
GetCooldownRemainingTime(Wildfire) > GCD)
MCHHelper.UseQueen(Gauge) &&
(GetCooldownRemainingTime(Wildfire) > GCD || !LevelChecked(Wildfire)))
return OriginalHook(RookAutoturret);

// Gauss Round and Ricochet during HC
Expand Down Expand Up @@ -602,8 +497,6 @@ internal class MCH_AoE_SimpleMode : CustomCombo

protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level)
{
float GCD = GetCooldown(OriginalHook(SpreadShot)).CooldownTotal;

if (actionID is SpreadShot or Scattergun)
{
if (IsEnabled(CustomComboPreset.MCH_Variant_Cure) &&
Expand Down Expand Up @@ -691,8 +584,6 @@ internal class MCH_AoE_AdvancedMode : CustomCombo

protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level)
{
float GCD = GetCooldown(OriginalHook(SpreadShot)).CooldownTotal;

bool reassembledScattergun = IsEnabled(CustomComboPreset.MCH_AoE_Adv_Reassemble) &&
Config.MCH_AoE_Reassembled[0] && HasEffect(Buffs.Reassembled);

Expand Down Expand Up @@ -997,4 +888,71 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
return actionID;
}
}

#region ID's

public const byte JobID = 31;

public const uint
CleanShot = 2873,
HeatedCleanShot = 7413,
SplitShot = 2866,
HeatedSplitShot = 7411,
SlugShot = 2868,
HeatedSlugShot = 7412,
GaussRound = 2874,
Ricochet = 2890,
Reassemble = 2876,
Drill = 16498,
HotShot = 2872,
AirAnchor = 16500,
Hypercharge = 17209,
Heatblast = 7410,
SpreadShot = 2870,
Scattergun = 25786,
AutoCrossbow = 16497,
RookAutoturret = 2864,
RookOverdrive = 7415,
AutomatonQueen = 16501,
QueenOverdrive = 16502,
Tactician = 16889,
Chainsaw = 25788,
BioBlaster = 16499,
BarrelStabilizer = 7414,
Wildfire = 2878,
Dismantle = 2887,
Flamethrower = 7418,
BlazingShot = 36978,
DoubleCheck = 36979,
CheckMate = 36980,
Excavator = 36981,
FullMetalField = 36982;

public static class Buffs
{
public const ushort
Reassembled = 851,
Tactician = 1951,
Wildfire = 1946,
Overheated = 2688,
Flamethrower = 1205,
Hypercharged = 3864,
ExcavatorReady = 3865,
FullMetalMachinist = 3866;
}

public static class Debuffs
{
public const ushort
Dismantled = 2887,
Bioblaster = 1866;
}

public static class Traits
{
public const ushort
EnhancedMultiWeapon = 605;
}

#endregion
}

0 comments on commit c06f763

Please sign in to comment.