Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Iaotle committed Jan 23, 2022
1 parent b124367 commit 1b454df
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 61 deletions.
2 changes: 2 additions & 0 deletions XIVSlothCombo.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CD/@EntryIndexedValue">CD</s:String></wpf:ResourceDictionary>
120 changes: 59 additions & 61 deletions XIVSlothCombo/Combos/GNB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ internal static class GNB
{
public const byte JobID = 37;

public static int MaxCartridges(byte level)
{
return level >= Levels.CartridgeCharge3 ? 3 : 2;
}

public const uint
KeenEdge = 16137,
NoMercy = 16138,
Expand Down Expand Up @@ -80,14 +85,13 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (comboTime > 0)
{
var gauge = GetJobGauge<GNBGauge>();
var maxAmmo = level >= GNB.Levels.CartridgeCharge3 ? 3 : 2;
var GCD = GetCooldown(actionID);
var blastingzoneCD = GetCooldown(GNB.BlastingZone);
var doubledownCD = GetCooldown(GNB.DoubleDown);
var sonicbreakCD = GetCooldown(GNB.SonicBreak);
var bowshockCD = GetCooldown(GNB.BowShock);
var gnashingfangCD = GetCooldown(GNB.GnashingFang);
var roughdivideCD = GetCooldown(GNB.RoughDivide);
var blastingZoneCD = GetCooldown(GNB.BlastingZone);
var doubleDownCD = GetCooldown(GNB.DoubleDown);
var sonicBreakCD = GetCooldown(GNB.SonicBreak);
var bowShockCD = GetCooldown(GNB.BowShock);
var gnashingFangCD = GetCooldown(GNB.GnashingFang);
var roughDivideCD = GetCooldown(GNB.RoughDivide);

// Gnashing Fang combo + Continuation, Gnashing Fang needs to be used manually in order for users to control for any delay based on fight times
if (level >= GNB.Levels.GnashingFang && IsEnabled(CustomComboPreset.GunbreakerGnashingFangOnMain))
Expand All @@ -97,45 +101,45 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (level >= GNB.Levels.DoubleDown)
{
if (!doubledownCD.IsCooldown && level >= GNB.Levels.DoubleDown && (gauge.Ammo == 2 || gauge.Ammo == 3) && IsEnabled(CustomComboPreset.GunbreakerDDonMain))
if (!doubleDownCD.IsCooldown && gauge.Ammo is 2 or 3 && IsEnabled(CustomComboPreset.GunbreakerDDonMain))
return GNB.DoubleDown;
if (IsEnabled(CustomComboPreset.GunbreakerCDsOnMainComboFeature) && doubledownCD.IsCooldown)
if (IsEnabled(CustomComboPreset.GunbreakerCDsOnMainComboFeature) && doubleDownCD.IsCooldown)
{
if (level >= GNB.Levels.DangerZone && !blastingzoneCD.IsCooldown)
if (!blastingZoneCD.IsCooldown)
return OriginalHook(GNB.DangerZone);
if (level >= GNB.Levels.BowShock && !bowshockCD.IsCooldown)
if (!bowShockCD.IsCooldown)
return GNB.BowShock;
if (level >= GNB.Levels.SonicBreak && !sonicbreakCD.IsCooldown)
if (!sonicBreakCD.IsCooldown)
return GNB.SonicBreak;
}
}

if (level < GNB.Levels.DoubleDown && IsEnabled(CustomComboPreset.GunbreakerCDsOnMainComboFeature))
{
if (level >= GNB.Levels.SonicBreak && !sonicbreakCD.IsCooldown)
if (level >= GNB.Levels.SonicBreak && !sonicBreakCD.IsCooldown)
return GNB.SonicBreak;
if (level >= GNB.Levels.BowShock && !bowshockCD.IsCooldown)
if (level >= GNB.Levels.BowShock && !bowShockCD.IsCooldown)
return GNB.BowShock;
if (level >= GNB.Levels.DangerZone && !blastingzoneCD.IsCooldown)
if (level >= GNB.Levels.DangerZone && !blastingZoneCD.IsCooldown)
return OriginalHook(GNB.DangerZone);
}
}

if (level < GNB.Levels.DoubleDown && !HasEffect(GNB.Buffs.NoMercy) && !blastingzoneCD.IsCooldown && level >= GNB.Levels.DangerZone && gauge.AmmoComboStep == 1)
if (level < GNB.Levels.DoubleDown && !HasEffect(GNB.Buffs.NoMercy) && !blastingZoneCD.IsCooldown && level >= GNB.Levels.DangerZone && gauge.AmmoComboStep == 1)
return OriginalHook(GNB.DangerZone);
if (gauge.AmmoComboStep == 1)
return OriginalHook(GNB.GnashingFang);
if (HasEffect(GNB.Buffs.ReadyToTear) && level >= GNB.Levels.Continuation && GCD.CooldownRemaining > 0.7)
return GNB.AbdomenTear;
//aligns it with 2nd GCD in NM.
if (!HasEffect(GNB.Buffs.NoMercy) && !blastingzoneCD.IsCooldown && level >= GNB.Levels.DangerZone && gauge.AmmoComboStep == 2 && IsEnabled(CustomComboPreset.GunbreakerCDsOnMainComboFeature))
if (!HasEffect(GNB.Buffs.NoMercy) && !blastingZoneCD.IsCooldown && level >= GNB.Levels.DangerZone && gauge.AmmoComboStep == 2 && IsEnabled(CustomComboPreset.GunbreakerCDsOnMainComboFeature))
return OriginalHook(GNB.DangerZone);

if (gauge.AmmoComboStep == 2)
return OriginalHook(GNB.GnashingFang);
if (HasEffect(GNB.Buffs.ReadyToGouge) && level >= GNB.Levels.Continuation && GCD.CooldownRemaining > 0.7)
return GNB.EyeGouge;
if (HasEffect(GNB.Buffs.NoMercy) && gnashingfangCD.IsCooldown && gauge.AmmoComboStep == 0)
if (HasEffect(GNB.Buffs.NoMercy) && gnashingFangCD.IsCooldown && gauge.AmmoComboStep == 0)
{
if (level >= GNB.Levels.EnhancedContinuation && HasEffect(GNB.Buffs.ReadyToBlast) && IsEnabled(CustomComboPreset.GunbreakerBurstStrikeConFeature))
return GNB.Hypervelocity;
Expand All @@ -150,13 +154,13 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
// uses all stacks
if (IsEnabled(CustomComboPreset.GunbreakerRoughDivide2StackOption) && level >= 56)
{
if (roughdivideCD.CooldownRemaining < 30 && GCD.CooldownRemaining > 0.7)
if (roughDivideCD.CooldownRemaining < 30 && GCD.CooldownRemaining > 0.7)
return GNB.RoughDivide;
}
// leaves 1 stack
if (IsEnabled(CustomComboPreset.GunbreakerRoughDivide1StackOption) && level >= 56)
{
if (roughdivideCD.CooldownRemaining < 60 && !roughdivideCD.IsCooldown && GCD.CooldownRemaining > 0.7)
if (roughDivideCD.CooldownRemaining < 60 && !roughDivideCD.IsCooldown && GCD.CooldownRemaining > 0.7)
return GNB.RoughDivide;
}

Expand All @@ -171,7 +175,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
return GNB.Hypervelocity;
}

if (level >= GNB.Levels.BurstStrike && gauge.Ammo == maxAmmo)
if (level >= GNB.Levels.BurstStrike && gauge.Ammo == GNB.MaxCartridges(level))
return GNB.BurstStrike;

return GNB.SolidBarrel;
Expand All @@ -195,14 +199,14 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
var gauge = GetJobGauge<GNBGauge>();
var GCD = GetCooldown(actionID);
var gnashingfangCD = GetCooldown(GNB.GnashingFang);
var blastingzoneCD = GetCooldown(GNB.BlastingZone);
var doubledownCD = GetCooldown(GNB.DoubleDown);
var sonicbreakCD = GetCooldown(GNB.SonicBreak);
var bowshockCD = GetCooldown(GNB.BowShock);
var gnashingFangCD = GetCooldown(GNB.GnashingFang);
var blastingZoneCD = GetCooldown(GNB.BlastingZone);
var doubleDownCD = GetCooldown(GNB.DoubleDown);
var sonicBreakCD = GetCooldown(GNB.SonicBreak);
var bowShockCD = GetCooldown(GNB.BowShock);

if (level >= GNB.Levels.GnashingFang)
if (gauge.AmmoComboStep == 0 && !gnashingfangCD.IsCooldown)
if (gauge.AmmoComboStep == 0 && !gnashingFangCD.IsCooldown)
return OriginalHook(GNB.GnashingFang);
if (HasEffect(GNB.Buffs.ReadyToRip) && level >= GNB.Levels.Continuation)

Expand All @@ -211,40 +215,39 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (level >= GNB.Levels.DoubleDown)
{
if (!doubledownCD.IsCooldown && level >= GNB.Levels.DoubleDown && (gauge.Ammo == 2 || gauge.Ammo == 3))
if (!doubleDownCD.IsCooldown && gauge.Ammo is 2 or 3)
return GNB.DoubleDown;
if (doubledownCD.IsCooldown)
if (doubleDownCD.IsCooldown)
{
if (level >= GNB.Levels.DangerZone && !blastingzoneCD.IsCooldown)
if (!blastingZoneCD.IsCooldown)
return OriginalHook(GNB.DangerZone);
if (level >= GNB.Levels.BowShock && !bowshockCD.IsCooldown)
if (!bowShockCD.IsCooldown)
return GNB.BowShock;
if (level >= GNB.Levels.SonicBreak && !sonicbreakCD.IsCooldown)
if (!sonicBreakCD.IsCooldown)
return GNB.SonicBreak;
}
}

if (level < GNB.Levels.DoubleDown)
{
if (level >= GNB.Levels.SonicBreak && !sonicbreakCD.IsCooldown)

if (level >= GNB.Levels.SonicBreak && !sonicBreakCD.IsCooldown)
return GNB.SonicBreak;
if (level >= GNB.Levels.BowShock && !bowshockCD.IsCooldown)
if (level >= GNB.Levels.BowShock && !bowShockCD.IsCooldown)
return GNB.BowShock;
if (level >= GNB.Levels.DangerZone && !blastingzoneCD.IsCooldown)
if (level >= GNB.Levels.DangerZone && !blastingZoneCD.IsCooldown)
return OriginalHook(GNB.DangerZone);
}

}

