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

Commit

Permalink
feat: add duty rotations.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jan 22, 2024
1 parent b7fb4ec commit 481749e
Show file tree
Hide file tree
Showing 27 changed files with 4,691 additions and 7,415 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,43 +45,10 @@ jobs:
run: |
invoke-expression 'dotnet build --no-restore --configuration Release RotationSolver'
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
path: .\RotationSolver\bin\Release\net7.0-windows\RotationSolver\

- name: publish on version change
id: publish_nuget
uses: alirezanet/publish-nuget@v3.0.4
with:
PROJECT_FILE_PATH: RotationSolver.Basic/RotationSolver.Basic.csproj
VERSION_FILE_PATH: Directory.Build.props
NUGET_KEY: ${{secrets.nuget_api_key}}

release:
name: release
needs: [release-please, build]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Download Build Artifact
uses: actions/download-artifact@v3

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release-please.outputs.upload_url }}
asset_path: artifact/latest.zip
asset_name: latest.zip
asset_content_type: application/zip

- name: Trigger Repo Update
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PAT }}
repository: ${{ github.repository_owner }}/Dalamud_Plugins
event-type: new-release
2 changes: 0 additions & 2 deletions RotationSolver.Basic/Actions/ActionBasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ public readonly bool IsOnSlot
public bool IsDutyAction { get; }
public Aspect Aspect { get; }



public ActionBasicInfo(IBaseAction action, bool isDutyAction)
{
_action = action;
Expand Down
1 change: 1 addition & 0 deletions RotationSolver.Basic/Actions/ActionConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ public bool IsEnable

public bool IsEnabled { get; set; }
public bool IsInCooldown { get; set; }
public bool IsInMistake { get; set; }
}
4 changes: 3 additions & 1 deletion RotationSolver.Basic/Actions/BaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public bool CanUse(out IAction act, bool skipStatusProvideCheck = false, bool sk

public unsafe bool Use()
{
ActionCate

if (!Target.HasValue) return false;

var target = Target.Value;
Expand All @@ -137,7 +139,7 @@ public unsafe bool Use()

public virtual IBaseAction Duplicate()
{
return = new BaseAction((ActionID)ID, Info.IsDutyAction)
return new BaseAction((ActionID)ID, Info.IsDutyAction)
{
Setting = Setting,
Config = Config
Expand Down
1 change: 1 addition & 0 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static MajorConditionSet RightSet
internal static Queue<(DateTime time, SortedList<uint, float> hpRatios)> RecordedHP { get; } = new(HP_RECORD_TIME + 1);

public static ICustomRotation? RightNowRotation { get; internal set; }
public static DutyRotation? RightNowDutyRotation { get; internal set; }

internal static bool NoPoslock => Svc.Condition[ConditionFlag.OccupiedInEvent]
|| !Service.Config.GetValue(PluginConfigBool.PoslockCasting)
Expand Down
7 changes: 7 additions & 0 deletions RotationSolver.Basic/Helpers/StatusHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ public static class StatusHelper
StatusID.Holmgang, StatusID.LivingDead, //StatusID.WalkingDead,
];
internal static StatusID[] SwiftcastStatus { get; } =
[
StatusID.Swiftcast,
StatusID.Triplecast,
StatusID.Dualcast,
];
internal record Burst2MinsInfo(StatusID Status, bool IsOnHostile, byte Level, params Job[] Jobs);
internal static Burst2MinsInfo[] Burst2Mins { get; } =
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/RotationSolver.Basic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<PrivateAssets>all</PrivateAssets>
</ProjectReference>

<ProjectReference Include="..\RotationSolver.SourceGenerators\RotationSolver.SourceGenerators.csproj" OutputItemType="Analyzer"/>
<ProjectReference Include="..\RotationSolver.SourceGenerators\RotationSolver.SourceGenerators.csproj" OutputItemType="Analyzer" />

<None Include="..\COPYING.LESSER">
<Pack>True</Pack>
Expand Down
41 changes: 23 additions & 18 deletions RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace RotationSolver.Basic.Rotations;

public abstract partial class CustomRotation
partial class CustomRotation
{
private bool Ability(IAction nextGCD, out IAction? act)
{
Expand Down Expand Up @@ -56,9 +56,9 @@ private bool Ability(IAction nextGCD, out IAction? act)
IBaseAction.AllEmpty = true;
if (HealAreaAbility(out act)) return true;
IBaseAction.AllEmpty = false;

}
if (DataCenter.AutoStatus.HasFlag(AutoStatus.HealAreaAbility))
if (DataCenter.AutoStatus.HasFlag(AutoStatus.HealAreaAbility)
&& CanHealAreaAbility)
{
IBaseAction.AutoHealCheck = true;
if (HealAreaAbility(out act)) return true;
Expand All @@ -70,7 +70,8 @@ private bool Ability(IAction nextGCD, out IAction? act)
if (HealSingleAbility(out act)) return true;
IBaseAction.AllEmpty = false;
}
if (DataCenter.AutoStatus.HasFlag(AutoStatus.HealSingleAbility))
if (DataCenter.AutoStatus.HasFlag(AutoStatus.HealSingleAbility)
&& CanHealSingleAbility)
{
IBaseAction.AutoHealCheck = true;
if (HealSingleAbility(out act)) return true;
Expand Down Expand Up @@ -138,7 +139,6 @@ private bool Ability(IAction nextGCD, out IAction? act)
if (SpeedAbility(out act)) return true;
}


return false;
}

Expand All @@ -163,6 +163,7 @@ private bool MyInterruptAbility(JobRole role, out IAction? act)

protected virtual bool InterruptAbility(out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.InterruptAbility(out act) ?? false) return true;
act = null; return false;
}

Expand All @@ -189,21 +190,16 @@ private bool AntiKnockback(JobRole role, out IAction? act)

protected virtual bool AntiKnockbackAbility(out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.AntiKnockbackAbility(out act) ?? false) return true;
act = null; return false;
}

protected virtual bool ProvokeAbility(out IAction? act)
{
if (VariantUltimatumPvE.CanUse(out act)) return true;

if (DataCenter.RightNowDutyRotation?.ProvokeAbility(out act) ?? false) return true;
act = null; return false;
}

private bool MovingAbility(out IAction? act)
{
act = null;
return false;
}

private bool GeneralUsingAbility(JobRole role, out IAction? act)
{
Expand Down Expand Up @@ -239,7 +235,7 @@ private bool GeneralUsingAbility(JobRole role, out IAction? act)
/// <param name="nextGCD">The next gcd action.</param>
/// <param name="act">Result action.</param>
/// <returns>Can we use it.</returns>
protected virtual bool EmergencyAbility(IAction nextGCD, out IAction act)
protected virtual bool EmergencyAbility(IAction nextGCD, out IAction? act)
{
if (nextGCD is BaseAction action)
{
Expand All @@ -256,6 +252,9 @@ protected virtual bool EmergencyAbility(IAction nextGCD, out IAction act)
}
}

if (DataCenter.RightNowDutyRotation?.EmergencyAbility(nextGCD, out act) ?? false) return true;


#region PvP
if (GuardPvP.CanUse(out act)
&& (Player.GetHealthRatio() <= Service.Config.GetValue(PluginConfigFloat.HealthForGuard)
Expand All @@ -273,6 +272,7 @@ protected virtual bool EmergencyAbility(IAction nextGCD, out IAction act)
[RotationDesc(DescType.MoveForwardAbility)]
protected virtual bool MoveForwardAbility(out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.MoveForwardAbility(out act) ?? false) return true;
act = null; return false;
}

Expand All @@ -284,6 +284,7 @@ protected virtual bool MoveForwardAbility(out IAction? act)
[RotationDesc(DescType.MoveBackAbility)]
protected virtual bool MoveBackAbility(out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.MoveBackAbility(out act) ?? false) return true;
act = null; return false;
}

Expand All @@ -296,6 +297,7 @@ protected virtual bool MoveBackAbility(out IAction? act)
protected virtual bool HealSingleAbility(out IAction? act)
{
if (RecuperatePvP.CanUse(out act)) return true;
if (DataCenter.RightNowDutyRotation?.HealSingleAbility(out act) ?? false) return true;
act = null; return false;
}

Expand All @@ -307,6 +309,7 @@ protected virtual bool HealSingleAbility(out IAction? act)
[RotationDesc(DescType.HealAreaAbility)]
protected virtual bool HealAreaAbility(out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.HealAreaAbility(out act) ?? false) return true;
act = null; return false;
}

Expand All @@ -318,6 +321,7 @@ protected virtual bool HealAreaAbility(out IAction? act)
[RotationDesc(DescType.DefenseSingleAbility)]
protected virtual bool DefenseSingleAbility(out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.DefenseSingleAbility(out act) ?? false) return true;
act = null; return false;
}

