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

Commit

Permalink
fix: add a elapsed after method.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 26, 2023
1 parent 4a89575 commit f1c2349
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
22 changes: 20 additions & 2 deletions RotationSolver.Basic/Actions/BaseAction/BaseAction_Cooldown.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
using FFXIVClientStructs.FFXIV.Client.Game;
using RotationSolver.Basic;
using RotationSolver.Basic.Helpers;
using System.ComponentModel;

namespace RotationSolver.Actions.BaseAction;

public partial class BaseAction
{
public bool ElapsedAfterGCD(uint gcdCount = 0, uint abilityCount = 0)
public bool ElapsedOneChargeAfterGCD(uint gcdCount = 0, uint abilityCount = 0)
{
if (!IsCoolingDown) return false;
var elapsed = RecastTimeElapsedOneCharge;
return CooldownHelper.ElapsedAfterGCD(elapsed, gcdCount, abilityCount);
}

public bool ElapsedAfter(float time)
public bool ElapsedOneChargeAfter(float time)
{
if (!IsCoolingDown) return false;
var elapsed = RecastTimeElapsedOneCharge;
return CooldownHelper.ElapsedAfter(elapsed, time);
}

public bool ElapsedAfterGCD(uint gcdCount = 0, uint abilityCount = 0)
{
if (!IsCoolingDown) return false;
var elapsed = RecastTimeElapsed;
return CooldownHelper.ElapsedAfterGCD(elapsed, gcdCount, abilityCount);
}

public bool ElapsedAfter(float time)
{
if (!IsCoolingDown) return false;
var elapsed = RecastTimeElapsed;
return CooldownHelper.ElapsedAfter(elapsed, time);
}

public bool WillHaveOneChargeGCD(uint gcdCount = 0, uint abilityCount = 0)
{
if (HasOneCharge) return true;
Expand All @@ -41,11 +56,13 @@ private bool WillHaveOneCharge(float remain, bool addWeaponRemain)
/// <summary>
/// 复唱时间
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private unsafe float RecastTime => CoolDownDetail->Total;

/// <summary>
/// 复唱经过时间
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public unsafe float RecastTimeElapsed => CoolDownDetail->Elapsed;

/// <summary>
Expand All @@ -56,6 +73,7 @@ private bool WillHaveOneCharge(float remain, bool addWeaponRemain)
/// <summary>
/// 复唱剩余时间
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public float RecastTimeRemain => RecastTime - RecastTimeElapsed;

/// <summary>
Expand Down
15 changes: 15 additions & 0 deletions RotationSolver.Basic/Actions/IBaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ public interface IBaseAction : IAction
/// recast time remain total.
/// </summary>
float RecastTimeRemain { get; }
/// <summary>
/// Has it been in cooldown for <paramref name="gcdCount"/> gcds and <paramref name="abilityCount"/> abilities?
/// </summary>
/// <param name="gcdCount"></param>
/// <param name="abilityCount"></param>
/// <returns></returns>
bool ElapsedOneChargeAfterGCD(uint gcdCount = 0, uint abilityCount = 0);

/// <summary>
/// Has it been in cooldown for <paramref name="time"/> seconds?
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
bool ElapsedOneChargeAfter(float time);

/// <summary>
/// Has it been in cooldown for <paramref name="gcdCount"/> gcds and <paramref name="abilityCount"/> abilities?
/// </summary>
Expand Down

0 comments on commit f1c2349

Please sign in to comment.