Skip to content

Commit

Permalink
NIN fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taurenkey committed Dec 8, 2024
1 parent 16e2422 commit 77edae1
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 74 deletions.
109 changes: 54 additions & 55 deletions WrathCombo/Combos/PvE/NIN/NIN.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Dalamud.Game.ClientState.JobGauge.Types;
using Dalamud.Game.ClientState.Statuses;
using ECommons.DalamudServices;
using WrathCombo.Combos.PvE.Content;
using WrathCombo.Core;
using WrathCombo.CustomComboNS;
Expand Down Expand Up @@ -112,7 +111,7 @@ public const uint
EnhancedKasatsu = 250;
}



internal class NIN_ST_AdvancedMode : CustomCombo
{
Expand All @@ -131,7 +130,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
var canDelayedWeave = CanDelayedWeave(SpinningEdge);
bool inTrickBurstSaveWindow = IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_TrickAttack_Cooldowns) && IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_TrickAttack) && GetCooldownRemainingTime(TrickAttack) <= GetOptionValue(Config.Advanced_Trick_Cooldown);
bool useBhakaBeforeTrickWindow = GetCooldownRemainingTime(TrickAttack) >= 3;
bool setupSuitonWindow = GetCooldownRemainingTime(OriginalHook(TrickAttack) ) <= GetOptionValue(Config.Trick_CooldownRemaining) && !HasEffect(Buffs.ShadowWalker);
bool setupSuitonWindow = GetCooldownRemainingTime(OriginalHook(TrickAttack)) <= GetOptionValue(Config.Trick_CooldownRemaining) && !HasEffect(Buffs.ShadowWalker);
bool setupKassatsuWindow = GetCooldownRemainingTime(TrickAttack) <= 10 && HasEffect(Buffs.ShadowWalker);
bool chargeCheck = IsNotEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Ninjitsus_ChargeHold) || (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Ninjitsus_ChargeHold) && (NINHelper.InMudra || GetRemainingCharges(Ten) == 2 || (GetRemainingCharges(Ten) == 1 && GetCooldownChargeRemainingTime(Ten) < 3)));
bool poolCharges = !GetOptionBool(Config.Advanced_ChargePool) || (GetRemainingCharges(Ten) == 1 && GetCooldownChargeRemainingTime(Ten) < 2) || NINHelper.TrickDebuff || NINHelper.InMudra;
Expand All @@ -150,33 +149,38 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
bool trueNorthEdge = IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_TrueNorth) && TargetNeedsPositionals() && IsNotEnabled(CustomComboPreset.NIN_ST_AdvancedMode_TrueNorth_ArmorCrush) && !OnTargetsRear() && GetRemainingCharges(All.TrueNorth) > 0 && All.TrueNorth.LevelChecked() && !HasEffect(All.Buffs.TrueNorth) && canDelayedWeave;
bool dynamic = IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Dynamic);

if (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_BalanceOpener) && NINOpenerLogic.LevelChecked && NINOpener.DoFullOpener(ref actionID, mudraState))
return actionID;

if (IsNotEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Ninjitsus) || (ActionWatching.TimeSinceLastAction.TotalSeconds >= 5 && !InCombat()))
mudraState.CurrentMudra = MudraCasting.MudraState.None;

if (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Ninjitsus_Suiton) && IsOnCooldown(TrickAttack) && mudraState.CurrentMudra == MudraCasting.MudraState.CastingSuiton && !setupSuitonWindow)
mudraState.CurrentMudra = MudraCasting.MudraState.None;

if (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Ninjitsus_Suiton) && IsOnCooldown(TrickAttack) && mudraState.CurrentMudra != MudraCasting.MudraState.CastingSuiton && setupSuitonWindow)
mudraState.CurrentMudra = MudraCasting.MudraState.CastingSuiton;


if (OriginalHook(Ninjutsu) is Rabbit)
return OriginalHook(Ninjutsu);

if (NINHelper.InMudra)
{
if (mudraState.ContinueCurrentMudra(ref actionID))
return actionID;
}

