[7458] Not reset/set some data at attack target switch that expected do at any target lost.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
=Neo2003 2009-03-14 23:14:11 +03:00 committed by VladimirMangos
parent 74006886e9
commit 9b1216f21c
3 changed files with 16 additions and 12 deletions

View file

@ -7132,6 +7132,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
if(HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
RemoveSpellsCausingAura(SPELL_AURA_MOD_UNATTACKABLE);
// in fighting already
if (m_attacking)
{
if (m_attacking == victim)
@ -7145,7 +7146,16 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
}
return false;
}
AttackStop();
// remove old target data
AttackStop(true);
}
// new battle
else
{
// set position before any AI calls/assistance
if(GetTypeId()==TYPEID_UNIT)
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
}
//Set our target
@ -7154,10 +7164,6 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
if(meleeAttack)
addUnitState(UNIT_STAT_MELEE_ATTACKING);
// set position before any AI calls/assistance
if(GetTypeId()==TYPEID_UNIT)
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
m_attacking = victim;
m_attacking->_addAttacker(this);
@ -7184,7 +7190,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
return true;
}
bool Unit::AttackStop()
bool Unit::AttackStop(bool targetSwitch /*=false*/)
{
if (!m_attacking)
return false;
@ -7201,11 +7207,9 @@ bool Unit::AttackStop()
InterruptSpell(CURRENT_MELEE_SPELL);
if( GetTypeId()==TYPEID_UNIT )
{
// reset call assistance
// reset only at real combat stop
if(!targetSwitch && GetTypeId()==TYPEID_UNIT )
((Creature*)this)->SetNoCallAssistance(false);
}
SendAttackStop(victim);