diff --git a/RotationSolver/Actions/BaseAction/BaseAction_Target.cs b/RotationSolver/Actions/BaseAction/BaseAction_Target.cs index 6902319b6..4818fcd51 100644 --- a/RotationSolver/Actions/BaseAction/BaseAction_Target.cs +++ b/RotationSolver/Actions/BaseAction/BaseAction_Target.cs @@ -1,6 +1,7 @@ using Dalamud.Game.ClientState.Objects.SubKinds; using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Logging; +using FFXIVClientStructs.FFXIV.Client.Game; using RotationSolver.Commands; using RotationSolver.Data; using RotationSolver.Helpers; @@ -393,6 +394,8 @@ private int CanGetTargetCount(BattleChara target, IEnumerable canAt return count; } + const double _alpha = Math.PI / 3; + internal bool CanGetTarget(BattleChara target, BattleChara subTarget) { if (target == null) return false; @@ -412,13 +415,14 @@ internal bool CanGetTarget(BattleChara target, BattleChara subTarget) case 2: // 圆形范围攻击 return Vector3.Distance(target.Position, subTarget.Position) - subTarget.HitboxRadius <= _action.EffectRange; - case 3: // 扇形范围攻击 - double cos = Vector3.Dot(dir, tdir) / (dir.Length() * tdir.Length()); - return subTarget.DistanceToPlayer() <= _action.EffectRange && cos >= 0.5; + case 3: // Sector + if(subTarget.DistanceToPlayer() > _action.EffectRange) return false; + tdir += dir / dir.Length() * target.HitboxRadius / (float)Math.Sin(_alpha); + return Vector3.Dot(dir, tdir) / (dir.Length() * tdir.Length()) >= Math.Cos(_alpha); case 4: //直线范围攻击 - double distance = Vector3.Cross(dir, tdir).Length() / dir.Length(); - return subTarget.DistanceToPlayer() <= _action.EffectRange && distance <= 2; + if (subTarget.DistanceToPlayer() > _action.EffectRange) return false; + return Vector3.Cross(dir, tdir).Length() / dir.Length() <= 2 + target.HitboxRadius; } PluginLog.LogDebug(Name + "'s CastType is not valid! The value is " + _action.CastType.ToString()); diff --git a/RotationSolver/Rotations/CustomRotation/CustomRotation_Actions.cs b/RotationSolver/Rotations/CustomRotation/CustomRotation_Actions.cs index be6078fdf..3aaccd9f2 100644 --- a/RotationSolver/Rotations/CustomRotation/CustomRotation_Actions.cs +++ b/RotationSolver/Rotations/CustomRotation/CustomRotation_Actions.cs @@ -200,7 +200,8 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false, /// public static IBaseAction Peloton { get; } = new RoleAction(ActionID.Peloton, new JobRole[] { JobRole.RangedPhysical }, true) { - ActionCheck = b => !InCombat && TargetUpdater.PartyMembers.GetObjectInRadius(20).Any(p => !p.HasStatus(false, StatusID.Peloton)), + ActionCheck = b => !InCombat && TargetUpdater.PartyMembers.GetObjectInRadius(20).Any(p => + p.WillStatusEnd(2, false, StatusID.Peloton)), }; private protected virtual IBaseAction Raise => null; diff --git a/RotationSolver/Updaters/MajorUpdater.cs b/RotationSolver/Updaters/MajorUpdater.cs index 043c0f077..0bd75038a 100644 --- a/RotationSolver/Updaters/MajorUpdater.cs +++ b/RotationSolver/Updaters/MajorUpdater.cs @@ -43,8 +43,6 @@ private static void FrameworkUpdate(Framework framework) ActionUpdater.DoAction(); MacroUpdater.UpdateMacro(); - - ActionUpdater.UpdateActionInfo(); MovingUpdater.UpdateLocation(); } @@ -101,6 +99,7 @@ private static void CalculateFPS() private static void UpdateWork() { + ActionUpdater.UpdateActionInfo(); PreviewUpdater.UpdateCastBarState(); TargetUpdater.UpdateTarget();