Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[335] Pets drop target after every pet spell cast #16824

Closed
MrSmite opened this issue Mar 23, 2016 · 4 comments
Closed

[335] Pets drop target after every pet spell cast #16824

MrSmite opened this issue Mar 23, 2016 · 4 comments

Comments

@MrSmite
Copy link
Contributor

MrSmite commented Mar 23, 2016

Description:

Pets drop their target whenever they autocast a spell and reacquire it on next attack. This makes /assist macros buggy.

Current behaviour:

When you send your pet to attack, you will see a targeting ring on the mob's feet. When the pet casts, for example, claw, the pet will lose the target and on its next attack the targeting ring will appear again. During this "downtime", /assist macros fail becaus the pet has no target.

Expected behaviour:

Pets should not lose targets after every attack.

Steps to reproduce the problem:

  1. Create the following macro and put it on your hotbar: /assist pet
  2. Open the "interface" options and make sure "Attack on assist" and "Autoswitch attack / autoshot" are checked
  3. Create a hunter and get any pet
  4. Find a target of appropriate level so it or the pet doesn't die too quickly
  5. Stay at max shooting range and send the pet to attack. Notice the selection ring that appears
  6. Deselect the target and click the macro while the pet is running to it, notice you begin shooting immediately
  7. Deselect the target and watch the pet fight. Notice after each autocast the selection ring will flicker to indicate the pet is dropping / selecting the target again.
  8. Click the macro and notice it is less responsive in selecting and attacking your pet's target

Branch(es): 335
TC hash/commit: cebdf03
TDB version: TDB_full_world_335.60_2015_11_07.sql
Operating system: Windows XP and Windows 7

@nawuko
Copy link
Contributor

nawuko commented Mar 23, 2016

This is maybe releated to #15641

This line got changed which might be the problem: https://github.com/TrinityCore/TrinityCore/pull/15641/files#diff-f3f953a63e2a008d22de69cb68f735c4R2787

I'm not 100% sure but i will run some tests and post back :)

@nawuko
Copy link
Contributor

nawuko commented Mar 23, 2016

Okay yea it was really that change.

The following fixes the problem:

diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 1f7dae4..893d33a 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -2872,7 +2872,10 @@ void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay)
     if (focusSpell && focusSpell != _focusSpell)
         return;

-    SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty);
+    if (Unit* victim = GetVictim())
+        SetGuidValue(UNIT_FIELD_TARGET, victim->GetGUID());
+    else
+        SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty);

     if (_focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST))
         ClearUnitState(UNIT_STATE_CANNOT_TURN);

Let me summon @Treeston Maybe he can explain why this was changed. And if it is okay to revert this line without changing/breaking something else.

@Treeston
Copy link
Member

If you re-target right away facing (and spell anim) will snap back to that target immediately (Ingvar etc). that's what the retargeting delay code prevents.

Delay behavior shouldn't apply to pets though, that's the bug here. Let me test & push a fix.

@MrSmite
Copy link
Contributor Author

MrSmite commented Mar 23, 2016

Thanks @nawuko @Treeston, I had just finished compiling a debug build to try and track it down.

P-Kito pushed a commit to P-Kito/TrinityCore that referenced this issue Mar 27, 2016
Shauren pushed a commit that referenced this issue Apr 9, 2016
… after spell cast. Closes #16824.

(cherry picked from commit accad00)
Aokromes pushed a commit to Aokromes/TrinityCore that referenced this issue May 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants