Fix a bug introdouced in recent commit.

This commit is contained in:
Giuseppe Montesanto
2012-02-05 21:22:01 +01:00
parent 5019e9d353
commit 9a3a6c7641
5 changed files with 18 additions and 13 deletions
+1 -1
View File
@@ -158,7 +158,7 @@ void CasterAI::UpdateAI(const uint32 diff)
events.Update(diff);
if (me->getVictim()->HasBreakableByDamageCrowdControlAura())
if (me->getVictim()->HasBreakableByDamageCrowdControlAura(me))
{
me->InterruptNonMeleeSpells(false);
return;
+1 -1
View File
@@ -92,7 +92,7 @@ void PetAI::UpdateAI(const uint32 diff)
if (me->getVictim())
{
// is only necessary to stop casting, the pet must not exit combat
if (me->getVictim()->HasBreakableByDamageCrowdControlAura())
if (me->getVictim()->HasBreakableByDamageCrowdControlAura(me))
{
me->InterruptNonMeleeSpells(false);
return;
+13 -8
View File
@@ -516,22 +516,27 @@ bool Unit::HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint
return false;
}
bool Unit::HasBreakableByDamageAuraType(AuraType type) const
bool Unit::HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura) 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)
if ((!excludeAura || excludeAura != (*itr)->GetSpellInfo()->Id) && //Avoid self interrupt of channeled Crowd Control spells like Seduction
((*itr)->GetSpellInfo()->Attributes & SPELL_ATTR0_BREAKABLE_BY_DAMAGE || (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_TAKE_DAMAGE))
return true;
return false;
}
bool Unit::HasBreakableByDamageCrowdControlAura() const
bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) 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));
uint32 excludeAura = 0;
if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : NULL)
excludeAura = currentChanneledSpell->GetSpellInfo()->Id; //Avoid self interrupt of channeled Crowd Control spells like Seduction
return ( HasBreakableByDamageAuraType(SPELL_AURA_MOD_CONFUSE, excludeAura)
|| HasBreakableByDamageAuraType(SPELL_AURA_MOD_FEAR, excludeAura)
|| HasBreakableByDamageAuraType(SPELL_AURA_MOD_STUN, excludeAura)
|| HasBreakableByDamageAuraType(SPELL_AURA_MOD_ROOT, excludeAura)
|| HasBreakableByDamageAuraType(SPELL_AURA_TRANSFORM, excludeAura));
}
void Unit::DealDamageMods(Unit* victim, uint32 &damage, uint32* absorb)
+2 -2
View File
@@ -1555,8 +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 HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura = 0) const;
bool HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel = NULL) const;
bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }
bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); }
+1 -1
View File
@@ -1738,7 +1738,7 @@ public:
if (!UpdateVictim())
return;
if (me->getVictim()->HasBreakableByDamageCrowdControlAura())
if (me->getVictim()->HasBreakableByDamageCrowdControlAura(me))
{
me->InterruptNonMeleeSpells(false);
return;