mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[7104] Fixed creatures are not attacking with taunt aura.
Improved target selection if more taunt auras are on target. Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
parent
383239b595
commit
125416d242
2 changed files with 31 additions and 5 deletions
|
|
@ -9255,20 +9255,46 @@ bool Unit::SelectHostilTarget()
|
||||||
//threat list sorting etc.
|
//threat list sorting etc.
|
||||||
|
|
||||||
assert(GetTypeId()== TYPEID_UNIT);
|
assert(GetTypeId()== TYPEID_UNIT);
|
||||||
Unit* target = NULL;
|
|
||||||
|
|
||||||
//This function only useful once AI has been initialized
|
//This function only useful once AI has been initialized
|
||||||
if (!((Creature*)this)->AI())
|
if (!((Creature*)this)->AI())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!m_ThreatManager.isThreatListEmpty())
|
Unit* target = NULL;
|
||||||
|
|
||||||
|
// First checking if we have some taunt on us
|
||||||
|
const AuraList& tauntAuras = GetAurasByType(SPELL_AURA_MOD_TAUNT);
|
||||||
|
if ( !tauntAuras.empty() )
|
||||||
{
|
{
|
||||||
if(!HasAuraType(SPELL_AURA_MOD_TAUNT))
|
Unit* caster;
|
||||||
|
|
||||||
|
// The last taunt aura caster is alive an we are happy to attack him
|
||||||
|
if ( (caster = tauntAuras.back()->GetCaster()) && caster->isAlive() )
|
||||||
|
return true;
|
||||||
|
else if (tauntAuras.size() > 1)
|
||||||
{
|
{
|
||||||
target = m_ThreatManager.getHostilTarget();
|
// We do not have last taunt aura caster but we have more taunt auras,
|
||||||
|
// so find first available target
|
||||||
|
|
||||||
|
// Auras are pushed_back, last caster will be on the end
|
||||||
|
AuraList::const_iterator aura = --tauntAuras.end();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
--aura;
|
||||||
|
if ( (caster = (*aura)->GetCaster()) &&
|
||||||
|
caster->IsInMap(this) && caster->isTargetableForAttack() && caster->isInAccessablePlaceFor(this) )
|
||||||
|
{
|
||||||
|
target = caster;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}while (aura != tauntAuras.begin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !target && !m_ThreatManager.isThreatListEmpty() )
|
||||||
|
// No taunt aura or taunt aura caster is dead standart target selection
|
||||||
|
target = m_ThreatManager.getHostilTarget();
|
||||||
|
|
||||||
if(target)
|
if(target)
|
||||||
{
|
{
|
||||||
if(!hasUnitState(UNIT_STAT_STUNNED))
|
if(!hasUnitState(UNIT_STAT_STUNNED))
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7103"
|
#define REVISION_NR "7104"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue