diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/PetAI.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index af9c7e60457..d70b0c1be1f 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -115,8 +115,6 @@ void PetAI::UpdateAI(const uint32 diff) if(!me->GetCharmInfo()) return; - bool inCombat = me->getVictim(); - // Autocast (casted only in combat or persistent spells in any state) if (m_creature->GetGlobalCooldown() == 0 && !m_creature->hasUnitState(UNIT_STAT_CASTING)) { @@ -134,7 +132,7 @@ void PetAI::UpdateAI(const uint32 diff) continue; // ignore some combinations of combat state and combat/noncombat spells - if (!inCombat) + if (!me->getVictim()) { // ignore attacking spells, and allow only self/around spells if (!IsPositiveSpell(spellInfo->Id)) @@ -166,7 +164,7 @@ void PetAI::UpdateAI(const uint32 diff) Spell *spell = new Spell(m_creature, spellInfo, false, 0); // Fix to allow pets on STAY to autocast - if (inCombat && _CanAttack(me->getVictim()) && spell->CanAutoCast(me->getVictim())) + if (me->getVictim() && _CanAttack(me->getVictim()) && spell->CanAutoCast(me->getVictim())) { targetSpellStore.push_back(std::make_pair<Unit*, Spell*>(m_creature->getVictim(), spell)); continue; |