Merge pull request #5075 from devilcoredev/fix_004

Core/AI: Fix pet and other types of minion pet attack on targets with Crowd Controls.
This commit is contained in:
QAston
2012-02-05 00:13:56 -08:00
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
@@ -1555,6 +1555,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); }