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

Commit

Permalink
refactor: rewrite all base rotations.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jan 20, 2024
1 parent 143419f commit 2234d74
Show file tree
Hide file tree
Showing 46 changed files with 34,235 additions and 13,016 deletions.
2 changes: 1 addition & 1 deletion DefaultRotations/Healer/AST_Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace DefaultRotations.Healer;

[RotationDesc(ActionID.Divination)]
[SourceCode(Path = "main/DefaultRotations/Healer/AST_Default.cs")]
public sealed class AST_Default : AST_Base
public sealed class AST_Default : AstrologianRotation
{
public override CombatType Type => CombatType.PvE;

Expand Down
9 changes: 9 additions & 0 deletions RotationSolver.Basic/Actions/ActionFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace RotationSolver.Basic.Actions;

/// <summary>
/// For some actions that may be used among different jobs.
/// </summary>
partial class ActionFactory
{
}

12 changes: 6 additions & 6 deletions RotationSolver.Basic/Actions/BaseAction_ActionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public partial class BaseAction
internal static readonly uint[] ActionsNoNeedCasting =
[
5,
(uint)ActionID.PowerfulShot,
(uint)ActionID.BlastCharge,
(uint)ActionID.PowerfulShot_PvP,
(uint)ActionID.BlastCharge_PvP,
];
/// <summary>
/// The user set heal ratio.
Expand All @@ -35,25 +35,25 @@ public float AutoHealRatio
/// <summary>
/// The effect range of the action.
/// </summary>
public float EffectRange => (ActionID)ID == ActionID.LiturgyOfTheBell ? 20 : _action?.EffectRange ?? 0;
public float EffectRange => (ActionID)ID == ActionID.LiturgyOfTheBell_PvE ? 20 : _action?.EffectRange ?? 0;
internal ActionID[] ComboIdsNot { private get; init; } = null;

internal ActionID[] ComboIds { private get; init; } = null;

/// <summary>
/// Status that this action provides.
/// </summary>
public StatusID[] StatusProvide { get; init; } = null;
public StatusID[] StatusProvide { get; set; } = null;

/// <summary>
/// Status that this action needs.
/// </summary>
public virtual StatusID[] StatusNeed { get; init; } = null;
public virtual StatusID[] StatusNeed { get; set; } = null;

/// <summary>
/// Some check that this action needs.
/// </summary>
public Func<BattleChara, bool, bool> ActionCheck { get; init; } = null;
public Func<BattleChara, bool, bool> ActionCheck { get; set; } = null;

private bool WillCooldown
{
Expand Down
38 changes: 24 additions & 14 deletions RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,27 @@ public partial class BaseAction : IBaseAction
/// </summary>
protected readonly Action _action;

readonly ActionOption _option;
ActionOption _option;

/// <summary>
///
/// </summary>
public ActionOption Option
{
get => _option;
set
{
value &= ~(ActionOption.GeneralGCD | ActionOption.RealGCD);
if (_action.IsGeneralGCD()) value |= ActionOption.GeneralGCD;
if (_action.IsRealGCD()) value |= ActionOption.RealGCD;
_option = value;
}
}

/// <summary>
/// Is a heal action.
/// </summary>
public bool IsHeal => _option.HasFlag(ActionOption.HealFlag);
public bool IsHeal => Option.HasFlag(ActionOption.HealFlag);

/// <summary>
/// Is a friendly action.
Expand All @@ -33,32 +48,32 @@ public bool IsFriendly
{
if (_action.CanTargetFriendly) return true;
if (_action.CanTargetHostile) return false;
return _option.HasFlag(ActionOption.Friendly);
return Option.HasFlag(ActionOption.Friendly);
}
}

/// <summary>
/// Is effect of time.
/// </summary>
public bool IsEot => _option.HasFlag(ActionOption.Eot);
public bool IsEot => Option.HasFlag(ActionOption.Eot);

/// <summary>
/// Should end special window after used it.
/// </summary>
public bool ShouldEndSpecial => _option.HasFlag(ActionOption.EndSpecial);
public bool ShouldEndSpecial => Option.HasFlag(ActionOption.EndSpecial);

/// <summary>
/// Has a normal gcd action.
/// </summary>
public bool IsGeneralGCD => _option.HasFlag(ActionOption.GeneralGCD);
public bool IsGeneralGCD => Option.HasFlag(ActionOption.GeneralGCD);

/// <summary>
/// Is a real gcd action, that makes gcd work.
/// </summary>
public bool IsRealGCD => _option.HasFlag(ActionOption.RealGCD);
public bool IsRealGCD => Option.HasFlag(ActionOption.RealGCD);

/// <inheritdoc/>
public bool IsDutyAction => _option.HasFlag(ActionOption.DutyAction);
public bool IsDutyAction => Option.HasFlag(ActionOption.DutyAction);

/// <summary>
/// Is a pvp action.
Expand Down Expand Up @@ -238,12 +253,7 @@ public virtual unsafe uint MPNeed
public BaseAction(ActionID actionID, ActionOption option = ActionOption.None)
{
_action = Service.GetSheet<Action>().GetRow((uint)actionID);

option &= ~(ActionOption.GeneralGCD | ActionOption.RealGCD);
if (_action.IsGeneralGCD()) option |= ActionOption.GeneralGCD;
if (_action.IsRealGCD()) option |= ActionOption.RealGCD;
_option = option;

Option = option;
CoolDownGroup = _action.GetCoolDownGroup();
}

Expand Down
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Func<IEnumerable<BattleChara>, bool, BattleChara> ChoiceTarget
if (_choiceTarget != null) return _choiceTarget;
return IsFriendly ? TargetFilter.DefaultChooseFriend : TargetFilter.DefaultFindHostile;
}
init => _choiceTarget = value;
set => _choiceTarget = value;
}

