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

Commit

Permalink
fix: change SkipDisable to internal.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 23, 2023
1 parent b6992f2 commit 28aba55
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
"7510": 0.1,
"7511": 0.1,
"7513": 0.6,
"7514": 0.1,
"7514": 0.6,
"7517": 0.6,
"7518": 0.6,
"7519": 0.6,
Expand Down Expand Up @@ -545,7 +545,7 @@
"25865": 0.1,
"25870": 0.6,
"25871": 0.1,
"25872": 0.1,
"25872": 0.6,
"25882": 0.6,
"25885": 0.6,
"26762": 0.1,
Expand Down
4 changes: 3 additions & 1 deletion RotationSolver.Basic/Actions/BaseAction_ActionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ private bool WillCooldown
}
}

internal static bool SkipDisable { get; set; } = false;

/// <summary>
/// Can this action be used.
/// </summary>
Expand All @@ -77,7 +79,7 @@ public unsafe virtual bool CanUse(out IAction act, CanUseOption option = CanUseO
if (player == null) return false;
Target = player;

if (!option.HasFlag(CanUseOption.SkipDisable) && !IsEnabled) return false;
if (!SkipDisable && !IsEnabled) return false;

if (DataCenter.DisabledAction != null && DataCenter.DisabledAction.Contains(ID)) return false;

Expand Down
13 changes: 4 additions & 9 deletions RotationSolver.Basic/Data/CanUseOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,15 @@ public enum CanUseOption : byte
/// </summary>
EmptyOrSkipCombo = 1 << 1,

/// <summary>
/// Skip the disable for emergency use. Please always set this to false.
/// </summary>
SkipDisable = 1 << 2,

/// <summary>
/// Ignore the target data.
/// </summary>
IgnoreTarget = 1 << 3,
IgnoreTarget = 1 << 2,

/// <summary>
/// Ignore the check of casting an action while moving.
/// </summary>
IgnoreCastCheck = 1 << 4,
IgnoreCastCheck = 1 << 3,

/// <summary>
/// The combination of <see cref="MustUse"/> and <see cref="EmptyOrSkipCombo"/>
Expand All @@ -47,10 +42,10 @@ public enum CanUseOption : byte
/// <summary>
/// On the last ability in one GCD.
/// </summary>
OnLastAbility = 1 << 5,
OnLastAbility = 1 << 4,

/// <summary>
/// Ignore clipping check for 0GCDs.
/// </summary>
IgnoreClippingCheck = 1 << 6,
IgnoreClippingCheck = 1 << 5,
}
7 changes: 5 additions & 2 deletions RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ public abstract partial class CustomRotation
private bool Ability(IAction nextGCD, out IAction act, bool helpDefenseAOE, bool helpDefenseSingle)
{
act = DataCenter.CommandNextAction;

BaseAction.SkipDisable = true;
if (act is IBaseAction a && a != null && !a.IsRealGCD && a.CanUse(out _,
CanUseOption.MustUse | CanUseOption.SkipDisable | CanUseOption.EmptyOrSkipCombo)) return true;
CanUseOption.MustUse | CanUseOption.EmptyOrSkipCombo)) return true;
BaseAction.SkipDisable = false;

if(act is IBaseItem i && i.CanUse(out _)) return true;
if (act is IBaseItem i && i.CanUse(out _)) return true;

if (!Service.Config.GetValue(SettingsCommand.UseAbility)
|| Player.TotalCastTime > 0)
Expand Down
5 changes: 4 additions & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_GCD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ public abstract partial class CustomRotation
private IAction GCD(bool helpDefenseAOE, bool helpDefenseSingle)
{
IAction act = DataCenter.CommandNextAction;
if (act is IBaseAction a && a != null && a.IsRealGCD && a.CanUse(out _, CanUseOption.MustUse | CanUseOption.SkipDisable | CanUseOption.EmptyOrSkipCombo)) return act;

BaseAction.SkipDisable = true;
if (act is IBaseAction a && a != null && a.IsRealGCD && a.CanUse(out _, CanUseOption.MustUse | CanUseOption.EmptyOrSkipCombo)) return act;
BaseAction.SkipDisable = false;

if (EmergencyGCD(out act)) return act;

Expand Down
4 changes: 3 additions & 1 deletion RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@ internal static (Vector2, Vector2) DrawIAction(IAction action, float width, floa
bool canDoIt = false;
if(action is IBaseAction act)
{
canDoIt = act.CanUse(out _, CanUseOption.MustUse | CanUseOption.EmptyOrSkipCombo | CanUseOption.SkipDisable | CanUseOption.IgnoreClippingCheck);
BaseAction.SkipDisable = true;
canDoIt = act.CanUse(out _, CanUseOption.MustUse | CanUseOption.EmptyOrSkipCombo | CanUseOption.IgnoreClippingCheck);
BaseAction.SkipDisable = false;
}
else if (action is IBaseItem item)
{
Expand Down

0 comments on commit 28aba55

Please sign in to comment.