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

Commit

Permalink
fix: the mob targeting your campanion will be your hostile target.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 25, 2023
1 parent a0ea03b commit 3136a80
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 35 deletions.
6 changes: 3 additions & 3 deletions RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ internal static unsafe void DoAnAction(bool isGCD)
//Do Action
var nextAction = ActionUpdater.NextAction;
#if DEBUG
//if(nextAction is BaseAction acti)
//Service.ChatGui.Print($"Will Do {acti} {ActionUpdater.WeaponElapsed}");
if (nextAction is BaseAction acti)
Service.ChatGui.Print($"Will Do {acti} {ActionUpdater.WeaponElapsed}");
#endif
if (nextAction == null) return;
if (!isGCD && nextAction is BaseAction act1 && act1.IsRealGCD) return;
Expand All @@ -40,7 +40,7 @@ internal static unsafe void DoAnAction(bool isGCD)
if (nextAction is BaseAction act)
{
#if DEBUG
//Service.ChatGui.Print($"{act}, {act.Target.Name}, {ActionUpdater.AbilityRemainCount}, {ActionUpdater.WeaponElapsed}");
Service.ChatGui.Print($"{act}, {act.Target.Name}, {ActionUpdater.AbilityRemainCount}, {ActionUpdater.WeaponElapsed}");
#endif
//Change Target
if ((Service.TargetManager.Target?.IsNPCEnemy() ?? true)
Expand Down
5 changes: 2 additions & 3 deletions RotationSolver/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ public class PluginConfiguration : IPluginConfiguration
public float HostileDelayMin = 0;
public float HostileDelayMax = 0;

public float HealDelayMin = 0.5f;
public float HealDelayMax = 1;

public float HealDelayMin = 0;
public float HealDelayMax = 0;
public float StopCastingDelayMin = 0.5f;
public float StopCastingDelayMax = 1;

Expand Down
12 changes: 10 additions & 2 deletions RotationSolver/Rotations/Basic/BLU_Base.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using RotationSolver.Actions;
using RotationSolver.Actions.BaseAction;
using RotationSolver.Commands;
using RotationSolver.Configuration.RotationConfig;
using RotationSolver.Data;
using RotationSolver.Helpers;
Expand Down Expand Up @@ -764,13 +765,22 @@ private protected override bool MoveForwardGCD(out IAction act)

private protected override bool EmergencyGCD(out IAction act)
{
if (BlueId == BLUID.Healer)
{
//有某些非常危险的状态。
if (RSCommands.SpecialType == SpecialCommandType.EsunaStanceNorth && TargetUpdater.WeakenPeople.Any() || TargetUpdater.DyingPeople.Any())
{
if (Exuviation.CanUse(out act, mustUse: true)) return true;
}
}
if (AetherialMimicry.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);
}

Expand Down Expand Up @@ -813,8 +823,6 @@ private protected override bool HealAreaGCD(out IAction act)
{
if (BlueId == BLUID.Healer)
{
//if (Exuviation.CanUse(out act, mustUse: true)) return true;

if (AngelsSnack.CanUse(out act)) return true;
if (Stotram.CanUse(out act)) return true;
if (Stotram.CanUse(out act)) return true;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ internal unsafe static void DoAction()
|| Service.Conditions[ConditionFlag.BetweenAreas]
|| Service.Conditions[ConditionFlag.BetweenAreas51]
|| Service.Conditions[ConditionFlag.Mounted]
|| Service.Conditions[ConditionFlag.SufferingStatusAffliction]
//|| Service.Conditions[ConditionFlag.SufferingStatusAffliction] //Because of BLU30!
|| Service.Conditions[ConditionFlag.SufferingStatusAffliction2]
|| Service.Conditions[ConditionFlag.RolePlaying]
|| Service.Conditions[ConditionFlag.InFlight]
Expand Down
42 changes: 21 additions & 21 deletions RotationSolver/Updaters/MajorUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@ internal static class MajorUpdater
{
private static bool IsValid => Service.Conditions.Any() && Service.ClientState.LocalPlayer != null;

//#if DEBUG
// private static readonly Dictionary<int, bool> _valus = new Dictionary<int, bool>();
//#endif
#if DEBUG
private static readonly Dictionary<int, bool> _valus = new Dictionary<int, bool>();
#endif
private static void FrameworkUpdate(Framework framework)
{
if (!IsValid) return;

//#if DEBUG
// //Get changed condition.
// string[] enumNames = Enum.GetNames(typeof(Dalamud.Game.ClientState.Conditions.ConditionFlag));
// int[] indexs = (int[])Enum.GetValues(typeof(Dalamud.Game.ClientState.Conditions.ConditionFlag));
// if (enumNames.Length == indexs.Length)
// {
// for (int i = 0; i < enumNames.Length; i++)
// {
// string key = enumNames[i];
// bool newValue = Service.Conditions[(Dalamud.Game.ClientState.Conditions.ConditionFlag)indexs[i]];
// if (_valus.ContainsKey(i) && _valus[i] != newValue && indexs[i] != 48 && indexs[i] != 27)
// {
// Service.ToastGui.ShowQuest(indexs[i].ToString() + " " + key + ": " + newValue.ToString());
// }
// _valus[i] = newValue;
// }
// }
//#endif
#if DEBUG
//Get changed condition.
string[] enumNames = Enum.GetNames(typeof(Dalamud.Game.ClientState.Conditions.ConditionFlag));
int[] indexs = (int[])Enum.GetValues(typeof(Dalamud.Game.ClientState.Conditions.ConditionFlag));
if (enumNames.Length == indexs.Length)
{
for (int i = 0; i < enumNames.Length; i++)
{
string key = enumNames[i];
bool newValue = Service.Conditions[(Dalamud.Game.ClientState.Conditions.ConditionFlag)indexs[i]];
if (_valus.ContainsKey(i) && _valus[i] != newValue && indexs[i] != 48 && indexs[i] != 27)
{
Service.ToastGui.ShowQuest(indexs[i].ToString() + " " + key + ": " + newValue.ToString());
}
_valus[i] = newValue;
}
}
#endif

if (!Service.Configuration.UseWorkTask)
{
Expand Down
6 changes: 2 additions & 4 deletions RotationSolver/Updaters/SocialUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ internal class SocialUpdater

public static bool CanSaying { get; set; } = false;

static RandomDelay _canSocial = new RandomDelay(() => (3, 5));
static bool CanSocial
{
get
Expand Down Expand Up @@ -81,12 +82,9 @@ internal static void Disable()
internal static async void UpdateSocial()
{
if (ActionUpdater.InCombat) return;
if (CanSaying && CanSocial)
if (_canSocial.Delay(CanSaying && CanSocial))
{
CanSaying = false;

await Task.Delay(new Random().Next(3000, 5000));

#if DEBUG
Service.ChatGui.PrintError("Macro now.");
#endif
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/Updaters/TargetUpdater_Hostile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ private static IEnumerable<BattleChara> GetHostileTargets(IEnumerable<BattleChar
var hostiles = allattackableTargets.Where(t =>
{
if (ids.Contains(t.ObjectId)) return true;
if (t.TargetObject == Service.ClientState.LocalPlayer) return true;
if (t.TargetObject == Service.ClientState.LocalPlayer
|| t.TargetObject?.OwnerId == Service.ClientState.LocalPlayer.ObjectId) return true;

//Remove other's treasure.
if (t.IsOthersPlayers()) return false;
Expand Down

0 comments on commit 3136a80

Please sign in to comment.