Expand All @@ -330,6 +334,7 @@ protected virtual bool DefenseSingleAbility(out IAction? act)
[RotationDesc(DescType.DefenseAreaAbility)]
protected virtual bool DefenseAreaAbility(out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.DefenseAreaAbility(out act) ?? false) return true;
act = null; return false;
}

Expand All @@ -347,6 +352,8 @@ protected virtual bool SpeedAbility(out IAction? act)

if (PelotonPvE.CanUse(out act, skipAoeCheck: true)) return true;
if (SprintPvE.CanUse(out act)) return true;

if (DataCenter.RightNowDutyRotation?.SpeedAbility(out act) ?? false) return true;
return false;
}

Expand All @@ -358,6 +365,7 @@ protected virtual bool SpeedAbility(out IAction? act)

protected virtual bool GeneralAbility(out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.GeneralAbility(out act) ?? false) return true;
act = null; return false;
}

Expand All @@ -368,10 +376,7 @@ protected virtual bool GeneralAbility(out IAction? act)
/// <returns>Can we use it.</returns>
protected virtual bool AttackAbility(out IAction? act)
{
if (VariantSpiritDartPvE.CanUse(out act, skipAoeCheck: true)) return true;
if (VariantSpiritDartPvE_33863.CanUse(out act, skipAoeCheck: true)) return true;
if (VariantRampartPvE.CanUse(out act)) return true;
if (VariantRampartPvE_33864.CanUse(out act)) return true;
return false;
if (DataCenter.RightNowDutyRotation?.AttackAbility(out act) ?? false) return true;
act = null; return false;
}
}
9 changes: 2 additions & 7 deletions RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace RotationSolver.Basic.Rotations;

public abstract partial class CustomRotation
partial class CustomRotation
{
private static void LoadActionConfigAndSetting(ref IBaseAction action)
{
Expand All @@ -20,12 +20,7 @@ static partial void ModifyAddlePvE(ref IBaseAction action)
static partial void ModifySwiftcastPvE(ref IBaseAction action)
{
action.Option = ActionOption.Buff;
action.StatusProvide =
[
StatusID.Swiftcast,
StatusID.Triplecast,
StatusID.Dualcast,
];
action.StatusProvide = StatusHelper.SwiftcastStatus;
}

static partial void ModifyEsunaPvE(ref IBaseAction action)
Expand Down
4 changes: 1 addition & 3 deletions RotationSolver.Basic/Rotations/CustomRotation_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

namespace RotationSolver.Basic.Rotations;

[RotationDesc(DescType.BurstActions)]
public abstract partial class CustomRotation : ICustomRotation
partial class CustomRotation : ICustomRotation
{
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public abstract CombatType Type { get; }

public abstract Job[] Jobs { get; }
Expand Down
Loading

0 comments on commit 481749e

Please sign in to comment.