diff options
author | treeston <treeston.mmoc@gmail.com> | 2016-03-23 16:22:05 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2016-04-09 17:28:11 +0200 |
commit | d5ec4ce97bc6a6c3c29faa22ba081a755c6999f6 (patch) | |
tree | cee12268d941ed625f079b81f0d4c7196bfd36b7 | |
parent | a4064918846aa5a6ff5ef7743c372cab03447eb4 (diff) |
Entities/Creature: Fix bugs with pets not properly reacquiring target after spell cast. Closes #16824.
(cherry picked from commit accad00567f96b9c8173d680034953a54bdb6462)
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index b376c256246..484880f95b0 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2729,7 +2729,9 @@ bool Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) } // tell the creature that it should reacquire its current target after the cast is done (this is handled in ::Attack) - MustReacquireTarget(); + // player pets don't need to do this, as they automatically reacquire their target on focus release + if (!IsPet()) + MustReacquireTarget(); bool canTurnDuringCast = !focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST); // Face the target - we need to do this before the unit state is modified for no-turn spells @@ -2779,13 +2781,16 @@ void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay) if (focusSpell && focusSpell != _focusSpell) return; - SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty); + if (IsPet() && GetVictim()) // player pets do not use delay system + SetGuidValue(UNIT_FIELD_TARGET, EnsureVictim()->GetGUID()); + else + SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty); if (_focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST)) ClearUnitState(UNIT_STATE_CANNOT_TURN); _focusSpell = nullptr; - _focusDelay = withDelay ? getMSTime() : 0; // don't allow re-target right away to prevent visual bugs + _focusDelay = (!IsPet() && withDelay) ? getMSTime() : 0; // don't allow re-target right away to prevent visual bugs } void Creature::StartPickPocketRefillTimer() |