Skip to content

Commit

Permalink
Merge pull request #45 from FFXIV-CombatReborn/manual-mode-rework
Browse files Browse the repository at this point in the history
Manual mode rework
  • Loading branch information
NostraThomas99 authored Apr 1, 2024
2 parents 367f158 + 3099283 commit a33337f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 47 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ jobs:
$tag = "${{ github.ref }}" -replace 'refs/tags/', ''
"tag=$tag" | Out-File -Append -FilePath $Env:GITHUB_ENV
if ($tag -match "-test$") {
$branch = "testing"
$tag = $tag -replace '-test$', ''
} else {
$branch = "latest"
}
"branch=$branch" | Out-File -Append -FilePath $Env:GITHUB_ENV
- name: Set up .NET
uses: actions/setup-dotnet@v1
Expand All @@ -53,9 +44,4 @@ jobs:
with:
files: ./build/RotationSolver.zip
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
make_latest: ${{ env.branch == 'latest' }}
prerelease: ${{ env.branch == 'testing' }}



44 changes: 11 additions & 33 deletions RotationSolver.Basic/Actions/ActionTargetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ public struct ActionTargetInfo(IBaseAction action)
/// </summary>
public readonly bool IsSingleTarget => action.Action.CastType == 1;
/// <summary>
/// Is this action target are.
/// Is this action target area.
/// </summary>

public readonly bool IsTargetArea => action.Action.TargetArea;

/// <summary>
/// Is this action friendly.
/// </summary>
public readonly bool IsTargetFriendly => action.Setting.IsFriendly;

private static bool NoAOE
{
get
Expand Down Expand Up @@ -66,6 +70,11 @@ private readonly IEnumerable<BattleChara> GetCanTargets(bool skipStatusProvideCh
objs.Add(obj);
}

if (DataCenter.IsManual && !IsTargetFriendly)
{
return objs.Where(CanUseTo).Where(InViewTarget).Where(action.Setting.CanTarget).Where(o => o.Address == Svc.Targets.Target.Address);

Check warning on line 75 in RotationSolver.Basic/Actions/ActionTargetInfo.cs

View workflow job for this annotation

GitHub Actions / Build

Dereference of a possibly null reference.
}

return objs.Where(CanUseTo).Where(InViewTarget).Where(action.Setting.CanTarget);
}

Expand Down Expand Up @@ -226,40 +235,9 @@ private readonly bool CheckTimeToKill(GameObject gameObject)
{
return FindTargetArea(canTargets, canAffects, range, player);
}
else if (DataCenter.IsManual)
{
var t = Svc.Targets.Target as BattleChara;

if (t == null || !action.Setting.CanTarget(t)) return null;

if (type == TargetType.Move)
{
return null;
}
else if (IsSingleTarget)
{
if (CanUseTo(t) && CheckStatus(t, skipStatusProvideCheck) && t.DistanceToPlayer() <= range)
{
return new(t, [.. GetAffects(t, canAffects)], t.Position);
}
}
else if (!NoAOE)
{
var effects = GetAffects(t, canAffects).ToArray();
if (effects.Length >= action.Config.AoeCount || skipAoeCheck)
{
return new(t, effects, t.Position);
}
}
return null;
}

var targets = GetMostCanTargetObjects(canTargets, canAffects,
skipAoeCheck ? 0 : action.Config.AoeCount);
if (type == TargetType.BeAttacked && !action.Setting.IsFriendly)
{
type = TargetType.Big;
}
var target = FindTargetByType(targets, type, action.Config.AutoHealRatio, action.Setting.SpecialType);
if (target == null) return null;

Expand Down

0 comments on commit a33337f

Please sign in to comment.