mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[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:
parent
74006886e9
commit
9b1216f21c
3 changed files with 16 additions and 12 deletions
|
|
@ -7132,6 +7132,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||||
if(HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
|
if(HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
|
||||||
RemoveSpellsCausingAura(SPELL_AURA_MOD_UNATTACKABLE);
|
RemoveSpellsCausingAura(SPELL_AURA_MOD_UNATTACKABLE);
|
||||||
|
|
||||||
|
// in fighting already
|
||||||
if (m_attacking)
|
if (m_attacking)
|
||||||
{
|
{
|
||||||
if (m_attacking == victim)
|
if (m_attacking == victim)
|
||||||
|
|
@ -7145,7 +7146,16 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||||
}
|
}
|
||||||
return false;
|
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
|
//Set our target
|
||||||
|
|
@ -7154,10 +7164,6 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||||
if(meleeAttack)
|
if(meleeAttack)
|
||||||
addUnitState(UNIT_STAT_MELEE_ATTACKING);
|
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 = victim;
|
||||||
m_attacking->_addAttacker(this);
|
m_attacking->_addAttacker(this);
|
||||||
|
|
||||||
|
|
@ -7184,7 +7190,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::AttackStop()
|
bool Unit::AttackStop(bool targetSwitch /*=false*/)
|
||||||
{
|
{
|
||||||
if (!m_attacking)
|
if (!m_attacking)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -7201,11 +7207,9 @@ bool Unit::AttackStop()
|
||||||
|
|
||||||
InterruptSpell(CURRENT_MELEE_SPELL);
|
InterruptSpell(CURRENT_MELEE_SPELL);
|
||||||
|
|
||||||
if( GetTypeId()==TYPEID_UNIT )
|
// reset only at real combat stop
|
||||||
{
|
if(!targetSwitch && GetTypeId()==TYPEID_UNIT )
|
||||||
// reset call assistance
|
|
||||||
((Creature*)this)->SetNoCallAssistance(false);
|
((Creature*)this)->SetNoCallAssistance(false);
|
||||||
}
|
|
||||||
|
|
||||||
SendAttackStop(victim);
|
SendAttackStop(victim);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -850,7 +850,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
}
|
}
|
||||||
bool Attack(Unit *victim, bool meleeAttack);
|
bool Attack(Unit *victim, bool meleeAttack);
|
||||||
void CastStop(uint32 except_spellid = 0);
|
void CastStop(uint32 except_spellid = 0);
|
||||||
bool AttackStop();
|
bool AttackStop(bool targetSwitch = false);
|
||||||
void RemoveAllAttackers();
|
void RemoveAllAttackers();
|
||||||
AttackerSet const& getAttackers() const { return m_attackers; }
|
AttackerSet const& getAttackers() const { return m_attackers; }
|
||||||
bool isAttackingPlayer() const;
|
bool isAttackingPlayer() const;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7457"
|
#define REVISION_NR "7458"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue