diff --git a/RotationSolver/Localization/Localization.json b/RotationSolver/Localization/Localization.json index 407156a9c..491b5c512 100644 --- a/RotationSolver/Localization/Localization.json +++ b/RotationSolver/Localization/Localization.json @@ -50,7 +50,9 @@ "Configwindow_Param_UseOverlayWindow": "Display top overlay", "Configwindow_Param_UseOverlayWindowDesc": "This window is currently used to cue the body position in advance.", "Configwindow_Param_Basic": "Basic", - "Configwindow_Param_WeaponDelay": "Set the random interval between GCD (seconds)", + "Configwindow_Param_WeaponDelay": "Set the range of random delay for GCD in second.", + "Configwindow_Param_DeathDelay": "Set the range of random delay for raising deaths in second.", + "Configwindow_Param_HostileDelay": "Set the range of random delay for finding hostile targets in second.", "Configwindow_Param_WeaponFaster": "Set the time advance of use actions", "Configwindow_Param_WeaponInterval": "Set the interval between abilities using", "Configwindow_Param_InterruptibleTime": "Set the delay of interrupting", diff --git a/RotationSolver/Updaters/ActionUpdater.cs b/RotationSolver/Updaters/ActionUpdater.cs index 91c6c2002..94db4ae0f 100644 --- a/RotationSolver/Updaters/ActionUpdater.cs +++ b/RotationSolver/Updaters/ActionUpdater.cs @@ -169,8 +169,6 @@ private static void UPdateMPTimer() _lastMP = player.CurrentMp; } - static DateTime _lastWeaponGo = DateTime.MinValue; - static float _weaponRandomDelay = -1; internal static float _lastCastingTotal = 0; internal unsafe static void DoAction() { diff --git a/RotationSolver/Updaters/TargetUpdater_Friends.cs b/RotationSolver/Updaters/TargetUpdater_Friends.cs index 79e37eb8f..06ac7ed64 100644 --- a/RotationSolver/Updaters/TargetUpdater_Friends.cs +++ b/RotationSolver/Updaters/TargetUpdater_Friends.cs @@ -98,6 +98,12 @@ internal static partial class TargetUpdater /// internal static bool HPNotFull { get; private set; } = false; + static RandomDelay _deathAllDelay = new RandomDelay(() => DeathPeopleAll.Any(), + () => (Service.Configuration.DeathDelayMin, Service.Configuration.DeathDelayMax)); + + static RandomDelay _deathPartyDelay = new RandomDelay(() => DeathPeopleParty.Any(), + () => (Service.Configuration.DeathDelayMin, Service.Configuration.DeathDelayMax)); + internal unsafe static void UpdateFriends() { #region Friend @@ -122,9 +128,13 @@ internal unsafe static void UpdateFriends() PartyHealers = PartyMembers.GetObjectInRadius(30).GetJobCategory(JobRole.Healer); AllianceTanks = AllianceMembers.GetObjectInRadius(30).GetJobCategory(JobRole.Tank); + var lastDeathAll = DeathPeopleAll; + var lastDeathparty = DeathPeopleParty; DeathPeopleAll = AllianceMembers.GetDeath().GetObjectInRadius(30); DeathPeopleParty = PartyMembers.GetDeath().GetObjectInRadius(30); MaintainDeathPeople(); + if (!_deathAllDelay.Update()) HostileTargets = lastDeathAll; + if (!_deathPartyDelay.Update()) HostileTargets = lastDeathparty; WeakenPeople = TargetFilter.GetObjectInRadius(PartyMembers, 30).Where(p => { @@ -238,13 +248,6 @@ static float GetHealingOfTimeRatio(BattleChara target, params StatusID[] statusI } static SortedDictionary _locations = new SortedDictionary(); - - static RandomDelay _deathAllDelay = new RandomDelay(() => DeathPeopleAll.Any(), - () => (Service.Configuration.DeathDelayMin, Service.Configuration.DeathDelayMax)); - - static RandomDelay _deathPartyDelay = new RandomDelay(() => DeathPeopleParty.Any(), - () => (Service.Configuration.DeathDelayMin, Service.Configuration.DeathDelayMax)); - private static void MaintainDeathPeople() { SortedDictionary locs = new SortedDictionary(); @@ -260,9 +263,6 @@ private static void MaintainDeathPeople() DeathPeopleAll = FilterForDeath(DeathPeopleAll); DeathPeopleParty = FilterForDeath(DeathPeopleParty); - if (!_deathAllDelay.Update()) DeathPeopleAll = new BattleChara[0]; - if (!_deathPartyDelay.Update()) DeathPeopleParty = new BattleChara[0]; - _locations = locs; } diff --git a/RotationSolver/Updaters/TargetUpdater_Hostile.cs b/RotationSolver/Updaters/TargetUpdater_Hostile.cs index 0e0655d37..37d9bd544 100644 --- a/RotationSolver/Updaters/TargetUpdater_Hostile.cs +++ b/RotationSolver/Updaters/TargetUpdater_Hostile.cs @@ -82,6 +82,7 @@ internal unsafe static void UpdateHostileTargets() if (AllTargets != null) { + var lastHostile = HostileTargets; HostileTargets = CountDown.CountDownTime > 0 ? AllTargets : inFate > 0 ? AllTargets.Where(t => t.FateId() == inFate) : AllTargets.Where(t => (t.TargetObject is BattleChara || ids.Contains(t.ObjectId)) && t.FateId() == 0 @@ -103,7 +104,7 @@ internal unsafe static void UpdateHostileTargets() break; } - if (!_hostileDelay.Update()) HostileTargets = new BattleChara[0]; + if (!_hostileDelay.Update()) HostileTargets = lastHostile; CanInterruptTargets = HostileTargets.Where(tar => { diff --git a/RotationSolver/Windows/RotationConfigWindow_Param.cs b/RotationSolver/Windows/RotationConfigWindow_Param.cs index ef570862f..03b36b07d 100644 --- a/RotationSolver/Windows/RotationConfigWindow_Param.cs +++ b/RotationSolver/Windows/RotationConfigWindow_Param.cs @@ -384,7 +384,7 @@ private static void DrawCheckBox(string name, ref bool value, string description } } - private static void DrawRangedFloat(string name, ref float minValue, ref float maxValue, float speed = 0.002f, float min = 0, float max = 1, string description = "") + private static void DrawRangedFloat(string name, ref float minValue, ref float maxValue, float speed = 0.002f, float min = 0, float max = 3, string description = "") { ImGui.SetNextItemWidth(100); if (ImGui.DragFloatRange2(name, ref minValue, ref maxValue, speed, min, max))