From 6d85dd0a6c652d757940f5d16d8bd8f69febc903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Fri, 27 Jan 2023 16:53:24 +0800 Subject: [PATCH] fix: change the logic of blu. --- RotationSolver/Data/StatusID.cs | 47 +------------------ RotationSolver/Rotations/Basic/BLU_Base.cs | 38 +++++++++++++-- .../CustomRotation/CustomRotation_Actions.cs | 2 +- .../RangedMagicial/BLU/BLU_Default.cs | 14 +++--- RotationSolver/Timeline/MajorConditionSet.cs | 3 ++ .../Windows/RotationConfigWindow_Debug.cs | 6 +-- docs/RotationDev/customization.md | 1 + 7 files changed, 50 insertions(+), 61 deletions(-) diff --git a/RotationSolver/Data/StatusID.cs b/RotationSolver/Data/StatusID.cs index f2f3c77c1..9f7c27f23 100644 --- a/RotationSolver/Data/StatusID.cs +++ b/RotationSolver/Data/StatusID.cs @@ -1112,50 +1112,7 @@ internal enum StatusID : ushort /// Necrosis = 2965, - #region Crafting - /// - /// 内静 - /// - InnerQuiet = 251, - - /// - /// 改革 - /// - Innovation = 2189, - - /// - /// 崇敬 - /// - Veneration = 2226, - - /// - /// 阔步 - /// - GreatStrides = 254, - - /// - /// 掌握 - /// - Manipulation = 1164, - - /// - /// 俭约 - /// - WasteNot = 252, - - /// - /// 长期俭约 - /// - WasteNot2 = 257, + MightyGuard = 1719, - /// - /// 最终确认 - /// - FinalAppraisal = 2190, - - /// - /// 坚信 - /// - MuscleMemory = 2191, - #endregion + IceSpikes = 1307, } diff --git a/RotationSolver/Rotations/Basic/BLU_Base.cs b/RotationSolver/Rotations/Basic/BLU_Base.cs index e0ad4207f..46cd94753 100644 --- a/RotationSolver/Rotations/Basic/BLU_Base.cs +++ b/RotationSolver/Rotations/Basic/BLU_Base.cs @@ -46,6 +46,15 @@ internal enum BLUActionType : byte public class BLUAction : BaseAction, IBLUAction { + static readonly StatusID[] NoPhysic = new StatusID[] + { + StatusID.IceSpikes, + }; + + static readonly StatusID[] NoMagic = new StatusID[] + { + }; + private BLUActionType Type; public unsafe bool OnSlot => ActionUpdater.BluSlots.Any(i => AdjustedID == Service.IconReplacer.OriginalHook(i)); @@ -54,6 +63,12 @@ internal BLUAction(ActionID actionID, BLUActionType type, bool isFriendly = fals : base(actionID, isFriendly, shouldEndSpecial, isEot, isTimeline) { Type = type; + FilterForTarget = ts => ts.Where(t => + { + if (t.HasStatus(false, NoPhysic) && Type == BLUActionType.Physical) return false; + if (t.HasStatus(false, NoMagic) && Type == BLUActionType.Magical) return false; + return true; + }); } public override bool CanUse(out IAction act, bool mustUse = false, bool emptyOrSkipCombo = false, bool skipDisable = false) @@ -62,7 +77,6 @@ public override bool CanUse(out IAction act, bool mustUse = false, bool emptyOrS if (!OnSlot) return false; - //排除其他类型的魔法。 if (AttackType == BLUAttackType.Physical && Type == BLUActionType.Magical) return false; if (AttackType == BLUAttackType.Magical && Type == BLUActionType.Physical) return false; @@ -599,7 +613,13 @@ public override bool CanUse(out IAction act, bool mustUse = false, bool emptyOrS /// /// 强力守护 /// - public static IBLUAction MightyGuard { get; } = new BLUAction(ActionID.MightyGuard, BLUActionType.None, true); + public static IBLUAction MightyGuard { get; } = new BLUAction(ActionID.MightyGuard, BLUActionType.None, true) + { + StatusProvide = new StatusID[] + { + StatusID.MightyGuard, + }, + }; /// /// 月之笛 @@ -736,9 +756,21 @@ private protected override bool MoveGCD(out IAction act) private protected override bool EmergencyGCD(out IAction act) { if (AetherialMimicry.CanUse(out act)) return true; - if (BasicInstinct.CanUse(out act)) return true; + if (BasicInstinct.CanUse(out _)) + { + if (MightyGuard.CanUse(out act)) return true; + act = BasicInstinct; + return true; + } return base.EmergencyGCD(out act); } protected static bool AllOnSlot(params IBLUAction[] actions) => actions.All(a => a.OnSlot); + protected static uint OnSlotCount(params IBLUAction[] actions) => (uint)actions.Count(a => a.OnSlot); + + public override IBaseAction[] AllActions => base.AllActions.Where(a => + { + if (a is not BLUAction b) return false; + return b.OnSlot; + }).ToArray(); } diff --git a/RotationSolver/Rotations/CustomRotation/CustomRotation_Actions.cs b/RotationSolver/Rotations/CustomRotation/CustomRotation_Actions.cs index 14330abcd..69254f114 100644 --- a/RotationSolver/Rotations/CustomRotation/CustomRotation_Actions.cs +++ b/RotationSolver/Rotations/CustomRotation/CustomRotation_Actions.cs @@ -210,7 +210,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, bool isFriendly = false, /// /// 当前这个类所有的BaseAction /// - public IBaseAction[] AllActions => GetBaseActions(GetType()); + public virtual IBaseAction[] AllActions => GetBaseActions(GetType()); /// /// 这个类所有的公开bool值 diff --git a/RotationSolver/Rotations/RangedMagicial/BLU/BLU_Default.cs b/RotationSolver/Rotations/RangedMagicial/BLU/BLU_Default.cs index 325131900..49176930a 100644 --- a/RotationSolver/Rotations/RangedMagicial/BLU/BLU_Default.cs +++ b/RotationSolver/Rotations/RangedMagicial/BLU/BLU_Default.cs @@ -139,27 +139,25 @@ private protected override bool HealAreaGCD(out IAction act) private bool DBlueBreak(out IAction act) { act = null; - //if (BlueId == BLUID.Healer && BlueId == BLUID.Tank) return false; + if (!HasHostilesInRange) return false; - if (!AllOnSlot(MoonFlute)) return false; - - if (AllOnSlot(TripleTrident) && !TripleTrident.IsCoolingDown) + if (AllOnSlot(TripleTrident) && TripleTrident.WillHaveOneChargeGCD(OnSlotCount(Whistle, Tingle), 0)) { //口笛 if (Whistle.CanUse(out act)) return true; //哔哩哔哩 if (!Player.HasStatus(true, StatusID.Tingling) && Player.HasStatus(true, StatusID.Harmonized) && Tingle.CanUse(out act, mustUse: true)) return true; //鱼叉 - if (Player.HasStatus(true, StatusID.WaxingNocturne) && TripleTrident.CanUse(out act, mustUse: true)) return true; + if (TripleTrident.CanUse(out act, mustUse: true)) return true; } if (AllOnSlot(Whistle, FinalSting, BasicInstinct) && UseFinalSting) { - if (HasHostilesInRange && Whistle.CanUse(out act)) return true; + if (Whistle.CanUse(out act)) return true; //破防 - if (Player.HasStatus(true, StatusID.WaxingNocturne) && Offguard.CanUse(out act)) return true; + if (Offguard.CanUse(out act)) return true; //哔哩哔哩 - if (Player.HasStatus(true, StatusID.WaxingNocturne) && Tingle.CanUse(out act)) return true; + if (Tingle.CanUse(out act)) return true; } //月笛 diff --git a/RotationSolver/Timeline/MajorConditionSet.cs b/RotationSolver/Timeline/MajorConditionSet.cs index 69978b87b..ca103ce03 100644 --- a/RotationSolver/Timeline/MajorConditionSet.cs +++ b/RotationSolver/Timeline/MajorConditionSet.cs @@ -8,6 +8,9 @@ namespace RotationSolver.Timeline; internal class MajorConditionSet { + /// + /// Key for action id. + /// public Dictionary Conditions { get; } = new Dictionary(); public string Name; diff --git a/RotationSolver/Windows/RotationConfigWindow_Debug.cs b/RotationSolver/Windows/RotationConfigWindow_Debug.cs index fdb9054d4..eda55e275 100644 --- a/RotationSolver/Windows/RotationConfigWindow_Debug.cs +++ b/RotationSolver/Windows/RotationConfigWindow_Debug.cs @@ -46,10 +46,8 @@ private unsafe void DrawDebugTab() foreach (var status in b.StatusList) { - if (status.SourceId == Service.ClientState.LocalPlayer.ObjectId) - { - ImGui.Text($"{status.GameData.Name}: {status.StatusId}"); - } + var source = Service.ObjectTable.SearchById(status.SourceId)?.Name ?? "None"; + ImGui.Text($"{status.GameData.Name}: {status.StatusId} From: {source}"); } } diff --git a/docs/RotationDev/customization.md b/docs/RotationDev/customization.md index 10f5fc279..aeca6e2af 100644 --- a/docs/RotationDev/customization.md +++ b/docs/RotationDev/customization.md @@ -37,6 +37,7 @@ Sometimes, for saving the resource. We want to save the value to the field. But private protected override void UpdateInfo() { //Set your value to field here. + base.UpdateInfo(); } ```