From f69271fee70748833ec6046451566d93a863b8a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com>
Date: Sun, 16 Apr 2023 10:39:41 +0800
Subject: [PATCH] fix: changed some propery's access.
---
.../Actions/BaseAction_BasicInfo.cs | 16 ---------
.../Actions/BaseAction_Cooldown.cs | 20 +----------
.../Actions/BaseAction_Target.cs | 9 +++--
RotationSolver.Basic/Actions/IBaseAction.cs | 16 ---------
.../Attributes/AssemblyLinkAttribute.cs | 7 ----
RotationSolver.Basic/Helpers/StatusHelper.cs | 5 ---
.../Rotations/CustomRotation_Actions.cs | 35 ++++++++++---------
RotationSolver/UI/ImGuiHelper.cs | 1 -
8 files changed, 23 insertions(+), 86 deletions(-)
diff --git a/RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs b/RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
index fd455330a..376870b41 100644
--- a/RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
+++ b/RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
@@ -109,22 +109,6 @@ public BaseAction(ActionID actionID, ActionOption option = ActionOption.None)
CoolDownGroup = _action.GetCoolDownGroup();
}
- ///
- ///
- ///
- ///
- /// is a friendly or supporting action
- /// end special after using it
- /// is hot or dot action
- /// should I put it to the timeline (heal and defense only)
- [Obsolete("Please use the ActionOption one", false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public BaseAction(ActionID actionID, bool isFriendly = false, bool endSpecial = false, bool isEot = false, bool isTimeline = false)
- : this(actionID, GetOption(isFriendly, endSpecial, isEot, isTimeline))
- {
-
- }
-
private static ActionOption GetOption(bool isFriendly = false, bool endSpecial = false, bool isEot = false, bool isTimeline = false)
{
ActionOption option = ActionOption.None;
diff --git a/RotationSolver.Basic/Actions/BaseAction_Cooldown.cs b/RotationSolver.Basic/Actions/BaseAction_Cooldown.cs
index 8970b6af5..408bbc472 100644
--- a/RotationSolver.Basic/Actions/BaseAction_Cooldown.cs
+++ b/RotationSolver.Basic/Actions/BaseAction_Cooldown.cs
@@ -4,11 +4,6 @@ namespace RotationSolver.Basic.Actions;
public partial class BaseAction
{
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("Please use the int abilityCount one", false)]
- public bool ElapsedOneChargeAfterGCD(uint gcdCount = 0, uint abilityCount = 0)
- => ElapsedOneChargeAfterGCD(gcdCount, (int)abilityCount);
-
public bool ElapsedOneChargeAfterGCD(uint gcdCount = 0, int abilityCount = 0)
{
if (!IsCoolingDown) return false;
@@ -23,11 +18,6 @@ public bool ElapsedOneChargeAfter(float time)
return CooldownHelper.ElapsedAfter(elapsed, time);
}
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("Please use the int abilityCount one", false)]
- public bool ElapsedAfterGCD(uint gcdCount = 0, uint abilityCount = 0)
- => ElapsedAfterGCD(gcdCount, (int)abilityCount);
-
public bool ElapsedAfterGCD(uint gcdCount = 0, int abilityCount = 0)
{
if (!IsCoolingDown) return false;
@@ -50,11 +40,6 @@ public bool WillHaveOneChargeGCD(uint gcdCount = 0, int abilityCount = 0)
return CooldownHelper.RecastAfterGCD(recast, gcdCount, abilityCount);
}
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("Please use the int abilityCount one", false)]
- public bool WillHaveOneChargeGCD(uint gcdCount = 0, uint abilityCount = 0)
- => WillHaveOneChargeGCD(gcdCount, (int)abilityCount);
-
public bool WillHaveOneCharge(float remain) => WillHaveOneCharge(remain, true);
private bool WillHaveOneCharge(float remain, bool addWeaponRemain)
@@ -68,13 +53,11 @@ private bool WillHaveOneCharge(float remain, bool addWeaponRemain)
///
/// 复唱时间
///
- [EditorBrowsable(EditorBrowsableState.Never)]
private unsafe float RecastTime => CoolDownDetail->Total;
///
/// 复唱经过时间
///
- [EditorBrowsable(EditorBrowsableState.Never)]
public unsafe float RecastTimeElapsed => CoolDownDetail->Elapsed;
///
@@ -85,8 +68,7 @@ private bool WillHaveOneCharge(float remain, bool addWeaponRemain)
///
/// 复唱剩余时间
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- public float RecastTimeRemain => RecastTime - RecastTimeElapsed;
+ private float RecastTimeRemain => RecastTime - RecastTimeElapsed;
///
/// 技能的最大层数
diff --git a/RotationSolver.Basic/Actions/BaseAction_Target.cs b/RotationSolver.Basic/Actions/BaseAction_Target.cs
index 123b4dbdf..7b51d432c 100644
--- a/RotationSolver.Basic/Actions/BaseAction_Target.cs
+++ b/RotationSolver.Basic/Actions/BaseAction_Target.cs
@@ -405,10 +405,6 @@ public bool CanGetTarget(BattleChara target, BattleChara subTarget)
switch (_action.CastType)
{
- case 10: //环形范围攻击也就这么判断吧,我烦了。
- var dis = Vector3.Distance(target.Position, subTarget.Position) - subTarget.HitboxRadius;
- return dis <= _action.EffectRange && dis >= 8;
-
case 2: // 圆形范围攻击
return Vector3.Distance(target.Position, subTarget.Position) - subTarget.HitboxRadius <= _action.EffectRange;
@@ -420,6 +416,10 @@ public bool CanGetTarget(BattleChara target, BattleChara subTarget)
case 4: //直线范围攻击
if (subTarget.DistanceToPlayer() > _action.EffectRange) return false;
return Vector3.Cross(dir, tdir).Length() / dir.Length() <= 2 + target.HitboxRadius;
+
+ case 10: //环形范围攻击也就这么判断吧,我烦了。
+ var dis = Vector3.Distance(target.Position, subTarget.Position) - subTarget.HitboxRadius;
+ return dis <= _action.EffectRange && dis >= 8;
}
PluginLog.LogDebug(Name + "'s CastType is not valid! The value is " + _action.CastType.ToString());
@@ -466,7 +466,6 @@ bool CheckStatus(BattleChara tar)
0, true, TargetStatus);
}
-
public unsafe bool CanUseTo(BattleChara tar)
{
if (tar == null) return false;
diff --git a/RotationSolver.Basic/Actions/IBaseAction.cs b/RotationSolver.Basic/Actions/IBaseAction.cs
index 7b627c173..06e9f077f 100644
--- a/RotationSolver.Basic/Actions/IBaseAction.cs
+++ b/RotationSolver.Basic/Actions/IBaseAction.cs
@@ -82,10 +82,6 @@ public interface IBaseAction : IAction
///
bool HasOneCharge { get; }
- ///
- /// recast time remain total.
- ///
- float RecastTimeRemain { get; }
///
/// Has it been in cooldown for gcds and abilities?
///
@@ -94,10 +90,6 @@ public interface IBaseAction : IAction
///
bool ElapsedOneChargeAfterGCD(uint gcdCount = 0, int abilityCount = 0);
- [Obsolete("Use int abilityCount one!", false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- bool ElapsedOneChargeAfterGCD(uint gcdCount = 0, uint abilityCount = 0);
-
///
/// Has it been in cooldown for seconds?
///
@@ -113,10 +105,6 @@ public interface IBaseAction : IAction
///
bool ElapsedAfterGCD(uint gcdCount = 0, int abilityCount = 0);
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("Use int abilityCount one!", false)]
- bool ElapsedAfterGCD(uint gcdCount = 0, uint abilityCount = 0);
-
///
/// Has it been in cooldown for seconds?
///
@@ -132,10 +120,6 @@ public interface IBaseAction : IAction
///
bool WillHaveOneChargeGCD(uint gcdCount = 0, int abilityCount = 0);
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("Use int abilityCount one!", false)]
- bool WillHaveOneChargeGCD(uint gcdCount = 0, uint abilityCount = 0);
-
///
/// Will have at least one charge after seconds?
///
diff --git a/RotationSolver.Basic/Attributes/AssemblyLinkAttribute.cs b/RotationSolver.Basic/Attributes/AssemblyLinkAttribute.cs
index 9bdee95cf..ea81ad497 100644
--- a/RotationSolver.Basic/Attributes/AssemblyLinkAttribute.cs
+++ b/RotationSolver.Basic/Attributes/AssemblyLinkAttribute.cs
@@ -16,11 +16,4 @@ public AssemblyLinkAttribute(string supportLink = null, string helpLink = null,
HelpLink = helpLink;
ChangeLog = changeLog;
}
-
- [Obsolete("Use the third one Please", false)]
- public AssemblyLinkAttribute(string supportLink = null, string helpLink = null)
- {
- SupportLink = supportLink;
- HelpLink = helpLink;
- }
}
diff --git a/RotationSolver.Basic/Helpers/StatusHelper.cs b/RotationSolver.Basic/Helpers/StatusHelper.cs
index 93763d8f7..31fb2fea7 100644
--- a/RotationSolver.Basic/Helpers/StatusHelper.cs
+++ b/RotationSolver.Basic/Helpers/StatusHelper.cs
@@ -44,11 +44,6 @@ internal record Burst2MinsInfo( StatusID status, bool isOnHostile, byte level, p
public static bool NeedHealing(this BattleChara p) => p.WillStatusEndGCD(2, 0, false, NoNeedHealingStatus);
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("Please Use the abilityCount int one please.", true)]
- public static bool WillStatusEndGCD(this BattleChara obj, uint gcdCount = 0, uint abilityCount = 0, bool isFromSelf = true, params StatusID[] statusIDs)
- => obj.WillStatusEndGCD(gcdCount, (int)abilityCount, isFromSelf, statusIDs);
-
///
/// Will any of be end after gcds and abilities?
///
diff --git a/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs b/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
index 3144b4082..e5c8de84f 100644
--- a/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
+++ b/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
@@ -5,7 +5,8 @@ public abstract partial class CustomRotation
internal class RoleAction : BaseAction
{
private JobRole[] _roles;
- internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false, bool shouldEndSpecial = false, bool isEot = false, bool isTimeline = false) : base(actionID, isFriendly, shouldEndSpecial, isEot, isTimeline)
+ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = ActionOption.None)
+ : base(actionID, option)
{
_roles = roles;
}
@@ -16,7 +17,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
///
/// 昏乱
///
- public static IBaseAction Addle { get; } = new RoleAction(ActionID.Addle, new JobRole[] { JobRole.RangedMagical }, isFriendly: true, isTimeline: true)
+ public static IBaseAction Addle { get; } = new RoleAction(ActionID.Addle, new JobRole[] { JobRole.RangedMagical }, ActionOption.Defense)
{
ActionCheck = b => !b.HasStatus(false, StatusID.Addle),
};
@@ -24,7 +25,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
///
/// 即刻咏唱
///
- public static IBaseAction Swiftcast { get; } = new RoleAction(ActionID.SwiftCast, new JobRole[] { JobRole.RangedMagical, JobRole.Healer }, true)
+ public static IBaseAction Swiftcast { get; } = new RoleAction(ActionID.SwiftCast, new JobRole[] { JobRole.RangedMagical, JobRole.Healer }, ActionOption.Buff)
{
StatusProvide = new StatusID[]
{
@@ -37,7 +38,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
///
/// 康复
///
- public static IBaseAction Esuna { get; } = new RoleAction(ActionID.Esuna, new JobRole[] { JobRole.Healer }, true)
+ public static IBaseAction Esuna { get; } = new RoleAction(ActionID.Esuna, new JobRole[] { JobRole.Healer }, ActionOption.Heal)
{
ChoiceTarget = (tars, mustUse) =>
{
@@ -56,7 +57,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
///
/// 营救
///
- public static IBaseAction Rescue { get; } = new RoleAction(ActionID.Rescue, new JobRole[] { JobRole.Healer }, true, isTimeline: true);
+ public static IBaseAction Rescue { get; } = new RoleAction(ActionID.Rescue, new JobRole[] { JobRole.Healer }, ActionOption.Heal);
///
/// 沉静
@@ -67,7 +68,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
/// 醒梦(如果MP低于6000那么使用)
///
public static IBaseAction LucidDreaming { get; } = new RoleAction(ActionID.LucidDreaming,
- new JobRole[] { JobRole.Healer, JobRole.RangedMagical }, true)
+ new JobRole[] { JobRole.Healer, JobRole.RangedMagical }, ActionOption.Buff)
{
ActionCheck = b => Player.CurrentMp < 6000 && InCombat,
};
@@ -76,7 +77,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
/// 内丹
///
public static IBaseAction SecondWind { get; } = new RoleAction(ActionID.SecondWind,
- new JobRole[] { JobRole.RangedPhysical, JobRole.Melee }, true, isTimeline: true)
+ new JobRole[] { JobRole.RangedPhysical, JobRole.Melee }, ActionOption.Heal)
{
ActionCheck = b => Player?.GetHealthRatio() < Service.Config.HealthSingleAbility && InCombat,
};
@@ -84,12 +85,12 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
///
/// 亲疏自行
///
- public static IBaseAction ArmsLength { get; } = new RoleAction(ActionID.ArmsLength, new JobRole[] { JobRole.Tank, JobRole.Melee, JobRole.RangedPhysical }, true, shouldEndSpecial: true, isTimeline: true);
+ public static IBaseAction ArmsLength { get; } = new RoleAction(ActionID.ArmsLength, new JobRole[] { JobRole.Tank, JobRole.Melee, JobRole.RangedPhysical }, ActionOption.Defense | ActionOption.EndSpecial);
///
/// 铁壁
///
- public static IBaseAction Rampart { get; } = new RoleAction(ActionID.Rampart, new JobRole[] { JobRole.Tank }, true, isTimeline: true)
+ public static IBaseAction Rampart { get; } = new RoleAction(ActionID.Rampart, new JobRole[] { JobRole.Tank }, ActionOption.Defense)
{
StatusProvide = new StatusID[]
{
@@ -109,7 +110,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
///
/// 挑衅
///
- public static IBaseAction Provoke { get; } = new RoleAction(ActionID.Provoke, new JobRole[] { JobRole.Tank }, isTimeline: true)
+ public static IBaseAction Provoke { get; } = new RoleAction(ActionID.Provoke, new JobRole[] { JobRole.Tank }, ActionOption.Timeline)
{
FilterForHostiles = b => TargetFilter.ProvokeTarget(b),
};
@@ -117,12 +118,12 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
///
/// 雪仇
///
- public static IBaseAction Reprisal { get; } = new RoleAction(ActionID.Reprisal, new JobRole[] { JobRole.Tank }, isTimeline: true);
+ public static IBaseAction Reprisal { get; } = new RoleAction(ActionID.Reprisal, new JobRole[] { JobRole.Tank }, ActionOption.Defense);
///
/// 退避
///
- public static IBaseAction Shirk { get; } = new RoleAction(ActionID.Shirk, new JobRole[] { JobRole.Tank }, true)
+ public static IBaseAction Shirk { get; } = new RoleAction(ActionID.Shirk, new JobRole[] { JobRole.Tank }, ActionOption.Friendly | ActionOption.Timeline)
{
ChoiceTarget = (friends, mustUse) => TargetFilter.GetJobCategory(friends, JobRole.Tank)?.FirstOrDefault(),
};
@@ -130,7 +131,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
///
/// 浴血
///
- public static IBaseAction Bloodbath { get; } = new RoleAction(ActionID.Bloodbath, new JobRole[] { JobRole.Melee }, true, isTimeline: true)
+ public static IBaseAction Bloodbath { get; } = new RoleAction(ActionID.Bloodbath, new JobRole[] { JobRole.Melee }, ActionOption.Heal)
{
ActionCheck = SecondWind.ActionCheck,
};
@@ -138,7 +139,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
///
/// 牵制
///
- public static IBaseAction Feint { get; } = new RoleAction(ActionID.Feint, new JobRole[] { JobRole.Melee }, isTimeline: true)
+ public static IBaseAction Feint { get; } = new RoleAction(ActionID.Feint, new JobRole[] { JobRole.Melee }, ActionOption.Defense)
{
ActionCheck = b => !b.HasStatus(false, StatusID.Feint),
};
@@ -185,13 +186,13 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
/// 沉稳咏唱
///
public static IBaseAction SureCast { get; } = new RoleAction(ActionID.SureCast,
- new JobRole[] { JobRole.RangedMagical, JobRole.Healer }, true, shouldEndSpecial: true);
+ new JobRole[] { JobRole.RangedMagical, JobRole.Healer }, ActionOption.Heal);
///
/// 真北
///
public static IBaseAction TrueNorth { get; } = new RoleAction(ActionID.TrueNorth,
- new JobRole[] { JobRole.Melee }, true, shouldEndSpecial: true)
+ new JobRole[] { JobRole.Melee }, ActionOption.Heal)
{
StatusProvide = new StatusID[] { StatusID.TrueNorth },
};
@@ -199,7 +200,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
///
/// 速行
///
- public static IBaseAction Peloton { get; } = new RoleAction(ActionID.Peloton, new JobRole[] { JobRole.RangedPhysical }, true)
+ public static IBaseAction Peloton { get; } = new RoleAction(ActionID.Peloton, new JobRole[] { JobRole.RangedPhysical }, ActionOption.Buff)
{
ActionCheck = b => NotInCombatDelay && PartyMembers.GetObjectInRadius(20)
.Any(p => p.WillStatusEnd(3, false, StatusID.Peloton)),
diff --git a/RotationSolver/UI/ImGuiHelper.cs b/RotationSolver/UI/ImGuiHelper.cs
index 11dfb7fa8..2dae058a3 100644
--- a/RotationSolver/UI/ImGuiHelper.cs
+++ b/RotationSolver/UI/ImGuiHelper.cs
@@ -607,7 +607,6 @@ private unsafe static void Display(this IBaseAction action, bool IsActive) => ac
ImGui.Text("Has One:" + action.HasOneCharge.ToString());
ImGui.Text("Recast One: " + action.RecastTimeOneCharge.ToString());
ImGui.Text("Recast Elapsed: " + action.RecastTimeElapsed.ToString());
- ImGui.Text("Recast Remain: " + action.RecastTimeRemain.ToString());
ImGui.Text("Status: " + ActionManager.Instance()->GetActionStatus(ActionType.Spell, action.AdjustedID).ToString());
ImGui.Text("Cast Time: " + action.CastTime.ToString());
ImGui.Text("MP: " + action.MPNeed.ToString());