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

Commit

Permalink
fix: changed for hostiles targeting.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jan 26, 2023
1 parent 8507513 commit 315f1e8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
29 changes: 18 additions & 11 deletions RotationSolver/Actions/BaseAction/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private bool TargetHostile(float range, bool mustUse, int aoeCount, out BattleCh
}

//判断一下AOE攻击的时候如果有攻击目标标记目标
if (_action.CastType > 1 && (NoAOEForAttackMark || Service.Configuration.AbsSingleTarget))
if (_action.CastType > 1 && NoAOEForAttackMark)
{
target = null;
return false;
Expand Down Expand Up @@ -301,11 +301,6 @@ private bool TargetHostileManual(BattleChara b, bool mustUse, int aoeCount, out

return true;
}
else if (Service.Configuration.AbsSingleTarget)
{
target = null;
return false;
}

if (Service.Configuration.UseAOEWhenManual || mustUse)
{
Expand All @@ -324,7 +319,7 @@ private bool TargetSelf(bool mustUse, int aoeCount)
{
if (_action.EffectRange > 0 && !_isFriendly)
{
if (NoAOEForAttackMark || Service.Configuration.AbsSingleTarget)
if (NoAOEForAttackMark)
{
return false;
}
Expand All @@ -334,9 +329,7 @@ private bool TargetSelf(bool mustUse, int aoeCount)
{
if (!Service.Configuration.UseAOEWhenManual && !mustUse) return false;
}
var count = TargetFilter.GetObjectInRadius(TargetFilterFuncEot(TargetUpdater.HostileTargets, mustUse), _action.EffectRange).Count();

if (count < aoeCount) return false;
return GetMostObjects(TargetFilterFuncEot(TargetUpdater.HostileTargets, mustUse), aoeCount).Any();
}
return true;
}
Expand Down Expand Up @@ -375,7 +368,21 @@ private IEnumerable<BattleChara> GetMostObjects(IEnumerable<BattleChara> targets
}

private int CanGetTargetCount(BattleChara target, IEnumerable<BattleChara> canAttack)
=> canAttack.Count(g => CanGetTarget(target, g));
{
int count = 0;
foreach (var t in canAttack)
{
if(CanGetTarget(target, t))
{
count++;
if (Service.Configuration.NoNewHostiles && t.TargetObject == null)
{
return 0;
}
}
}
return count;
}

internal bool CanGetTarget(BattleChara target, BattleChara subTarget)
{
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class PluginConfiguration : IPluginConfiguration
public bool KeyBoardNoise = true;
public bool UseGroundBeneficialAbility = true;
public bool StartOnCountdown = true;
public bool AbsSingleTarget = false;
public bool NoNewHostiles = false;
public bool UseHealWhenNotAHealer = true;
public float ObjectMinRadius = 0f;
public float HealthDifference = 0.25f;
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ internal class Strings
public string Configwindow_Param_UseAOEWhenManual { get; set; } = "Use AOE actions in manual mode";
public string Configwindow_Param_AutoBreak { get; set; } = "Automatic breaking";
public string Configwindow_Param_UseAbility { get; set; } = "Auto-use abilities";
public string Configwindow_Param_AbsSingleTarget { get; set; } = "Safe mode (absolutely single target)";
public string Configwindow_Params_AbsSingleTargetDesc { get; set; } = "Nerver use any AOE action with single target./nBut if the number of hostile enough, AOE action will still be used.";
public string Configwindow_Param_NoNewHostiles { get; set; } = "Don't target new mobs";
public string Configwindow_Params_NoNewHostilesDesc { get; set; } = "Nerver use any AOE action when this action may attack the mobs that not is a hostile target.";
public string Configwindow_Param_UseDefenceAbility { get; set; } = "Use defence abilities";
public string Configwindow_Param_UseDefenceAbilityDesc { get; set; } = "It is recommended to check this option if you are playing Raids./nPlan the heal and defense by yourself.???";
public string Configwindow_Param_AutoShield { get; set; } = "Auto tank stance";
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver/Windows/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ private void DrawParamAction()
DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_UseAOEWhenManual,
ref Service.Configuration.UseAOEWhenManual);

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_AbsSingleTarget,
ref Service.Configuration.AbsSingleTarget,
LocalizationManager.RightLang.Configwindow_Params_AbsSingleTargetDesc);
DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_NoNewHostiles,
ref Service.Configuration.NoNewHostiles,
LocalizationManager.RightLang.Configwindow_Params_NoNewHostilesDesc);

ImGui.Separator();

Expand Down

0 comments on commit 315f1e8

Please sign in to comment.