From 77edae1ea46edccfed16e754f6b5bfa47a330771 Mon Sep 17 00:00:00 2001 From: Taurenkey Date: Sun, 8 Dec 2024 11:33:12 +0000 Subject: [PATCH] NIN fixes --- WrathCombo/Combos/PvE/NIN/NIN.cs | 109 ++++++++++++------------ WrathCombo/Combos/PvE/NIN/NIN_Helper.cs | 39 ++++----- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/WrathCombo/Combos/PvE/NIN/NIN.cs b/WrathCombo/Combos/PvE/NIN/NIN.cs index f2a936671..c75924250 100644 --- a/WrathCombo/Combos/PvE/NIN/NIN.cs +++ b/WrathCombo/Combos/PvE/NIN/NIN.cs @@ -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; @@ -112,7 +111,7 @@ public const uint EnhancedKasatsu = 250; } - + internal class NIN_ST_AdvancedMode : CustomCombo { @@ -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; @@ -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); @@ -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; @@ -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); @@ -367,11 +365,11 @@ 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) @@ -379,7 +377,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim else return OriginalHook(AeolianEdge); } - + if (gauge.Kazematoi == 0) { if (trueNorthArmor) @@ -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) @@ -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)) { @@ -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) && @@ -635,17 +631,22 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (actionID == SpinningEdge) { NINGauge gauge = GetJobGauge(); - 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; @@ -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; @@ -806,6 +805,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 (WasLastAction(TCJFumaShurikenJin)) return OriginalHook(Ten); @@ -813,32 +818,26 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim 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; diff --git a/WrathCombo/Combos/PvE/NIN/NIN_Helper.cs b/WrathCombo/Combos/PvE/NIN/NIN_Helper.cs index aa34a8b7b..983801ab0 100644 --- a/WrathCombo/Combos/PvE/NIN/NIN_Helper.cs +++ b/WrathCombo/Combos/PvE/NIN/NIN_Helper.cs @@ -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; @@ -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 @@ -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; /// Checks if the player is in a state to be able to cast a ninjitsu. private static bool CanCast() @@ -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 || @@ -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 {