diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e933d29ae..4fb8ff6b0 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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); diff --git a/src/game/Unit.h b/src/game/Unit.h index 633700600..2cdd76892 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -850,7 +850,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject } bool Attack(Unit *victim, bool meleeAttack); void CastStop(uint32 except_spellid = 0); - bool AttackStop(); + bool AttackStop(bool targetSwitch = false); void RemoveAllAttackers(); AttackerSet const& getAttackers() const { return m_attackers; } bool isAttackingPlayer() const; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index be55dc98e..e13fce7d4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7457" + #define REVISION_NR "7458" #endif // __REVISION_NR_H__