aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/AI/CoreAI/PetAI.cpp16
-rwxr-xr-xsrc/server/game/AI/CoreAI/PetAI.h2
-rw-r--r--src/server/scripts/World/npcs_special.cpp2
3 files changed, 14 insertions, 6 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 99cf1cda4fc..6802c109401 100755
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -71,6 +71,8 @@ void PetAI::_stopAttack()
}
me->AttackStop();
+ me->InterruptNonMeleeSpells(false);
+ me->SendMeleeAttackStop(); // Should stop pet's attack button from flashing
me->GetCharmInfo()->SetIsCommandAttack(false);
HandleReturnMovement();
}
@@ -89,7 +91,8 @@ void PetAI::UpdateAI(const uint32 diff)
m_updateAlliesTimer -= diff;
// me->getVictim() can't be used for check in case stop fighting, me->getVictim() clear at Unit death etc.
- if (me->getVictim())
+ // Must also check if victim is alive
+ if (me->getVictim() && me->getVictim()->isAlive())
{
// is only necessary to stop casting, the pet must not exit combat
if (me->getVictim()->HasBreakableByDamageCrowdControlAura(me))
@@ -121,10 +124,16 @@ void PetAI::UpdateAI(const uint32 diff)
if (nextTarget)
AttackStart(nextTarget);
else
+ {
+ me->GetCharmInfo()->SetIsCommandAttack(false);
HandleReturnMovement();
+ }
}
else
+ {
+ me->GetCharmInfo()->SetIsCommandAttack(false);
HandleReturnMovement();
+ }
}
else if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW)) // no charm info and no victim
HandleReturnMovement();
@@ -301,7 +310,7 @@ void PetAI::KilledUnit(Unit* victim)
// Can't use _stopAttack() because that activates movement handlers and ignores
// next target selection
me->AttackStop();
- me->GetCharmInfo()->SetIsCommandAttack(false);
+ me->InterruptNonMeleeSpells(false);
me->SendMeleeAttackStop(); // Stops the pet's 'Attack' button from flashing
Unit* nextTarget = SelectNextTarget();
@@ -309,7 +318,10 @@ void PetAI::KilledUnit(Unit* victim)
if (nextTarget)
AttackStart(nextTarget);
else
+ {
+ me->GetCharmInfo()->SetIsCommandAttack(false);
HandleReturnMovement(); // Return
+ }
}
void PetAI::AttackStart(Unit* target)
diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h
index 8e5311fa000..d7f1dca3fbf 100755
--- a/src/server/game/AI/CoreAI/PetAI.h
+++ b/src/server/game/AI/CoreAI/PetAI.h
@@ -32,8 +32,6 @@ class PetAI : public CreatureAI
explicit PetAI(Creature* c);
void EnterEvadeMode();
- void JustDied(Unit* /*who*/) { _stopAttack(); }
-
void UpdateAI(const uint32);
static int Permissible(const Creature*);
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 9ade37a1096..b8df77d0346 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -2121,8 +2121,6 @@ class npc_shadowfiend : public CreatureScript
if (Unit* owner = me->ToTempSummon()->GetSummoner())
if (owner->HasAura(GLYPH_OF_SHADOWFIEND))
owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true);
-
- PetAI::JustDied(killer);
}
};