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

Commit

Permalink
docs: add comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 27, 2024
1 parent 7924c55 commit 86264c0
Show file tree
Hide file tree
Showing 38 changed files with 745 additions and 311 deletions.
76 changes: 71 additions & 5 deletions RotationSolver.Basic/Actions/ActionBasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

namespace RotationSolver.Basic.Actions;

public struct ActionBasicInfo
/// <summary>
/// The action info for the <see cref="Lumina.Excel.GeneratedSheets.Action"/>.
/// </summary>
public readonly struct ActionBasicInfo
{
internal static readonly uint[] ActionsNoNeedCasting =
[
Expand All @@ -15,25 +18,65 @@ public struct ActionBasicInfo
];

private readonly IBaseAction _action;

/// <summary>
/// The name of the action.
/// </summary>
public readonly string Name => _action.Action.Name;

/// <summary>
/// The ID of the action.
/// </summary>
public readonly uint ID => _action.Action.RowId;

/// <summary>
/// The icon of the action.
/// </summary>
public readonly uint IconID => ID == (uint)ActionID.SprintPvE ? 104u : _action.Action.Icon;

/// <summary>
/// The adjust id of this action.
/// </summary>
public readonly uint AdjustedID => (uint)Service.GetAdjustedActionId((ActionID)ID);

/// <summary>
/// The attack type of this action.
/// </summary>
public readonly AttackType AttackType => (AttackType)(_action.Action.AttackType.Value?.RowId ?? byte.MaxValue);

/// <summary>
/// The aspect of this action.
/// </summary>
public Aspect Aspect { get; }

/// <summary>
/// The animation lock time of this action.
/// </summary>
public readonly float AnimationLockTime => OtherConfiguration.AnimationLockTime?.TryGetValue(AdjustedID, out var time) ?? false ? time : 0.6f;

/// <summary>
/// The level of this action.
/// </summary>
public readonly byte Level => _action.Action.ClassJobLevel;

/// <summary>
/// If this action is enough level to use.
/// </summary>
public readonly bool EnoughLevel => Player.Level >= Level;

/// <summary>
/// If this action a pvp action.
/// </summary>
public readonly bool IsPvP => _action.Action.IsPvP;

/// <summary>
/// Casting time.
/// </summary>
public readonly unsafe float CastTime => ((ActionID)AdjustedID).GetCastTime();

/// <summary>
/// How many mp does this action needs.
/// </summary>
public readonly unsafe uint MPNeed
{
get
Expand All @@ -47,6 +90,9 @@ public readonly unsafe uint MPNeed
}
}

/// <summary>
/// Is thia action on the slot.
/// </summary>
public readonly bool IsOnSlot
{
get
Expand All @@ -64,12 +110,32 @@ public readonly bool IsOnSlot
return IsPvP == DataCenter.Territory?.IsPvpZone;
}
}

/// <summary>
/// Is this action is a lb action.
/// </summary>
public bool IsLimitBreak { get; }

/// <summary>
/// Is this action a general gcd.
/// </summary>
public bool IsGeneralGCD { get; }

/// <summary>
/// Is this action a real gcd.
/// </summary>
public bool IsRealGCD { get; }

/// <summary>
/// Is this action a duty action.
/// </summary>
public bool IsDutyAction { get; }
public Aspect Aspect { get; }

/// <summary>
/// The basic way to create a basic info
/// </summary>
/// <param name="action">the action</param>
/// <param name="isDutyAction">if it is a duty action.</param>
public ActionBasicInfo(IBaseAction action, bool isDutyAction)
{
_action = action;
Expand All @@ -81,7 +147,7 @@ public ActionBasicInfo(IBaseAction action, bool isDutyAction)
Aspect = (Aspect)_action.Action.Aspect;
}

