From 60e73dfa2c399693fef1f58a7f5b20c589556ca5 Mon Sep 17 00:00:00 2001 From: Aneesh Dogra Date: Tue, 3 Dec 2024 00:38:37 +0100 Subject: [PATCH 1/2] Update combat to change target when its dead Sometimes the bot can get stuck on a dead target and get beaten by another mob that got pulled. Right now the plan switches to NO PLAN as the combat doesn't happen if the target is dead. This makes sure that if we are in combat and target is dead we clear target and change to the next target nearby. Especially useful if the bot pulled multiple mobs --- Core/Goals/CombatGoal.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Core/Goals/CombatGoal.cs b/Core/Goals/CombatGoal.cs index 5d37fd34..99a9e687 100644 --- a/Core/Goals/CombatGoal.cs +++ b/Core/Goals/CombatGoal.cs @@ -48,7 +48,7 @@ public CombatGoal(ILogger logger, ConfigurableInput input, AddPrecondition(GoapKey.incombat, true); AddPrecondition(GoapKey.hastarget, true); - AddPrecondition(GoapKey.targetisalive, true); + //AddPrecondition(GoapKey.targetisalive, true); AddPrecondition(GoapKey.targethostile, true); //AddPrecondition(GoapKey.targettargetsus, true); AddPrecondition(GoapKey.incombatrange, true); @@ -106,7 +106,12 @@ public override void OnExit() public override void Update() { wait.Update(); - + if (bits.Target_Dead()) + { + // sometimes the combat can be stuck on a dead target + input.PressClearTarget(); + FindNewTarget(); + } if (MathF.Abs(lastDirection - playerReader.Direction) > MathF.PI / 2) { logger.LogInformation("Turning too fast!"); @@ -125,6 +130,7 @@ public override void Update() if (bits.Target()) { + if (bits.TargetDead()) { if (classConfig.AutoPetAttack && bits.Pet() && (!playerReader.PetTarget() || playerReader.PetTargetGuid != playerReader.TargetGuid) && @@ -216,4 +222,4 @@ private Vector3 GetCorpseLocation(float distance) { return PointEstimator.GetPoint(playerReader.MapPos, playerReader.Direction, distance); } -} \ No newline at end of file +} From 9b2ca56f2e027271f3233f3ce5777b3edce4a42b Mon Sep 17 00:00:00 2001 From: Aneesh Dogra Date: Tue, 3 Dec 2024 00:55:38 +0100 Subject: [PATCH 2/2] Update the comment and dont find new target yet --- Core/Goals/CombatGoal.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Goals/CombatGoal.cs b/Core/Goals/CombatGoal.cs index 99a9e687..ea18b1f2 100644 --- a/Core/Goals/CombatGoal.cs +++ b/Core/Goals/CombatGoal.cs @@ -109,8 +109,8 @@ public override void Update() if (bits.Target_Dead()) { // sometimes the combat can be stuck on a dead target + // clear target and move on input.PressClearTarget(); - FindNewTarget(); } if (MathF.Abs(lastDirection - playerReader.Direction) > MathF.PI / 2) {