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

Commit

Permalink
refactor!: replaced the base action.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jan 21, 2024
1 parent 5a83808 commit 15311ec
Show file tree
Hide file tree
Showing 17 changed files with 6,120 additions and 4,590 deletions.
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Actions/ActionBasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public struct ActionBasicInfo
(uint)ActionID.BlastChargePvP,
];

private readonly IBaseActionNew _action;
private readonly IBaseAction _action;
public readonly string Name => _action.Action.Name;
public readonly uint ID => _action.Action.RowId;
public readonly uint IconID => ID == (uint)ActionID.SprintPvE ? 104u : _action.Action.Icon;
Expand Down Expand Up @@ -52,7 +52,7 @@ public readonly bool IsOnSlot



public ActionBasicInfo(IBaseActionNew action, bool isDutyAction)
public ActionBasicInfo(IBaseAction action, bool isDutyAction)
{
_action = action;
IsGeneralGCD = _action.Action.IsGeneralGCD();
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Actions/ActionCooldownInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace RotationSolver.Basic.Actions;
public readonly struct ActionCooldownInfo
{
private readonly IBaseActionNew _action;
private readonly IBaseAction _action;
public byte CoolDownGroup { get; }

unsafe RecastDetail* CoolDownDetail => ActionManager.Instance()->GetRecastGroupDetail(CoolDownGroup - 1);
Expand Down Expand Up @@ -61,7 +61,7 @@ public readonly struct ActionCooldownInfo
float RecastTimeElapsedOneChargeRaw => RecastTimeElapsedRaw % RecastTimeOneChargeRaw;


public ActionCooldownInfo(IBaseActionNew action)
public ActionCooldownInfo(IBaseAction action)
{
_action = action;
CoolDownGroup = _action.Action.GetCoolDownGroup();
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver.Basic/Actions/ActionSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/// </summary>
public struct ActionSetting()
{
public bool TargetStatusFromSelf { get; set; } = true;
public StatusID[]? TargetStatus { get; set; } = null;
public Func<GameObject, bool> CanTarget { get; set; } = t => true;
internal ActionID[]? ComboIdsNot { get; set; }
Expand All @@ -23,5 +24,5 @@ public struct ActionSetting()
public Func<bool>? ActionCheck { get; set; } = null;

public bool IsFriendly { get; set; }
public TargetType Type { get; set; } = TargetType.Big;
public TargetType TargetType { get; set; } = TargetType.Big;
}
9 changes: 5 additions & 4 deletions RotationSolver.Basic/Actions/ActionTargetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace RotationSolver.Basic.Actions;

public struct ActionTargetInfo(IBaseActionNew _action)
public struct ActionTargetInfo(IBaseAction _action)
{
public readonly bool TargetArea => _action.Action.TargetArea;

Expand Down Expand Up @@ -101,7 +101,8 @@ private readonly bool CheckStatus(GameObject gameObject)
{
if (_action.Setting.TargetStatus == null || !_action.Config.ShouldCheckStatus) return true;

return gameObject.WillStatusEndGCD(_action.Config.StatusGcdCount, 0, true, _action.Setting.TargetStatus);
return gameObject.WillStatusEndGCD(_action.Config.StatusGcdCount, 0,
_action.Setting.TargetStatusFromSelf, _action.Setting.TargetStatus);
}

private readonly bool CheckResistance(GameObject gameObject)
Expand Down Expand Up @@ -156,7 +157,7 @@ private readonly bool CheckTimeToKill(GameObject gameObject)
}

var targets = GetMostCanTargetObjects(canTargets, canAffects, _action.Config.AoeCount);
var target = FindTargetByType(targets, _action.Setting.Type);
var target = FindTargetByType(targets, _action.Setting.TargetType);
if (target == null) return null;

return new(target, [.. GetAffects(target, canAffects)], target.Position);
Expand All @@ -165,7 +166,7 @@ private readonly bool CheckTimeToKill(GameObject gameObject)
private readonly TargetResult? FindTargetArea(IEnumerable<GameObject> canTargets, IEnumerable<GameObject> canAffects,
float range, PlayerCharacter player)
{
if (_action.Setting.Type is TargetType.Move)
if (_action.Setting.TargetType is TargetType.Move)
{
return FindTargetAreaMove(range);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Action = Lumina.Excel.GeneratedSheets.Action;

namespace RotationSolver.Basic.Actions;
public class BaseActionNew : IBaseActionNew
public class BaseAction : IBaseAction
{
public TargetResult? Target { get; private set; } = null;

Expand Down Expand Up @@ -70,21 +70,14 @@ public virtual unsafe uint MPNeed

public ActionConfig Config { get; set; }

public BaseActionNew(ActionID actionID, bool isDutyAction)
public BaseAction(ActionID actionID, bool isDutyAction)
{
Action = Service.GetSheet<Action>().GetRow((uint)actionID)!;
TargetInfo = new(this);
Info = new(this, isDutyAction);
Cooldown = new(this);

//TODO: better target type check.
//TODO: better friendly check.
Setting = new()
{
IsFriendly = Action.CanTargetFriendly,
};

//TODO: load the config from the
Setting = new();
Config = new();
}

Expand Down
242 changes: 0 additions & 242 deletions RotationSolver.Basic/Actions/BaseAction_ActionInfo.cs

This file was deleted.

Loading

0 comments on commit 15311ec

Please sign in to comment.