Fix pet/guardian and other types of minion pet attack on targets with Crowd Controls.

This commit is contained in:
Giuseppe Montesanto
2012-02-04 14:59:17 +01:00
parent 1ca8c63e4c
commit 14bc551862
6 changed files with 42 additions and 21 deletions
+18
View File
@@ -516,6 +516,24 @@ bool Unit::HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint
return false;
}
bool Unit::HasBreakableByDamageAuraType(AuraType type) const
{
AuraEffectList const& auras = GetAuraEffectsByType(type);
for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
if ((*itr)->GetSpellInfo()->Attributes & SPELL_ATTR0_BREAKABLE_BY_DAMAGE || (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_TAKE_DAMAGE)
return true;
return false;
}
bool Unit::HasBreakableByDamageCrowdControlAura() const
{
return ( HasBreakableByDamageAuraType(SPELL_AURA_MOD_CONFUSE)
|| HasBreakableByDamageAuraType(SPELL_AURA_MOD_FEAR)
|| HasBreakableByDamageAuraType(SPELL_AURA_MOD_STUN)
|| HasBreakableByDamageAuraType(SPELL_AURA_MOD_ROOT)
|| HasBreakableByDamageAuraType(SPELL_AURA_TRANSFORM));
}
void Unit::DealDamageMods(Unit* victim, uint32 &damage, uint32* absorb)
{
if (!victim || !victim->isAlive() || victim->HasUnitState(UNIT_STATE_IN_FLIGHT) || (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode()))
+2
View File
@@ -1536,6 +1536,8 @@ class Unit : public WorldObject
bool HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint32 familyFlags) const;
bool virtual HasSpell(uint32 /*spellID*/) const { return false; }
bool HasBreakableByDamageAuraType(AuraType type) const;
bool HasBreakableByDamageCrowdControlAura() const;
bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }
bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); }