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

Commit

Permalink
fix: add an OnLastAbility Option for ability using.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 20, 2023
1 parent 1eb1bd5 commit 78d65d4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 30 deletions.
5 changes: 5 additions & 0 deletions RotationSolver.Basic/Actions/BaseAction_ActionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public unsafe virtual bool CanUse(out IAction act, CanUseOption option = CanUseO
}
}

if(option.HasFlag(CanUseOption.OnLastAbility) && !IsRealGCD)
{
if (DataCenter.NextAbilityToNextGCD > AnimationLockTime + DataCenter.Ping + DataCenter.MinPing) return false;
}

if (!option.HasFlag(CanUseOption.IgnoreCastCheck) && CastTime > 0 && DataCenter.IsMoving &&
!player.HasStatus(true, CustomRotation.Swiftcast.StatusProvide)) return false;

Expand Down
5 changes: 5 additions & 0 deletions RotationSolver.Basic/Data/CanUseOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ public enum CanUseOption : byte
/// The combination of <see cref="MustUse"/> and <see cref="EmptyOrSkipCombo"/>
/// </summary>
MustUseEmpty = MustUse | EmptyOrSkipCombo,

/// <summary>
/// On the last ability in one GCD.
/// </summary>
OnLastAbility = 1 << 5,
}
2 changes: 2 additions & 0 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ public static float DPSTaken

public static ActionID LastAbility { get; private set; } = 0;
public static float Ping { get; private set; } = 0.07f;

public const float MinPing = 0.6f;
public static void AddActionRec(Action act)
{
var id = (ActionID)act.RowId;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_Invoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private IAction Invoke(out IAction gcdAction)

if (gcdAction != null)
{
if (nextAbilityToNextGCD < 0.6f + DataCenter.Ping || DataCenter.WeaponTotal < DataCenter.CastingTotal) return gcdAction;
if (nextAbilityToNextGCD < DataCenter.MinPing + DataCenter.Ping || DataCenter.WeaponTotal < DataCenter.CastingTotal) return gcdAction;

if (Ability(nextAbilityToNextGCD, gcdAction, out IAction ability, helpDefenseAOE, helpDefenseSingle)) return ability;

Expand Down
1 change: 0 additions & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ public abstract partial class CustomRotation
public static uint AdjustId(uint id) => Service.GetAdjustedActionId(id);
public static ActionID AdjustId(ActionID id) => Service.GetAdjustedActionId(id);


/// <summary>
/// The actions that were used by player successfully. The first one is the latest successfully used one.
/// </summary>
Expand Down
30 changes: 2 additions & 28 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,31 +130,6 @@ private static unsafe void UpdateWeaponTime()
//Casting time.
if (DataCenter.WeaponElapsed < 0.3) DataCenter.CastingTotal = castTotal;
if (weaponTotal > 0 && DataCenter.WeaponElapsed > 0.2) DataCenter.WeaponTotal = weaponTotal;

////确认能力技的相关信息
//var interval = Service.Config.AbilitiesInterval;
//if (DataCenter.WeaponRemain < interval
// || DataCenter.WeaponElapsed == 0)
//{
// DataCenter.AbilityRemain = 0;
// if (DataCenter.WeaponRemain > 0)
// {
// DataCenter.AbilityRemain = DataCenter.WeaponRemain + interval;
// }
// DataCenter.AbilityRemainCount = 0;
//}
//else if (DataCenter.WeaponRemain < 2 * interval)
//{
// DataCenter.AbilityRemain = DataCenter.WeaponRemain - interval;
// DataCenter.AbilityRemainCount = 1;
//}
//else
//{
// var abilityWhole = (int)(weaponTotal / Service.Config.AbilitiesInterval - 1);
// DataCenter.AbilityRemain = interval - DataCenter.WeaponElapsed % interval;
// DataCenter.AbilityRemainCount = (byte)(abilityWhole - (int)(DataCenter.WeaponElapsed / interval));
//}

}

static uint _lastMP = 0;
Expand Down Expand Up @@ -217,10 +192,9 @@ internal unsafe static void DoAction()
if (DataCenter.WeaponElapsed <= DataCenter.CastingTotal) return;

//The last one.
var ping = 0.06f;
if (timeToNext + nextAction.AnimationLockTime + ping + 0.6f > DataCenter.WeaponRemain)
if (timeToNext + nextAction.AnimationLockTime + DataCenter.Ping + DataCenter.MinPing > DataCenter.WeaponRemain)
{
if (DataCenter.WeaponRemain > nextAction.AnimationLockTime + ping + Service.Config.ActionAhead) return;
if (DataCenter.WeaponRemain > nextAction.AnimationLockTime + DataCenter.Ping + Service.Config.ActionAhead) return;
RSCommands.DoAnAction(false);
}
else if (timeToNext < Service.Config.ActionAhead)
Expand Down

0 comments on commit 78d65d4

Please sign in to comment.