diff --git a/XIVSlothCombo/AutoRotation/AutoRotationController.cs b/XIVSlothCombo/AutoRotation/AutoRotationController.cs index b9e9fce68..bec5088e5 100644 --- a/XIVSlothCombo/AutoRotation/AutoRotationController.cs +++ b/XIVSlothCombo/AutoRotation/AutoRotationController.cs @@ -7,6 +7,7 @@ using ECommons.GameHelpers; using ECommons.Throttlers; using FFXIVClientStructs.FFXIV.Client.Game; +using Lumina.Excel.Sheets; using System; using System.Linq; using XIVSlothCombo.Combos; @@ -307,18 +308,36 @@ public static class AutoRotationHelper { if (rotationMode is DPSRotationMode dpsmode) { - IGameObject? target = dpsmode switch + if (Player.Object.GetRole() is CombatRole.Tank) { - DPSRotationMode.Manual => Svc.Targets.Target, - DPSRotationMode.Highest_Max => DPSTargeting.GetHighestMaxTarget(), - DPSRotationMode.Lowest_Max => DPSTargeting.GetLowestMaxTarget(), - DPSRotationMode.Highest_Current => DPSTargeting.GetHighestCurrentTarget(), - DPSRotationMode.Lowest_Current => DPSTargeting.GetLowestCurrentTarget(), - DPSRotationMode.Tank_Target => DPSTargeting.GetTankTarget(), - DPSRotationMode.Nearest => DPSTargeting.GetNearestTarget(), - DPSRotationMode.Furthest => DPSTargeting.GetFurthestTarget(), - }; - return target; + IGameObject? target = dpsmode switch + { + DPSRotationMode.Manual => Svc.Targets.Target, + DPSRotationMode.Highest_Max => TankTargeting.GetHighestMaxTarget(), + DPSRotationMode.Lowest_Max => TankTargeting.GetLowestMaxTarget(), + DPSRotationMode.Highest_Current => TankTargeting.GetHighestCurrentTarget(), + DPSRotationMode.Lowest_Current => TankTargeting.GetLowestCurrentTarget(), + DPSRotationMode.Tank_Target => Svc.Targets.Target, + DPSRotationMode.Nearest => DPSTargeting.GetNearestTarget(), + DPSRotationMode.Furthest => DPSTargeting.GetFurthestTarget(), + }; + return target; + } + else + { + IGameObject? target = dpsmode switch + { + DPSRotationMode.Manual => Svc.Targets.Target, + DPSRotationMode.Highest_Max => DPSTargeting.GetHighestMaxTarget(), + DPSRotationMode.Lowest_Max => DPSTargeting.GetLowestMaxTarget(), + DPSRotationMode.Highest_Current => DPSTargeting.GetHighestCurrentTarget(), + DPSRotationMode.Lowest_Current => DPSTargeting.GetLowestCurrentTarget(), + DPSRotationMode.Tank_Target => DPSTargeting.GetTankTarget(), + DPSRotationMode.Nearest => DPSTargeting.GetNearestTarget(), + DPSRotationMode.Furthest => DPSTargeting.GetFurthestTarget(), + }; + return target; + } } if (rotationMode is HealerRotationMode healermode) { @@ -466,11 +485,12 @@ public static uint InvokeCombo(CustomComboPreset preset, Presets.PresetAttribute public class DPSTargeting { - public static System.Collections.Generic.IEnumerable BaseSelection => Svc.Objects.Any(x => x is IBattleChara chara && x.IsHostile() && CustomComboFunctions.IsInRange(x) && !x.IsDead && CustomComboFunctions.IsInLineOfSight(x) && IsPriority(x)) ? Svc.Objects.Where(x => x is IBattleChara chara && x.IsHostile() && CustomComboFunctions.IsInRange(x) && !x.IsDead && x.IsTargetable && CustomComboFunctions.IsInLineOfSight(x) && IsPriority(x)) : - Svc.Objects.Where(x => x is IBattleChara chara && x.IsHostile() && CustomComboFunctions.IsInRange(x) && !x.IsDead && x.IsTargetable && CustomComboFunctions.IsInLineOfSight(x)); + public static System.Collections.Generic.IEnumerable BaseSelection => Svc.Objects.Any(x => x is IBattleChara chara && chara.IsHostile() && CustomComboFunctions.IsInRange(chara) && !chara.IsDead && CustomComboFunctions.IsInLineOfSight(chara) && IsPriority(chara)) ? Svc.Objects.Where(x => x is IBattleChara chara && chara.IsHostile() && CustomComboFunctions.IsInRange(chara) && !chara.IsDead && chara.IsTargetable && CustomComboFunctions.IsInLineOfSight(chara) && IsPriority(chara)) : + Svc.Objects.Where(x => x is IBattleChara chara && chara.IsHostile() && CustomComboFunctions.IsInRange(chara) && !chara.IsDead && chara.IsTargetable && CustomComboFunctions.IsInLineOfSight(chara)); private static bool IsPriority(IGameObject x) { + if (!x.IsTargetable() || !x.IsHostile()) return false; bool isFate = Service.Configuration.RotationConfig.DPSSettings.FATEPriority && x.Struct()->FateId != 0 && CustomComboFunctions.InFATE(); bool isQuest = Service.Configuration.RotationConfig.DPSSettings.QuestPriority && CustomComboFunctions.IsQuestMob(x); if (Player.Object.GetRole() is CombatRole.Tank && x.TargetObjectId != Player.Object.GameObjectId) @@ -577,7 +597,7 @@ public static class TankTargeting { public static IGameObject? GetLowestCurrentTarget() { - return Svc.Objects.Where(x => x is IBattleChara && x.IsHostile() && CustomComboFunctions.IsInRange(x) && !x.IsDead && x.IsTargetable) + return DPSTargeting.BaseSelection .OrderByDescending(x => x.TargetObject?.GameObjectId != Player.Object?.GameObjectId) .ThenBy(x => (x as IBattleChara).CurrentHp) .ThenBy(x => CustomComboFunctions.GetTargetHPPercent(x)).FirstOrDefault(); @@ -585,7 +605,7 @@ public static class TankTargeting public static IGameObject? GetHighestCurrentTarget() { - return Svc.Objects.Where(x => x is IBattleChara && x.IsHostile() && CustomComboFunctions.IsInRange(x) && !x.IsDead && x.IsTargetable) + return DPSTargeting.BaseSelection .OrderByDescending(x => x.TargetObject?.GameObjectId != Player.Object?.GameObjectId) .ThenByDescending(x => (x as IBattleChara).CurrentHp) .ThenBy(x => CustomComboFunctions.GetTargetHPPercent(x)).FirstOrDefault(); @@ -593,7 +613,7 @@ public static class TankTargeting public static IGameObject? GetLowestMaxTarget() { - return Svc.Objects.Where(x => x is IBattleChara && x.IsHostile() && CustomComboFunctions.IsInRange(x) && !x.IsDead && x.IsTargetable) + return DPSTargeting.BaseSelection .OrderByDescending(x => x.TargetObject?.GameObjectId != Player.Object?.GameObjectId) .OrderBy(x => (x as IBattleChara).MaxHp) .ThenBy(x => CustomComboFunctions.GetTargetHPPercent(x)).FirstOrDefault(); @@ -601,7 +621,7 @@ public static class TankTargeting public static IGameObject? GetHighestMaxTarget() { - return Svc.Objects.Where(x => x is IBattleChara && x.IsHostile() && CustomComboFunctions.IsInRange(x) && !x.IsDead && x.IsTargetable) + return DPSTargeting.BaseSelection .OrderByDescending(x => x.TargetObject?.GameObjectId != Player.Object?.GameObjectId) .ThenByDescending(x => (x as IBattleChara).MaxHp) .ThenBy(x => CustomComboFunctions.GetTargetHPPercent(x)).FirstOrDefault(); diff --git a/XIVSlothCombo/XIVSlothCombo.csproj b/XIVSlothCombo/XIVSlothCombo.csproj index b0457dba6..4add06116 100644 --- a/XIVSlothCombo/XIVSlothCombo.csproj +++ b/XIVSlothCombo/XIVSlothCombo.csproj @@ -4,7 +4,7 @@ Team Wrath - - 1.0.0.2 + 1.0.0.3 XIVCombo for lazy players Copyleft attick 2021 thanks attick UwU