if (level < GNB.Levels.DoubleDown && !HasEffect(GNB.Buffs.NoMercy) && !blastingzoneCD.IsCooldown && level >= GNB.Levels.DangerZone && gauge.AmmoComboStep == 1)
if (level < GNB.Levels.DoubleDown && !HasEffect(GNB.Buffs.NoMercy) && !blastingZoneCD.IsCooldown && level >= GNB.Levels.DangerZone && gauge.AmmoComboStep == 1)
return OriginalHook(GNB.DangerZone);
if (gauge.AmmoComboStep == 1)
return OriginalHook(GNB.GnashingFang);
if (HasEffect(GNB.Buffs.ReadyToTear) && level >= GNB.Levels.Continuation && GCD.CooldownRemaining > 0.7)
return GNB.AbdomenTear;
//aligns it with 2nd GCD in NM.
if (level >= GNB.Levels.DoubleDown && !HasEffect(GNB.Buffs.NoMercy) && !blastingzoneCD.IsCooldown && level >= GNB.Levels.DangerZone && gauge.AmmoComboStep == 2)
if (level >= GNB.Levels.DoubleDown && !HasEffect(GNB.Buffs.NoMercy) && !blastingZoneCD.IsCooldown && gauge.AmmoComboStep == 2)
return OriginalHook(GNB.DangerZone);

