From baad8e5d1aabc292f40fa4e94b55b33494ef497b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com>
Date: Thu, 21 Mar 2024 08:52:56 +0800
Subject: [PATCH] fix: moving forward actions' target.
---
Resources/AnimationLockTime.json | 4 +++
Resources/RotationSolverRecord.json | 4 +--
RotationSolver.Basic/Actions/ActionSetting.cs | 9 +++++-
.../Actions/ActionTargetInfo.cs | 32 +++++++++++--------
RotationSolver.Basic/Actions/BaseAction.cs | 4 ++-
.../Rotations/Basic/DarkKnightRotation.cs | 7 +++-
.../Rotations/Basic/DragoonRotation.cs | 2 +-
.../Rotations/Basic/GunbreakerRotation.cs | 7 +++-
.../Rotations/Basic/MonkRotation.cs | 5 +++
.../Rotations/Basic/NinjaRotation.cs | 7 +++-
.../Rotations/Basic/PaladinRotation.cs | 6 +++-
.../Rotations/Basic/ReaperRotation.cs | 7 +++-
.../Rotations/Basic/RedMageRotation.cs | 5 +++
.../Rotations/Basic/SageRotation.cs | 5 +++
.../Rotations/Basic/SamuraiRotation.cs | 3 +-
.../Rotations/Basic/WarriorRotation.cs | 11 +++++--
16 files changed, 92 insertions(+), 26 deletions(-)
diff --git a/Resources/AnimationLockTime.json b/Resources/AnimationLockTime.json
index 22daa0599..8026bc665 100644
--- a/Resources/AnimationLockTime.json
+++ b/Resources/AnimationLockTime.json
@@ -237,7 +237,10 @@
"7489": 0.1,
"7490": 0.6,
"7491": 0.6,
+ "7492": 0.6,
"7495": 0.6,
+ "7496": 0.6,
+ "7498": 0.6,
"7499": 0.6,
"7503": 0.1,
"7505": 0.6,
@@ -558,6 +561,7 @@
"25773": 0.6,
"25774": 0.6,
"25778": 0.6,
+ "25779": 0.6,
"25780": 0.6,
"25784": 0.6,
"25785": 0.6,
diff --git a/Resources/RotationSolverRecord.json b/Resources/RotationSolverRecord.json
index 78dc09151..890190ec2 100644
--- a/Resources/RotationSolverRecord.json
+++ b/Resources/RotationSolverRecord.json
@@ -1,5 +1,5 @@
{
- "ClickingCount": 105963,
- "SayingHelloCount": 175,
+ "ClickingCount": 107756,
+ "SayingHelloCount": 176,
"SaidUsers": []
}
\ No newline at end of file
diff --git a/RotationSolver.Basic/Actions/ActionSetting.cs b/RotationSolver.Basic/Actions/ActionSetting.cs
index d91e15d9b..0e14d129b 100644
--- a/RotationSolver.Basic/Actions/ActionSetting.cs
+++ b/RotationSolver.Basic/Actions/ActionSetting.cs
@@ -1,5 +1,12 @@
namespace RotationSolver.Basic.Actions;
+internal enum SpecialActionType : byte
+{
+ None,
+ MeleeRange,
+ MovingForward,
+}
+
///
/// Setting from the developer.
///
@@ -18,7 +25,7 @@ public class ActionSetting()
///
/// Is this action in the melee range.
///
- public bool IsMeleeRange { get; set; } = false;
+ internal SpecialActionType SpecialType { get; set; }
///
/// Is this status is added by the plyer.
diff --git a/RotationSolver.Basic/Actions/ActionTargetInfo.cs b/RotationSolver.Basic/Actions/ActionTargetInfo.cs
index 1f6773373..b52cf2057 100644
--- a/RotationSolver.Basic/Actions/ActionTargetInfo.cs
+++ b/RotationSolver.Basic/Actions/ActionTargetInfo.cs
@@ -260,7 +260,7 @@ private readonly bool CheckTimeToKill(GameObject gameObject)
{
type = TargetType.Big;
}
- var target = FindTargetByType(targets, type, action.Config.AutoHealRatio, action.Setting.IsMeleeRange);
+ var target = FindTargetByType(targets, type, action.Config.AutoHealRatio, action.Setting.SpecialType);
if (target == null) return null;
return new(target, [.. GetAffects(target, canAffects)], target.Position);
@@ -322,7 +322,7 @@ private readonly bool CheckTimeToKill(GameObject gameObject)
{
var availableCharas = DataCenter.AllTargets.Where(b => b.ObjectId != Player.Object.ObjectId);
var target = FindTargetByType(TargetFilter.GetObjectInRadius(availableCharas, range),
- TargetType.Move, action.Config.AutoHealRatio, action.Setting.IsMeleeRange);
+ TargetType.Move, action.Config.AutoHealRatio, action.Setting.SpecialType);
if (target == null) return null;
return new(target, [], target.Position);
}
@@ -384,7 +384,7 @@ private readonly bool CheckTimeToKill(GameObject gameObject)
{
var effectRange = EffectRange;
var attackT = FindTargetByType(DataCenter.AllianceMembers.GetObjectInRadius(range + effectRange),
- TargetType.BeAttacked, action.Config.AutoHealRatio, action.Setting.IsMeleeRange);
+ TargetType.BeAttacked, action.Config.AutoHealRatio, action.Setting.SpecialType);
if (attackT == null)
{
@@ -512,13 +512,26 @@ private readonly bool CanGetTarget(GameObject target, GameObject subTarget)
#endregion
#region TargetFind
- private static BattleChara? FindTargetByType(IEnumerable gameObjects, TargetType type, float healRatio, bool isMeleeRange)
+ private static BattleChara? FindTargetByType(IEnumerable gameObjects, TargetType type, float healRatio, SpecialActionType actionType)
{
if (type == TargetType.Self) return Player.Object;
- if (isMeleeRange)
+ switch (actionType)
{
- gameObjects = gameObjects.Where(t => t.DistanceToPlayer() >= 3 + Service.Config.MeleeRangeOffset);
+ case SpecialActionType.MeleeRange:
+ gameObjects = gameObjects.Where(t => t.DistanceToPlayer() >= 3 + Service.Config.MeleeRangeOffset);
+ break;
+
+ case SpecialActionType.MovingForward:
+ if (DataCenter.MergedStatus.HasFlag(AutoStatus.MoveForward))
+ {
+ type = TargetType.Move;
+ }
+ else
+ {
+ gameObjects = gameObjects.Where(t => t.DistanceToPlayer() < 1);
+ }
+ break;
}
switch (type) // Filter the objects.
@@ -568,13 +581,6 @@ private readonly bool CanGetTarget(GameObject target, GameObject subTarget)
BattleChara? FindTargetForMoving()
{
- //if (!IBaseAction.ActionPreview && !DataCenter.MergedStatus.HasFlag(AutoStatus.MoveForward))
- //{
- // var o = gameObjects.MinBy(b => b.DistanceToPlayer());
- // if (o.DistanceToPlayer() < 1) return o;
- // return null;
- //}
-
const float DISTANCE_TO_MOVE = 3;
if (Service.Config.MoveTowardsScreenCenter)
diff --git a/RotationSolver.Basic/Actions/BaseAction.cs b/RotationSolver.Basic/Actions/BaseAction.cs
index 785020880..75d3f8e62 100644
--- a/RotationSolver.Basic/Actions/BaseAction.cs
+++ b/RotationSolver.Basic/Actions/BaseAction.cs
@@ -142,7 +142,9 @@ public bool CanUse(out IAction act, bool skipStatusProvideCheck = false, bool sk
if (!Cooldown.CooldownCheck(usedUp, onLastAbility, skipClippingCheck, gcdCountForAbility)) return false;
- if (Setting.IsMeleeRange && IActionHelper.IsLastAction(IActionHelper.MovingActions)) return false; //No range actions after moving.
+ if (Setting.SpecialType is SpecialActionType.MeleeRange
+ && IActionHelper.IsLastAction(IActionHelper.MovingActions)) return false; //No range actions after moving.
+
if (DataCenter.AverageTimeToKill < Config.TimeToKill) return false;
if (DataCenter.TimeToUntargetable < Config.TimeToUntargetable) return false;
diff --git a/RotationSolver.Basic/Rotations/Basic/DarkKnightRotation.cs b/RotationSolver.Basic/Rotations/Basic/DarkKnightRotation.cs
index e23132f6b..53d6f4361 100644
--- a/RotationSolver.Basic/Rotations/Basic/DarkKnightRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/DarkKnightRotation.cs
@@ -73,7 +73,7 @@ static partial void ModifyBloodspillerPvE(ref ActionSetting setting)
static partial void ModifyUnmendPvE(ref ActionSetting setting)
{
- setting.IsMeleeRange = true;
+ setting.SpecialType = SpecialActionType.MeleeRange;
}
static partial void ModifyLivingShadowPvE(ref ActionSetting setting)
@@ -147,6 +147,11 @@ static partial void ModifyUnleashPvE(ref ActionSetting setting)
};
}
+ static partial void ModifyPlungePvE(ref ActionSetting setting)
+ {
+ setting.SpecialType = SpecialActionType.MovingForward;
+ }
+
///
protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
{
diff --git a/RotationSolver.Basic/Rotations/Basic/DragoonRotation.cs b/RotationSolver.Basic/Rotations/Basic/DragoonRotation.cs
index 6ce6c833f..aefb13465 100644
--- a/RotationSolver.Basic/Rotations/Basic/DragoonRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/DragoonRotation.cs
@@ -63,7 +63,7 @@ static partial void ModifyWheelingThrustPvE(ref ActionSetting setting)
static partial void ModifyPiercingTalonPvE(ref ActionSetting setting)
{
- setting.IsMeleeRange = true;
+ setting.SpecialType = SpecialActionType.MeleeRange;
}
static partial void ModifyJumpPvE(ref ActionSetting setting)
diff --git a/RotationSolver.Basic/Rotations/Basic/GunbreakerRotation.cs b/RotationSolver.Basic/Rotations/Basic/GunbreakerRotation.cs
index c9917dee6..ef7374f04 100644
--- a/RotationSolver.Basic/Rotations/Basic/GunbreakerRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/GunbreakerRotation.cs
@@ -75,7 +75,7 @@ static partial void ModifyHypervelocityPvE(ref ActionSetting setting)
static partial void ModifyLightningShotPvE(ref ActionSetting setting)
{
- setting.IsMeleeRange = true;
+ setting.SpecialType = SpecialActionType.MeleeRange;
}
static partial void ModifyFatedCirclePvE(ref ActionSetting setting)
@@ -135,6 +135,11 @@ static partial void ModifyDemonSlaughterPvE(ref ActionSetting setting)
};
}
+ static partial void ModifyRoughDividePvE(ref ActionSetting setting)
+ {
+ setting.SpecialType = SpecialActionType.MovingForward;
+ }
+
///
protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
{
diff --git a/RotationSolver.Basic/Rotations/Basic/MonkRotation.cs b/RotationSolver.Basic/Rotations/Basic/MonkRotation.cs
index 13fcd6495..ea76aefc5 100644
--- a/RotationSolver.Basic/Rotations/Basic/MonkRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/MonkRotation.cs
@@ -98,6 +98,11 @@ static partial void ModifyRiddleOfFirePvE(ref ActionSetting setting)
};
}
+ static partial void ModifyThunderclapPvE(ref ActionSetting setting)
+ {
+ setting.SpecialType = SpecialActionType.MovingForward;
+ }
+
///
[RotationDesc(ActionID.ThunderclapPvE)]
protected sealed override bool MoveForwardAbility(out IAction? act)
diff --git a/RotationSolver.Basic/Rotations/Basic/NinjaRotation.cs b/RotationSolver.Basic/Rotations/Basic/NinjaRotation.cs
index 306b17c8c..6297198d3 100644
--- a/RotationSolver.Basic/Rotations/Basic/NinjaRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/NinjaRotation.cs
@@ -52,7 +52,7 @@ static partial void ModifyPhantomKamaitachiPvE(ref ActionSetting setting)
static partial void ModifyThrowingDaggerPvE(ref ActionSetting setting)
{
- setting.IsMeleeRange = true;
+ setting.SpecialType = SpecialActionType.MeleeRange;
}
static partial void ModifyBhavacakraPvE(ref ActionSetting setting)
@@ -115,6 +115,11 @@ static partial void ModifyDotonPvE(ref ActionSetting setting)
setting.StatusProvide = [StatusID.Doton];
}
+ static partial void ModifyShukuchiPvE(ref ActionSetting setting)
+ {
+ setting.SpecialType = SpecialActionType.MovingForward;
+ }
+
///
///
///
diff --git a/RotationSolver.Basic/Rotations/Basic/PaladinRotation.cs b/RotationSolver.Basic/Rotations/Basic/PaladinRotation.cs
index 05209d18f..bb3520115 100644
--- a/RotationSolver.Basic/Rotations/Basic/PaladinRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/PaladinRotation.cs
@@ -54,7 +54,7 @@ static partial void ModifyShieldBashPvE(ref ActionSetting setting)
static partial void ModifyShieldLobPvE(ref ActionSetting setting)
{
- setting.IsMeleeRange = true;
+ setting.SpecialType = SpecialActionType.MeleeRange;
}
private protected sealed override IBaseAction TankStance => IronWillPvE;
@@ -102,6 +102,10 @@ static partial void ModifyHolySheltronPvE(ref ActionSetting setting)
setting.ActionCheck = () => OathGauge >= 50 && Player.IsTargetOnSelf();
}
+ static partial void ModifyIntervenePvP(ref ActionSetting setting)
+ {
+ setting.SpecialType = SpecialActionType.MovingForward;
+ }
///
protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
diff --git a/RotationSolver.Basic/Rotations/Basic/ReaperRotation.cs b/RotationSolver.Basic/Rotations/Basic/ReaperRotation.cs
index fea514818..86a44f639 100644
--- a/RotationSolver.Basic/Rotations/Basic/ReaperRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/ReaperRotation.cs
@@ -177,7 +177,7 @@ static partial void ModifyGrimReapingPvE(ref ActionSetting setting)
static partial void ModifyHarpePvE(ref ActionSetting setting)
{
- setting.IsMeleeRange = true;
+ setting.SpecialType = SpecialActionType.MeleeRange;
}
static partial void ModifyHellsIngressPvE(ref ActionSetting setting)
@@ -201,6 +201,11 @@ static partial void ModifyHarvestMoonPvE(ref ActionSetting setting)
setting.StatusNeed = [StatusID.Soulsow];
}
+ static partial void ModifyHellsIngressPvP(ref ActionSetting setting)
+ {
+ setting.SpecialType = SpecialActionType.MovingForward;
+ }
+
///
[RotationDesc(ActionID.HellsIngressPvE)]
protected sealed override bool MoveForwardAbility(out IAction? act)
diff --git a/RotationSolver.Basic/Rotations/Basic/RedMageRotation.cs b/RotationSolver.Basic/Rotations/Basic/RedMageRotation.cs
index aad5daa02..606bfbc81 100644
--- a/RotationSolver.Basic/Rotations/Basic/RedMageRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/RedMageRotation.cs
@@ -133,6 +133,11 @@ static partial void ModifyManaficationPvE(ref ActionSetting setting)
};
}
+ static partial void ModifyCorpsacorpsPvE(ref ActionSetting setting)
+ {
+ setting.SpecialType = SpecialActionType.MovingForward;
+ }
+
///
[RotationDesc(ActionID.VercurePvE)]
protected sealed override bool HealSingleGCD(out IAction? act)
diff --git a/RotationSolver.Basic/Rotations/Basic/SageRotation.cs b/RotationSolver.Basic/Rotations/Basic/SageRotation.cs
index c249a78fd..5d63ef9c5 100644
--- a/RotationSolver.Basic/Rotations/Basic/SageRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/SageRotation.cs
@@ -124,6 +124,11 @@ static partial void ModifyPepsisPvE(ref ActionSetting setting)
};
}
+ static partial void ModifyIcarusPvE(ref ActionSetting setting)
+ {
+ setting.SpecialType = SpecialActionType.MovingForward;
+ }
+
///
[RotationDesc(ActionID.IcarusPvE)]
protected sealed override bool MoveForwardAbility(out IAction? act)
diff --git a/RotationSolver.Basic/Rotations/Basic/SamuraiRotation.cs b/RotationSolver.Basic/Rotations/Basic/SamuraiRotation.cs
index 3ad0bfead..f35a31639 100644
--- a/RotationSolver.Basic/Rotations/Basic/SamuraiRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/SamuraiRotation.cs
@@ -118,7 +118,7 @@ static partial void ModifyKaeshiSetsugekkaPvE(ref ActionSetting setting)
static partial void ModifyEnpiPvE(ref ActionSetting setting)
{
- setting.IsMeleeRange = true;
+ setting.SpecialType = SpecialActionType.MeleeRange;
}
static partial void ModifyMeikyoShisuiPvE(ref ActionSetting setting)
@@ -148,6 +148,7 @@ static partial void ModifyHissatsuShintenPvE(ref ActionSetting setting)
static partial void ModifyHissatsuGyotenPvE(ref ActionSetting setting)
{
+ setting.SpecialType = SpecialActionType.MovingForward;
setting.ActionCheck = () => Kenki >= 10;
}
diff --git a/RotationSolver.Basic/Rotations/Basic/WarriorRotation.cs b/RotationSolver.Basic/Rotations/Basic/WarriorRotation.cs
index 8e8f0db98..2d95f30ca 100644
--- a/RotationSolver.Basic/Rotations/Basic/WarriorRotation.cs
+++ b/RotationSolver.Basic/Rotations/Basic/WarriorRotation.cs
@@ -11,6 +11,8 @@ partial class WarriorRotation
///
public static byte BeastGauge => JobGauge.BeastGauge;
+ private sealed protected override IBaseAction TankStance => DefiancePvE;
+
static partial void ModifyStormsEyePvE(ref ActionSetting setting)
{
setting.CreateConfig = () => new()
@@ -27,7 +29,7 @@ static partial void ModifyInnerBeastPvE(ref ActionSetting setting)
static partial void ModifyTomahawkPvE(ref ActionSetting setting)
{
- setting.IsMeleeRange = true;
+ setting.SpecialType = SpecialActionType.MeleeRange;
}
static partial void ModifyUpheavalPvE(ref ActionSetting setting)
@@ -48,8 +50,8 @@ static partial void ModifySteelCyclonePvE(ref ActionSetting setting)
static partial void ModifyPrimalRendPvE(ref ActionSetting setting)
{
setting.StatusNeed = [StatusID.PrimalRendReady];
+ setting.SpecialType = SpecialActionType.MovingForward;
}
- private sealed protected override IBaseAction TankStance => DefiancePvE;
static partial void ModifyInfuriatePvE(ref ActionSetting setting)
{
@@ -120,6 +122,11 @@ static partial void ModifyChaoticCyclonePvP(ref ActionSetting setting)
setting.StatusNeed = [StatusID.NascentChaos_1992];
}
+ static partial void ModifyOnslaughtPvE(ref ActionSetting setting)
+ {
+ setting.SpecialType = SpecialActionType.MovingForward;
+ }
+
///
protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
{