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

Commit

Permalink
fix: changed some propery's access.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 16, 2023
1 parent 66817ce commit f69271f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 86 deletions.
16 changes: 0 additions & 16 deletions RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,6 @@ public BaseAction(ActionID actionID, ActionOption option = ActionOption.None)
CoolDownGroup = _action.GetCoolDownGroup();
}

/// <summary>
///
/// </summary>
/// <param name="actionID"></param>
/// <param name="isFriendly">is a friendly or supporting action</param>
/// <param name="endSpecial">end special after using it</param>
/// <param name="isEot">is hot or dot action</param>
/// <param name="isTimeline">should I put it to the timeline (heal and defense only)</param>
[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;
Expand Down
20 changes: 1 addition & 19 deletions RotationSolver.Basic/Actions/BaseAction_Cooldown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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)
Expand All @@ -68,13 +53,11 @@ private bool WillHaveOneCharge(float remain, bool addWeaponRemain)
/// <summary>
/// 复唱时间
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private unsafe float RecastTime => CoolDownDetail->Total;

/// <summary>
/// 复唱经过时间
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public unsafe float RecastTimeElapsed => CoolDownDetail->Elapsed;

/// <summary>
Expand All @@ -85,8 +68,7 @@ private bool WillHaveOneCharge(float remain, bool addWeaponRemain)
/// <summary>
/// 复唱剩余时间
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public float RecastTimeRemain => RecastTime - RecastTimeElapsed;
private float RecastTimeRemain => RecastTime - RecastTimeElapsed;

/// <summary>
/// 技能的最大层数
Expand Down
9 changes: 4 additions & 5 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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());
Expand Down Expand Up @@ -466,7 +466,6 @@ bool CheckStatus(BattleChara tar)
0, true, TargetStatus);
}


public unsafe bool CanUseTo(BattleChara tar)
{
if (tar == null) return false;
Expand Down
16 changes: 0 additions & 16 deletions RotationSolver.Basic/Actions/IBaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ public interface IBaseAction : IAction
/// </summary>
bool HasOneCharge { get; }

/// <summary>
/// recast time remain total.
/// </summary>
float RecastTimeRemain { get; }
/// <summary>
/// Has it been in cooldown for <paramref name="gcdCount"/> gcds and <paramref name="abilityCount"/> abilities?
/// </summary>
Expand All @@ -94,10 +90,6 @@ public interface IBaseAction : IAction
/// <returns></returns>
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);

/// <summary>
/// Has it been in cooldown for <paramref name="time"/> seconds?
/// </summary>
Expand All @@ -113,10 +105,6 @@ public interface IBaseAction : IAction
/// <returns></returns>
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);

/// <summary>
/// Has it been in cooldown for <paramref name="time"/> seconds?
/// </summary>
Expand All @@ -132,10 +120,6 @@ public interface IBaseAction : IAction
/// <returns></returns>
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);

/// <summary>
/// Will have at least one charge after <paramref name="remain"/> seconds?
/// </summary>
Expand Down
7 changes: 0 additions & 7 deletions RotationSolver.Basic/Attributes/AssemblyLinkAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
5 changes: 0 additions & 5 deletions RotationSolver.Basic/Helpers/StatusHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/// <summary>
/// Will any of <paramref name="statusIDs"/> be end after <paramref name="gcdCount"/> gcds and <paramref name="abilityCount"/> abilities?
/// </summary>
Expand Down
35 changes: 18 additions & 17 deletions RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -16,15 +17,15 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
/// <summary>
/// 昏乱
/// </summary>
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),
};

/// <summary>
/// 即刻咏唱
/// </summary>
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[]
{
Expand All @@ -37,7 +38,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
/// <summary>
/// 康复
/// </summary>
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) =>
{
Expand All @@ -56,7 +57,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
/// <summary>
/// 营救
/// </summary>
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);

/// <summary>
/// 沉静
Expand All @@ -67,7 +68,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
/// 醒梦(如果MP低于6000那么使用)
/// </summary>
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,
};
Expand All @@ -76,20 +77,20 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
/// 内丹
/// </summary>
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,
};

/// <summary>
/// 亲疏自行
/// </summary>
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);

/// <summary>
/// 铁壁
/// </summary>
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[]
{
Expand All @@ -109,36 +110,36 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
/// <summary>
/// 挑衅
/// </summary>
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),
};

/// <summary>
/// 雪仇
/// </summary>
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);

/// <summary>
/// 退避
/// </summary>
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(),
};

/// <summary>
/// 浴血
/// </summary>
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,
};

/// <summary>
/// 牵制
/// </summary>
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),
};
Expand Down Expand Up @@ -185,21 +186,21 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false,
/// 沉稳咏唱
/// </summary>
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);

/// <summary>
/// 真北
/// </summary>
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 },
};

/// <summary>
/// 速行
/// </summary>
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)),
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit f69271f

Please sign in to comment.