/// <summary>
Expand All @@ -89,7 +89,7 @@ public Func<IEnumerable<BattleChara>, bool, BattleChara> ChoiceTarget
/// <summary>
/// What status this action could put to the target.
/// </summary>
public StatusID[] TargetStatus { get; init; } = null;
public StatusID[] TargetStatus { get; set; } = null;

internal static bool TankDefenseSelf(BattleChara _, bool mustUse)
{
Expand Down
14 changes: 9 additions & 5 deletions RotationSolver.Basic/Actions/IBaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
/// </summary>
public interface IBaseAction : IAction
{
/// <summary>
///
/// </summary>
ActionOption Option { get; set; }
/// <summary>
/// Is in the mistake actions.
/// </summary>
Expand Down Expand Up @@ -52,23 +56,23 @@ public interface IBaseAction : IAction
/// <summary>
/// If player has these statuses from player self, this action will not used.
/// </summary>
StatusID[] StatusProvide { get; }
StatusID[] StatusProvide { get; set; }

/// <summary>
/// If player doesn't have these statuses from player self, this action will not used.
/// </summary>
StatusID[] StatusNeed { get; }
StatusID[] StatusNeed { get; set; }

/// <summary>
/// Check for this action, but not for the rotation. It is some additional conditions for this action.
/// Input data is the target for this action.
/// </summary>
Func<BattleChara, bool, bool> ActionCheck { get; }
Func<BattleChara, bool, bool> ActionCheck { get; set; }

/// <summary>
/// The way to choice the target.
/// </summary>
Func<IEnumerable<BattleChara>, bool, BattleChara> ChoiceTarget { get; }
Func<IEnumerable<BattleChara>, bool, BattleChara> ChoiceTarget { get; set; }

/// <summary>
/// Is a GCD action.
Expand Down Expand Up @@ -177,7 +181,7 @@ public interface IBaseAction : IAction
/// <summary>
/// If target has these statuses from player self, this aciton will not used.
/// </summary>
StatusID[] TargetStatus { get; }
StatusID[] TargetStatus { get; set; }

/// <summary>
/// Action using position.
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public static void SetSpecialType(SpecialCommandType specialType)

public static bool CanProvoke { get; set; } = false;

public static uint[] TreasureCharas { get; internal set; } = Array.Empty<uint>();
public static uint[] TreasureCharas { get; internal set; } = [];
public static bool HasHostilesInRange => NumberOfHostilesInRange > 0;
public static bool HasHostilesInMaxRange => NumberOfHostilesInMaxRange > 0;
public static int NumberOfHostilesInRange { get; internal set; }
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Helpers/StatusHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal record Burst2MinsInfo(StatusID Status, bool IsOnHostile, byte Level, pa

internal static Burst2MinsInfo[] Burst2Mins { get; } =
[
new (StatusID.Divination, false, AST_Base.Divination.Level, Job.AST),
new (StatusID.Divination, false, AstrologianRotation.Divination.Level, Job.AST),
new (StatusID.ChainStratagem, true, SCH_Base.ChainStratagem.Level, Job.SCH),
new (StatusID.Brotherhood, false, MNK_Base.Brotherhood.Level, Job.MNK),
new (StatusID.BattleLitany, false, DRG_Base.BattleLitany.Level, Job.DRG),
Expand Down
Loading

0 comments on commit 2234d74

Please sign in to comment.