From d6df5cb2a2c6b1b736cca7b335e31fb647cfe8ec Mon Sep 17 00:00:00 2001 From: Xian55 <367101+Xian55@users.noreply.github.com> Date: Thu, 9 Jan 2025 12:04:18 +0100 Subject: [PATCH] Core: BlacklistTargetGoal: After detecting a possible blacklisted target and pressing the clear target button be sure to wait one update so other Goals would not attempt to go with former state of the game. --- Core/AddonComponent/AddonBits.cs | 1 + Core/Goals/BlacklistTargetGoal.cs | 10 +++++++--- Core/Goals/PullTargetGoal.cs | 4 +--- Core/GoalsComponent/ReactCastError.cs | 5 +---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Core/AddonComponent/AddonBits.cs b/Core/AddonComponent/AddonBits.cs index 5e24d314..5c096aa3 100644 --- a/Core/AddonComponent/AddonBits.cs +++ b/Core/AddonComponent/AddonBits.cs @@ -82,6 +82,7 @@ public void Update(IAddonDataProvider reader) public bool Grounded() => !Flying() && !Falling(); + public bool Any_AutoAttack() => AutoShot() || Auto_Attack() || Shoot(); // -- value3 based flags public bool SoftInteract() => v3[Mask._0]; diff --git a/Core/Goals/BlacklistTargetGoal.cs b/Core/Goals/BlacklistTargetGoal.cs index 90b502da..42ed1d1b 100644 --- a/Core/Goals/BlacklistTargetGoal.cs +++ b/Core/Goals/BlacklistTargetGoal.cs @@ -7,11 +7,12 @@ public sealed class BlacklistTargetGoal : GoapGoal private readonly PlayerReader playerReader; private readonly AddonBits bits; private readonly ConfigurableInput input; + private readonly Wait wait; private readonly IBlacklist targetBlacklist; public BlacklistTargetGoal(PlayerReader playerReader, AddonBits bits, - ConfigurableInput input, IBlacklist blacklist) + ConfigurableInput input, IBlacklist blacklist, Wait wait) : base(nameof(BlacklistTargetGoal)) { this.playerReader = playerReader; @@ -19,6 +20,7 @@ public BlacklistTargetGoal(PlayerReader playerReader, this.input = input; this.targetBlacklist = blacklist; this.bits = bits; + this.wait = wait; } public override bool CanRun() @@ -30,10 +32,12 @@ public override void OnEnter() { if (playerReader.PetTarget() || playerReader.IsCasting() || - bits.Auto_Attack() || bits.AutoShot() || - bits.Shoot()) + bits.Any_AutoAttack()) + { input.PressStopAttack(); + } input.PressClearTarget(); + wait.Update(); } } diff --git a/Core/Goals/PullTargetGoal.cs b/Core/Goals/PullTargetGoal.cs index 007b6f95..682476b5 100644 --- a/Core/Goals/PullTargetGoal.cs +++ b/Core/Goals/PullTargetGoal.cs @@ -188,9 +188,7 @@ public override void Update() } else if (PullPrevention() && (playerReader.IsCasting() || - bits.Auto_Attack() || - bits.AutoShot() || - bits.Shoot())) + bits.Any_AutoAttack())) { Log("Preventing pulling possible tagged target!"); input.PressStopAttack(); diff --git a/Core/GoalsComponent/ReactCastError.cs b/Core/GoalsComponent/ReactCastError.cs index a8554f23..e3dec753 100644 --- a/Core/GoalsComponent/ReactCastError.cs +++ b/Core/GoalsComponent/ReactCastError.cs @@ -163,10 +163,7 @@ static void MinRangeChanges(int duration, Wait wait, break; case UI_ERROR.ERR_BADATTACKFACING: - bool wasAnyAuto = - bits.AutoShot() || - bits.Auto_Attack() || - bits.Shoot(); + bool wasAnyAuto = bits.Any_AutoAttack(); float beforeDir = playerReader.Direction;