*Fix a bug that owner cannot recall pet when pet is attacking target.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-22 03:09:24 -05:00
parent 6e6d10e3e9
commit 5888134e4d
2 changed files with 5 additions and 17 deletions
-4
View File
@@ -1014,10 +1014,6 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
//Check if we are in combat (also updates calls threat update code) //Check if we are in combat (also updates calls threat update code)
bool Combat = UpdateVictim(); 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) if (!bEmptyList)
{ {
//Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events //Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events
+5 -13
View File
@@ -87,9 +87,6 @@ void PetAI::_stopAttack()
void PetAI::UpdateAI(const uint32 diff) void PetAI::UpdateAI(const uint32 diff)
{ {
if (!m_creature->isAlive())
return;
Unit* owner = m_creature->GetCharmerOrOwner(); Unit* owner = m_creature->GetCharmerOrOwner();
if(m_updateAlliesTimer <= diff) if(m_updateAlliesTimer <= diff)
@@ -110,17 +107,12 @@ void PetAI::UpdateAI(const uint32 diff)
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
else else if(owner && m_creature->GetCharmInfo()) //no victim
{ {
if(me->isInCombat()) if(owner->isInCombat() && !(m_creature->HasReactState(REACT_PASSIVE) || m_creature->GetCharmInfo()->HasCommandState(COMMAND_STAY)))
_stopAttack(); AttackStart(owner->getAttackerForHelper());
else if(owner && m_creature->GetCharmInfo()) //no victim 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()) if(!me->GetCharmInfo())