[6987] Implemented aura dependent creature target prioritization more correctly

This commit is contained in:
arrai 2008-12-30 19:16:08 +01:00
parent 2b7004a0ab
commit 9a411858d0
4 changed files with 13 additions and 2 deletions

View file

@ -278,7 +278,7 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe
// some units are prefered in comparison to others // some units are prefered in comparison to others
if(iter != lastRef && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask(), false) || if(iter != lastRef && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask(), false) ||
target->hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING) target->hasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_DAMAGE)
) ) ) )
{ {
// current victim is a second choice target, so don't compare threat with it below // current victim is a second choice target, so don't compare threat with it below

View file

@ -10279,6 +10279,16 @@ Unit* Unit::SelectNearbyTarget() const
return *tcIter; return *tcIter;
} }
bool Unit::hasNegativeAuraWithInterruptFlag(uint32 flag)
{
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ++iter)
{
if (!iter->second->IsPositive() && iter->second->GetSpellProto()->AuraInterruptFlags & flag)
return true;
}
return false;
}
void Unit::ApplyAttackTimePercentMod( WeaponAttackType att,float val, bool apply ) void Unit::ApplyAttackTimePercentMod( WeaponAttackType att,float val, bool apply )
{ {
if(val > 0) if(val > 0)

View file

@ -824,6 +824,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void CombatStop(bool cast = false); void CombatStop(bool cast = false);
void CombatStopWithPets(bool cast = false); void CombatStopWithPets(bool cast = false);
Unit* SelectNearbyTarget() const; Unit* SelectNearbyTarget() const;
bool hasNegativeAuraWithInterruptFlag(uint32 flag);
void addUnitState(uint32 f) { m_state |= f; } void addUnitState(uint32 f) { m_state |= f; }
bool hasUnitState(const uint32 f) const { return (m_state & f); } bool hasUnitState(const uint32 f) const { return (m_state & f); }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "6986" #define REVISION_NR "6987"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__