diff options
author | megamage <none@none> | 2009-05-22 03:09:24 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-22 03:09:24 -0500 |
commit | 5888134e4dcf1cac3b877599c7c0700ff8001cda (patch) | |
tree | 8e9134b051c4b4390b24ffd17ebf32649f6519da | |
parent | 6e6d10e3e95643cb2adee2f6a83872a1c7fef1f8 (diff) |
*Fix a bug that owner cannot recall pet when pet is attacking target.
--HG--
branch : trunk
-rw-r--r-- | src/game/CreatureEventAI.cpp | 4 | ||||
-rw-r--r-- | src/game/PetAI.cpp | 18 |
2 files changed, 5 insertions, 17 deletions
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index cd6e58361e6..c2ae915c9a4 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -1014,10 +1014,6 @@ void CreatureEventAI::UpdateAI(const uint32 diff) //Check if we are in combat (also updates calls threat update code) bool Combat = UpdateVictim(); - //Must return if creature isn't alive. Normally select hostil target and get victim prevent this - if (!m_creature->isAlive()) - return; - if (!bEmptyList) { //Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index ae4441d7c6d..a5a3f28c92a 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -87,9 +87,6 @@ void PetAI::_stopAttack() void PetAI::UpdateAI(const uint32 diff) { - if (!m_creature->isAlive()) - return; - Unit* owner = m_creature->GetCharmerOrOwner(); if(m_updateAlliesTimer <= diff) @@ -110,17 +107,12 @@ void PetAI::UpdateAI(const uint32 diff) DoMeleeAttackIfReady(); } - else + else if(owner && m_creature->GetCharmInfo()) //no victim { - if(me->isInCombat()) - _stopAttack(); - else if(owner && m_creature->GetCharmInfo()) //no victim - { - if(owner->isInCombat() && !(m_creature->HasReactState(REACT_PASSIVE) || m_creature->GetCharmInfo()->HasCommandState(COMMAND_STAY))) - AttackStart(owner->getAttackerForHelper()); - else if(m_creature->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW) && !m_creature->hasUnitState(UNIT_STAT_FOLLOW)) - m_creature->GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE); - } + if(owner->isInCombat() && !(m_creature->HasReactState(REACT_PASSIVE) || m_creature->GetCharmInfo()->HasCommandState(COMMAND_STAY))) + AttackStart(owner->getAttackerForHelper()); + else if(m_creature->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW) && !m_creature->hasUnitState(UNIT_STAT_FOLLOW)) + m_creature->GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE); } if(!me->GetCharmInfo()) |