if (gauge.AmmoComboStep == 2)
Expand All @@ -254,14 +257,12 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (HasEffect(GNB.Buffs.NoMercy))
{
if (level >= GNB.Levels.EnhancedContinuation && HasEffect(GNB.Buffs.ReadyToBlast))

return GNB.Hypervelocity;
if ((gauge.Ammo != 0) && level >= GNB.Levels.BurstStrike)
return GNB.BurstStrike;
}
//final check if Burst Strike is used right before No Mercy ends
if (level >= GNB.Levels.EnhancedContinuation && HasEffect(GNB.Buffs.ReadyToBlast))

if (level >= GNB.Levels.EnhancedContinuation && HasEffect(GNB.Buffs.ReadyToBlast))
return GNB.Hypervelocity;
}

Expand Down Expand Up @@ -298,9 +299,8 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (IsEnabled(CustomComboPreset.GunbreakerAmmoOvercapFeature) && level >= GNB.Levels.FatedCircle)
{
var gauge = GetJobGauge<GNBGauge>();
var cartridgeMax = level >= 88 ? 3 : 2;

if (gauge.Ammo == cartridgeMax)
if (gauge.Ammo == GNB.MaxCartridges(level))
{
return GNB.FatedCircle;
}
Expand Down Expand Up @@ -343,40 +343,40 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
var gauge = GetJobGauge<GNBGauge>();
var GCD = GetCooldown(actionID);
var gnashingfangCD = GetCooldown(GNB.GnashingFang);
var blastingzoneCD = GetCooldown(GNB.BlastingZone);
var doubledownCD = GetCooldown(GNB.DoubleDown);
var sonicbreakCD = GetCooldown(GNB.SonicBreak);
var bowshockCD = GetCooldown(GNB.BowShock);
var gnashingFangCD = GetCooldown(GNB.GnashingFang);
var blastingZoneCD = GetCooldown(GNB.BlastingZone);
var doubleDownCD = GetCooldown(GNB.DoubleDown);
var sonicBreakCD = GetCooldown(GNB.SonicBreak);
var bowShockCD = GetCooldown(GNB.BowShock);

if (level >= GNB.Levels.GnashingFang && HasEffect(GNB.Buffs.NoMercy))
{
if (gauge.AmmoComboStep == 0 && !gnashingfangCD.IsCooldown)
if (gauge.AmmoComboStep == 0 && !gnashingFangCD.IsCooldown)
return OriginalHook(GNB.GnashingFang);
if (HasEffect(GNB.Buffs.ReadyToRip) && level >= GNB.Levels.Continuation && GCD.CooldownRemaining > 0.7)
return OriginalHook(GNB.Continuation);
if (level >= GNB.Levels.DoubleDown)
{
if (!doubledownCD.IsCooldown && level >= GNB.Levels.DoubleDown && (gauge.Ammo == 2 || gauge.Ammo == 3))
if (!doubleDownCD.IsCooldown && gauge.Ammo is 2 or 3)
return GNB.DoubleDown;
if (doubledownCD.IsCooldown)
if (doubleDownCD.IsCooldown)
{
if (level >= GNB.Levels.DangerZone && !blastingzoneCD.IsCooldown)
if (!blastingZoneCD.IsCooldown)
return OriginalHook(GNB.DangerZone);
if (level >= GNB.Levels.BowShock && !bowshockCD.IsCooldown)
if (!bowShockCD.IsCooldown)
return GNB.BowShock;
if (level >= GNB.Levels.SonicBreak && !sonicbreakCD.IsCooldown)
if (!sonicBreakCD.IsCooldown)
return GNB.SonicBreak;
}
}

if (level < GNB.Levels.DoubleDown)
{
if (level >= GNB.Levels.SonicBreak && !sonicbreakCD.IsCooldown)
if (!sonicBreakCD.IsCooldown)
return GNB.SonicBreak;
if (level >= GNB.Levels.BowShock && !bowshockCD.IsCooldown)
if (level >= GNB.Levels.BowShock && !bowShockCD.IsCooldown)
return GNB.BowShock;
if (level >= GNB.Levels.DangerZone && !blastingzoneCD.IsCooldown)
if (!blastingZoneCD.IsCooldown)
return OriginalHook(GNB.DangerZone);
}

Expand All @@ -390,15 +390,13 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (HasEffect(GNB.Buffs.ReadyToGouge) && level >= GNB.Levels.Continuation)
return OriginalHook(GNB.Continuation);
if (level >= GNB.Levels.EnhancedContinuation && HasEffect(GNB.Buffs.ReadyToBlast))

return GNB.Hypervelocity;
if ((gauge.Ammo != 0) && level >= GNB.Levels.BurstStrike)
if (gauge.Ammo != 0)
return GNB.BurstStrike;
}

//final check if Burst Strike is used right before No Mercy ends
if (level >= GNB.Levels.EnhancedContinuation && HasEffect(GNB.Buffs.ReadyToBlast))

if (level >= GNB.Levels.EnhancedContinuation && HasEffect(GNB.Buffs.ReadyToBlast))
return GNB.Hypervelocity;
return GNB.NoMercy;
}
Expand Down

0 comments on commit 1b454df

Please sign in to comment.