if (!Suiton.LevelChecked()) //For low level
{
if (Raiton.LevelChecked() && IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Ninjitsus_Raiton)) //under 45 will only use Raiton
{
if (mudraState.CastRaiton(ref actionID))
if (mudraState.CastRaiton(ref actionID))
return actionID;
}
else if (!Raiton.LevelChecked() && mudraState.CastFumaShuriken(ref actionID) && IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Ninjitsus_FumaShuriken)) // 30-35 will use only fuma
return actionID;
}

if (OriginalHook(Ninjutsu) is Rabbit)
return OriginalHook(Ninjutsu);

if (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_BalanceOpener) && NINOpenerLogic.LevelChecked && NINOpener.DoFullOpener(ref actionID, mudraState))
return actionID;

if (HasEffect(Buffs.TenChiJin))
{
if (OriginalHook(Ten) == TCJFumaShurikenTen) return OriginalHook(Ten);
Expand All @@ -190,12 +194,6 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
(IsNotEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Mug) || (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Mug) && IsOnCooldown(Mug))))
mudraState.CurrentMudra = MudraCasting.MudraState.CastingHyoshoRanryu;

if (NINHelper.InMudra && !NINHelper.OriginalJutsu)
{
if (mudraState.ContinueCurrentMudra(ref actionID))
return actionID;
}

if (IsEnabled(CustomComboPreset.NIN_Variant_Cure) && IsEnabled(Variant.VariantCure) && PlayerHealthPercentageHp() <= GetOptionValue(Config.NIN_VariantCure))
return Variant.VariantCure;

Expand Down Expand Up @@ -254,7 +252,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
return OriginalHook(TrickAttack);

if (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_TenriJindo) && HasEffect(Buffs.TenriJendo) && ((NINHelper.TrickDebuff && NINHelper.MugDebuff) || GetBuffRemainingTime(Buffs.TenriJendo) <= 3))
return OriginalHook(TenriJendo);
return OriginalHook(TenriJendo);

if (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Bunshin) && Bunshin.LevelChecked() && IsOffCooldown(Bunshin) && gauge.Ninki >= bunshinPool)
return OriginalHook(Bunshin);
Expand Down Expand Up @@ -367,19 +365,19 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (lastComboMove == SpinningEdge && GustSlash.LevelChecked())
return OriginalHook(GustSlash);

