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

Commit

Permalink
fix: heal when nothing todo aoe fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 24, 2024
1 parent 1a2b060 commit b3c648a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
18 changes: 13 additions & 5 deletions RotationSolver.Basic/Actions/ActionTargetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ private static bool NoAOE
#region Target Finder.
//The delay of finding the targets.
private readonly ObjectListDelay<BattleChara> _canTargets = new (() => Service.Config.TargetDelay);
public readonly IEnumerable<BattleChara> GetCanTargets(bool skipStatusProvideCheck)
public readonly IEnumerable<BattleChara> GetCanTargets(bool skipStatusProvideCheck, TargetType type)
{
var items = TargetFilter.GetObjectInRadius(DataCenter.AllTargets, Range);
var objs = new List<BattleChara>(items.Count());

foreach (var obj in items)
{
if (type == TargetType.Heal && obj.GetHealthRatio() == 1) continue;

if (!GeneralCheck(obj, skipStatusProvideCheck)) continue;
objs.Add(obj);
}
Expand All @@ -56,14 +58,20 @@ public readonly IEnumerable<BattleChara> GetCanTargets(bool skipStatusProvideChe
return _canTargets;
}

public readonly IEnumerable<BattleChara> GetCanAffects(bool skipStatusProvideCheck)
public readonly IEnumerable<BattleChara> GetCanAffects(bool skipStatusProvideCheck, TargetType type)
{
if (EffectRange == 0) return [];

var items = TargetFilter.GetObjectInRadius(_action.Setting.IsFriendly
? DataCenter.PartyMembers
: DataCenter.AllHostileTargets,
Range + EffectRange);

if (type == TargetType.Heal)
{
items = items.Where(i => i.GetHealthRatio() < 1);
}

var objs = new List<BattleChara>(items.Count());

foreach (var obj in items)
Expand Down Expand Up @@ -198,9 +206,10 @@ private readonly bool CheckTimeToKill(GameObject gameObject)
{
return new(player, [], player.Position);
}
var type = _action.Setting.TargetType;

var canTargets = GetCanTargets(skipStatusProvideCheck);
var canAffects = GetCanAffects(skipStatusProvideCheck);
var canTargets = GetCanTargets(skipStatusProvideCheck, type);
var canAffects = GetCanAffects(skipStatusProvideCheck, type);

if (IsTargetArea)
{
Expand Down Expand Up @@ -232,7 +241,6 @@ private readonly bool CheckTimeToKill(GameObject gameObject)

var targets = GetMostCanTargetObjects(canTargets, canAffects,
skipAoeCheck ? 0 : _action.Config.AoeCount);
var type = _action.Setting.TargetType;
if (type == TargetType.BeAttacked && !_action.Setting.IsFriendly)
{
type = TargetType.Big;
Expand Down
8 changes: 7 additions & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_GCD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,14 @@ partial class CustomRotation

if (PartyMembersMinHP < Service.Config.HealWhenNothingTodoBelow)
{
if (DataCenter.PartyMembersDifferHP < Service.Config.HealthDifference && HealAreaGCD(out act)) return act;
IBaseAction.TargetOverride = TargetType.Heal;

if (DataCenter.PartyMembersDifferHP < Service.Config.HealthDifference
&& DataCenter.PartyMembersHP.Count(i => i < 1) > 2
&& HealAreaGCD(out act)) return act;
if (HealSingleGCD(out act)) return act;

IBaseAction.TargetOverride = null;
}
}
}
Expand Down

0 comments on commit b3c648a

Please sign in to comment.