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

Commit

Permalink
fix: add variant actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 7, 2023
1 parent 4b07392 commit 4780975
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
14 changes: 12 additions & 2 deletions RotationSolver.Basic/Data/ActionID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3566,12 +3566,17 @@ public enum ActionID : uint
/// <summary>
///
/// </summary>
VariantRaise = 29731,
VariantCure = 29729,

/// <summary>
///
/// </summary>
VariantCure = 29729,
VariantUltimatum = 29730,

/// <summary>
///
/// </summary>
VariantRaise = 29731,

/// <summary>
///
Expand All @@ -3582,5 +3587,10 @@ public enum ActionID : uint
///
/// </summary>
VariantRampart = 29733,

/// <summary>
///
/// </summary>
VariantRaise2 = 29734,
#endregion
}
10 changes: 8 additions & 2 deletions RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ private bool AutoDefense(JobRole role, bool helpDefenseAOE, bool helpDefenseSing
{
if (!HasTankStance && TankStance.CanUse(out act)) return true;
if (Provoke.CanUse(out act, CanUseOption.MustUse)) return true;
if (VariantUltimatum.CanUse(out act, CanUseOption.MustUse)) return true;
}

//No using defense abilities.
Expand Down Expand Up @@ -388,9 +389,14 @@ protected virtual bool GeneralAbility(out IAction act)
}

/// <summary>
/// The ability that attackes some enemy.
/// The ability that attacks some enemy.
/// </summary>
/// <param name="act">Result action.</param>
/// <returns>Can we use it.</returns>
protected abstract bool AttackAbility(out IAction act);
protected virtual bool AttackAbility(out IAction act)
{
if (VariantSpiritDart.CanUse(out act)) return true;
if (VariantRampart.CanUse(out act)) return true;
return false;
}
}
5 changes: 5 additions & 0 deletions RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac
public static IBaseAction VariantRaise { get; } = new RoleAction(ActionID.VariantRaise,
new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Friendly | ActionOption.DutyAction);

/// <summary>
///
/// </summary>
public static IBaseAction VariantUltimatum { get; } = new BaseAction(ActionID.VariantUltimatum, ActionOption.DutyAction);

/// <summary>
///
/// </summary>
Expand Down
23 changes: 14 additions & 9 deletions RotationSolver.Basic/Rotations/CustomRotation_GCD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,32 +59,28 @@ private IAction GCD(bool helpDefenseAOE, bool helpDefenseSingle)
private bool RaiseSpell(SpecialCommandType specialType, out IAction act, bool mustUse)
{
act = null;
if (Raise == null || Player.CurrentMp <= Service.Config.LessMPNoRaise)
{
return DataCenter.SetAutoStatus(AutoStatus.Raise, false);
}

if (specialType == SpecialCommandType.RaiseShirk && DataCenter.DeathPeopleAll.Any())
{
if (Raise.CanUse(out act)) return true;
if (RaiseAction(out act)) return true;
}

if ((Service.Config.RaiseAll ? DataCenter.DeathPeopleAll.Any() : DataCenter.DeathPeopleParty.Any())
&& Raise.CanUse(out act, CanUseOption.IgnoreCastCheck))
&& RaiseAction(out act, CanUseOption.IgnoreCastCheck))
{
if (HasSwift)
{
return DataCenter.SetAutoStatus(AutoStatus.Raise, true);
}
else if (mustUse)
{
var action = act;
if(Swiftcast.CanUse(out act))
{
return DataCenter.SetAutoStatus(AutoStatus.Raise, true);
}
else if(!IsMoving)
{
act = Raise;
act = action;
return DataCenter.SetAutoStatus(AutoStatus.Raise, true);
}
}
Expand All @@ -97,6 +93,14 @@ private bool RaiseSpell(SpecialCommandType specialType, out IAction act, bool mu
return DataCenter.SetAutoStatus(AutoStatus.Raise, false);
}

private bool RaiseAction(out IAction act, CanUseOption option = CanUseOption.None)
{
if (VariantRaise.CanUse(out act, option)) return true;
if (Player.CurrentMp > Service.Config.LessMPNoRaise && (Raise?.CanUse(out act, option) ?? false)) return true;

return false;
}

/// <summary>
/// The emergency gcd with highest priority.
/// </summary>
Expand Down Expand Up @@ -126,7 +130,8 @@ protected virtual bool MoveForwardGCD(out IAction act)
[RotationDesc(DescType.HealSingleGCD)]
protected virtual bool HealSingleGCD(out IAction act)
{
act = null; return false;
if (VariantCure.CanUse(out act)) return true;
return false;
}

/// <summary>
Expand Down

0 comments on commit 4780975

Please sign in to comment.