if (lastComboMove == GustSlash && ArmorCrush.LevelChecked())
{
if (dynamic)
{
{
if (gauge.Kazematoi > 3)
{
if (trueNorthEdge)
return OriginalHook(All.TrueNorth);
else
return OriginalHook(AeolianEdge);
}

if (gauge.Kazematoi == 0)
{
if (trueNorthArmor)
Expand Down Expand Up @@ -480,6 +478,12 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (OriginalHook(Ninjutsu) is Rabbit)
return OriginalHook(Ninjutsu);

if (NINHelper.InMudra)
{
if (mudraState.ContinueCurrentMudra(ref actionID))
return actionID;
}

if (HasEffect(Buffs.TenChiJin))
{
if (tcjPath == 0)
Expand All @@ -497,8 +501,12 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

}

if (JustUsed(Kassatsu, 0.5f))
mudraState.CurrentMudra = MudraCasting.MudraState.None;
if (IsEnabled(CustomComboPreset.NIN_AoE_AdvancedMode_GokaMekkyaku) && HasEffect(Buffs.Kassatsu))
mudraState.CurrentMudra = MudraCasting.MudraState.CastingGokaMekkyaku;


if (IsEnabled(CustomComboPreset.NIN_Variant_Cure) && IsEnabled(Variant.VariantCure) && PlayerHealthPercentageHp() <= GetOptionValue(Config.NIN_VariantCure))
return Variant.VariantCure;

if (IsEnabled(CustomComboPreset.NIN_AoE_AdvancedMode_KunaisBane))
{
Expand All @@ -509,18 +517,6 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
return KunaisBane;
}

if (IsEnabled(CustomComboPreset.NIN_AoE_AdvancedMode_GokaMekkyaku) && HasEffect(Buffs.Kassatsu))
mudraState.CurrentMudra = MudraCasting.MudraState.CastingGokaMekkyaku;

if (NINHelper.InMudra && !NINHelper.OriginalJutsu)
{
if (mudraState.ContinueCurrentMudra(ref actionID))
return actionID;
}

if (IsEnabled(CustomComboPreset.NIN_Variant_Cure) && IsEnabled(Variant.VariantCure) && PlayerHealthPercentageHp() <= GetOptionValue(Config.NIN_VariantCure))
return Variant.VariantCure;

if (canWeave && !inMudraState)
{
if (IsEnabled(CustomComboPreset.NIN_Variant_Rampart) &&
Expand Down Expand Up @@ -635,17 +631,22 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (actionID == SpinningEdge)
{
NINGauge gauge = GetJobGauge<NINGauge>();
bool canWeave = CanWeave(SpinningEdge);
bool canWeave = CanWeave(SpinningEdge, 0.6) && !ActionWatching.HasDoubleWeaved();
bool inTrickBurstSaveWindow = GetCooldownRemainingTime(TrickAttack) <= 15 && Suiton.LevelChecked();
bool useBhakaBeforeTrickWindow = GetCooldownRemainingTime(TrickAttack) >= 3;
var canDelayedWeave = CanDelayedWeave(SpinningEdge);
bool trueNorthArmor = TargetNeedsPositionals() && !OnTargetsFlank() && GetRemainingCharges(All.TrueNorth) > 0 && All.TrueNorth.LevelChecked() && !HasEffect(All.Buffs.TrueNorth) && canDelayedWeave;
bool trueNorthEdge = TargetNeedsPositionals() && !OnTargetsRear() && GetRemainingCharges(All.TrueNorth) > 0 && All.TrueNorth.LevelChecked() && !HasEffect(All.Buffs.TrueNorth) && canDelayedWeave;


if (OriginalHook(Ninjutsu) is Rabbit)
return OriginalHook(Ninjutsu);

if (NINHelper.InMudra)
{
if (mudraState.ContinueCurrentMudra(ref actionID))
return actionID;
}

if (IsEnabled(CustomComboPreset.NIN_ST_SimpleMode_BalanceOpener) && NINOpenerLogic.LevelChecked && NINOpener.DoFullOpener(ref actionID, mudraState))
return actionID;

Expand All @@ -656,18 +657,16 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
return OriginalHook(Ten);
}

if (NINHelper.InMudra && !NINHelper.OriginalJutsu)
if (HasEffect(Buffs.Kassatsu))
{
if (mudraState.ContinueCurrentMudra(ref actionID))
mudraState.CurrentMudra = MudraCasting.MudraState.CastingHyoshoRanryu;
if (mudraState.CastHyoshoRanryu(ref actionID))
return actionID;
}

if (IsEnabled(CustomComboPreset.NIN_Variant_Cure) && IsEnabled(Variant.VariantCure) && PlayerHealthPercentageHp() <= GetOptionValue(Config.NIN_VariantCure))
return Variant.VariantCure;

if (mudraState.CastHyoshoRanryu(ref actionID))
return actionID;

if (GetCooldownRemainingTime(TrickAttack) < 15 && TrickAttack.LevelChecked() && !HasEffect(Buffs.ShadowWalker))
if (mudraState.CastSuiton(ref actionID))
return actionID;
Expand Down Expand Up @@ -806,39 +805,39 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if (OriginalHook(Ninjutsu) is Rabbit)
return OriginalHook(Ninjutsu);

if (NINHelper.InMudra)
{
if (mudraState.ContinueCurrentMudra(ref actionID))
return actionID;
}

if (HasEffect(Buffs.TenChiJin))
{
if (WasLastAction(TCJFumaShurikenJin)) return OriginalHook(Ten);
if (WasLastAction(TCJKaton) || WasLastAction(HollowNozuchi)) return OriginalHook(Chi);
return OriginalHook(Jin);
}

if (JustUsed(Kassatsu, 0.5f))
mudraState.CurrentMudra = MudraCasting.MudraState.None;

if (NINHelper.InMudra && !NINHelper.OriginalJutsu)
{
if (mudraState.ContinueCurrentMudra(ref actionID))
return actionID;
}

if (IsEnabled(CustomComboPreset.NIN_Variant_Cure) && IsEnabled(Variant.VariantCure) && PlayerHealthPercentageHp() <= GetOptionValue(Config.NIN_VariantCure))
return Variant.VariantCure;

if (HasEffect(Buffs.Kassatsu))
{
if (GokaMekkyaku.LevelChecked())
{
mudraState.CurrentMudra = MudraCasting.MudraState.CastingGokaMekkyaku;
if (mudraState.CastGokaMekkyaku(ref actionID))
return actionID;
}
else
{
mudraState.CurrentMudra = MudraCasting.MudraState.CastingKaton;
if (mudraState.CastKaton(ref actionID))
return actionID;
}
}

if (IsEnabled(CustomComboPreset.NIN_Variant_Cure) && IsEnabled(Variant.VariantCure) && PlayerHealthPercentageHp() <= GetOptionValue(Config.NIN_VariantCure))
return Variant.VariantCure;


if (!HasEffect(Buffs.ShadowWalker) && KunaisBane.LevelChecked() && GetCooldownRemainingTime(KunaisBane) < 5 && mudraState.CastHuton(ref actionID))
return actionID;

Expand Down
39 changes: 20 additions & 19 deletions WrathCombo/Combos/PvE/NIN/NIN_Helper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.JobGauge.Types;
using Dalamud.Game.ClientState.Statuses;
using ECommons.DalamudServices;
using System;
using System.Collections.ObjectModel;
using WrathCombo.Combos.JobHelpers.Enums;
using WrathCombo.CustomComboNS.Functions;
using WrathCombo.Data;
Expand Down Expand Up @@ -31,6 +34,10 @@ private static bool TargetHasMugDebuff()
return CustomComboFunctions.TargetHasEffect(Debuffs.Mug) ||
CustomComboFunctions.TargetHasEffect(Debuffs.Dokumori);
}

public static Status? MudraBuff => CustomComboFunctions.FindEffect(Buffs.Mudra);

public static uint CurrentNinjutsu => CustomComboFunctions.OriginalHook(Ninjutsu);
}

internal class MudraCasting
Expand All @@ -49,23 +56,7 @@ public enum MudraState
CastingHyoshoRanryu
}

private MudraState currentMudra = MudraState.None;

private bool justResetMudra;

public MudraState CurrentMudra
{
get => currentMudra;
set
{
if (value == MudraState.None)
justResetMudra = true;
else
justResetMudra = false;

currentMudra = value;
}
}
public MudraState CurrentMudra = MudraState.None;

///<summary> Checks if the player is in a state to be able to cast a ninjitsu.</summary>
private static bool CanCast()
Expand Down Expand Up @@ -451,6 +442,14 @@ public bool CastHyoshoRanryu(ref uint actionID)

public bool ContinueCurrentMudra(ref uint actionID)
{

if (ActionWatching.TimeSinceLastAction.TotalSeconds > 1 && NINHelper.CurrentNinjutsu == Ninjutsu && CurrentMudra != MudraState.None)
{
NINHelper.InMudra = false;
ActionWatching.LastAction = 0;
CurrentMudra = MudraState.None;
}

if ((ActionWatching.LastAction == FumaShuriken ||
ActionWatching.LastAction == Katon ||
ActionWatching.LastAction == Raiton ||
Expand All @@ -459,9 +458,11 @@ public bool ContinueCurrentMudra(ref uint actionID)
ActionWatching.LastAction == Doton ||
ActionWatching.LastAction == Suiton ||
ActionWatching.LastAction == GokaMekkyaku ||
ActionWatching.LastAction == HyoshoRanryu) &&
!justResetMudra)
ActionWatching.LastAction == HyoshoRanryu))
{
CurrentMudra = MudraState.None;
NINHelper.InMudra = false;
}

return CurrentMudra switch
{
Expand Down

0 comments on commit 77edae1

Please sign in to comment.