internal readonly bool BasicCheck(bool skipStatusProvideCheck, bool skipCombo, bool ignoreCastingCheck)
internal readonly bool BasicCheck(bool skipStatusProvideCheck, bool skipComboCheck, bool skipCastingCheck)
{
if (!_action.Config.IsEnabled || !IsOnSlot) return false;

Expand Down Expand Up @@ -112,7 +178,7 @@ internal readonly bool BasicCheck(bool skipStatusProvideCheck, bool skipCombo, b
if (CustomRotation.LimitBreakLevel <= 1) return false;
}

if (!skipCombo && IsGeneralGCD)
if (!skipComboCheck && IsGeneralGCD)
{
if (!CheckForCombo()) return false;
}
Expand All @@ -134,7 +200,7 @@ internal readonly bool BasicCheck(bool skipStatusProvideCheck, bool skipCombo, b
//Is knocking back.
if (DateTime.Now > DataCenter.KnockbackStart && DateTime.Now < DataCenter.KnockbackFinished) return false;

if (DataCenter.NoPoslock && DataCenter.IsMoving && !ignoreCastingCheck) return false;
if (DataCenter.NoPoslock && DataCenter.IsMoving && !skipCastingCheck) return false;
}

if (IsGeneralGCD && _action.Setting.StatusProvide?.Length > 0 && _action.Setting.IsFriendly
Expand Down
31 changes: 30 additions & 1 deletion RotationSolver.Basic/Actions/ActionConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,48 @@
public class ActionConfig()
{
private bool _isEnable = true;

/// <summary>
/// If this action is enabled.
/// </summary>
public bool IsEnabled
{
get => IBaseAction.ForceEnable || _isEnable;
set => _isEnable = value;
}

/// <summary>
/// Should check the status for this action.
/// </summary>
public bool ShouldCheckStatus { get; set; } = true;

/// <summary>
/// The status count in gcd for adding the status.
/// </summary>
public byte StatusGcdCount { get; set; } = 2;

/// <summary>
/// The aoe count of this action.
/// </summary>
public byte AoeCount { get; set; } = 3;

/// <summary>
/// How many ttk should this action use.
/// </summary>
public float TimeToKill { get; set; } = 0;

public bool ShouldCheckStatus { get; set; } = true;
/// <summary>
/// The heal ratio for the auto heal.
/// </summary>
public float AutoHealRatio { get; set; } = 0.8f;

/// <summary>
/// Is this action in the cd window.
/// </summary>
public bool IsInCooldown { get; set; } = true;

/// <summary>
/// Is this action should be a mistake action.
/// </summary>
public bool IsInMistake { get; set; }
}
12 changes: 12 additions & 0 deletions RotationSolver.Basic/Actions/ActionCooldownInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
using FFXIVClientStructs.FFXIV.Client.Game;

namespace RotationSolver.Basic.Actions;

/// <summary>
/// The action cooldown information.
/// </summary>
public readonly struct ActionCooldownInfo : ICooldown
{
private readonly IBaseAction _action;

/// <summary>
/// The cd group.
/// </summary>
public byte CoolDownGroup { get; }

unsafe RecastDetail* CoolDownDetail => ActionIdHelper.GetCoolDownDetail(CoolDownGroup);
Expand Down Expand Up @@ -61,6 +69,10 @@ namespace RotationSolver.Basic.Actions;

float RecastTimeElapsedOneChargeRaw => RecastTimeElapsedRaw % RecastTimeOneChargeRaw;

/// <summary>
/// The default constructor.
/// </summary>
/// <param name="action">the action.</param>
public ActionCooldownInfo(IBaseAction action)
{
_action = action;
Expand Down
52 changes: 52 additions & 0 deletions RotationSolver.Basic/Actions/ActionSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,51 @@
/// </summary>
public class ActionSetting()
{
/// <summary>
/// The Ninjutsu action of this action.
/// </summary>
public IBaseAction[]? Ninjutsu { get; set; } = null;

/// <summary>
/// The override of the <see cref="ActionBasicInfo.MPNeed"/>.
/// </summary>
public Func<uint?>? MPOverride { get; set; } = null;

/// <summary>
/// Is this action in the melee range.
/// </summary>
public bool IsMeleeRange { get; set; } = false;

/// <summary>
/// Is this status is added by the plyer.
/// </summary>
public bool StatusFromSelf { get; set; } = true;

/// <summary>
/// The status that it provides to the target.
/// </summary>
public StatusID[]? TargetStatusProvide { get; set; } = null;

/// <summary>
/// The status that it needs on the target.
/// </summary>
public StatusID[]? TargetStatusNeed { get; set; } = null;

/// <summary>
/// Can the target be targeted.
/// </summary>
public Func<BattleChara, bool> CanTarget { get; set; } = t => true;

/// <summary>
/// The additional not combo ids.
/// </summary>
public ActionID[]? ComboIdsNot { get; set; }

/// <summary>
/// The additional combo ids.
/// </summary>
public ActionID[]? ComboIds { get; set; }

/// <summary>
/// Status that this action provides.
/// </summary>
Expand All @@ -25,14 +60,25 @@ public class ActionSetting()
/// </summary>
public StatusID[]? StatusNeed { get; set; } = null;

/// <summary>
/// Your custom rotation check for your rotation.
/// </summary>
public Func<bool>? RotationCheck { get; set; } = null;

internal Func<bool>? ActionCheck { get; set; } = null;

internal Func<ActionConfig>? CreateConfig { get; set; } = null;

/// <summary>
/// Is this action friendly.
/// </summary>
public bool IsFriendly { get; set; }

private TargetType _type = TargetType.Big;

/// <summary>
/// The strategy to target the target.
/// </summary>
public TargetType TargetType
{
get
Expand All @@ -56,8 +102,14 @@ public TargetType TargetType
set => _type = value;
}

/// <summary>
/// The enemy positional for this action.
/// </summary>
public EnemyPositional EnemyPositional { get; set; } = EnemyPositional.None;

/// <summary>
/// Should end the special.
/// </summary>
public bool EndSpecial { get; set; }

}
Loading

0 comments on commit 86264c0

Please sign in to comment.