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); events.Update(diff);
if (me->getVictim()->HasBreakableByDamageCrowdControlAura()) if (me->getVictim()->HasBreakableByDamageCrowdControlAura(me))
{ {
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
return; return;
+1 -1
View File
@@ -92,7 +92,7 @@ void PetAI::UpdateAI(const uint32 diff)
if (me->getVictim()) if (me->getVictim())
{ {
// is only necessary to stop casting, the pet must not exit combat // is only necessary to stop casting, the pet must not exit combat
if (me->getVictim()->HasBreakableByDamageCrowdControlAura()) if (me->getVictim()->HasBreakableByDamageCrowdControlAura(me))
{ {
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
return; return;
+13 -8
View File
@@ -516,22 +516,27 @@ bool Unit::HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint
return false; return false;
} }
bool Unit::HasBreakableByDamageAuraType(AuraType type) const bool Unit::HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura) const
{ {
AuraEffectList const& auras = GetAuraEffectsByType(type); AuraEffectList const& auras = GetAuraEffectsByType(type);
for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) 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 true;
return false; return false;
} }
bool Unit::HasBreakableByDamageCrowdControlAura() const bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) const
{ {
return ( HasBreakableByDamageAuraType(SPELL_AURA_MOD_CONFUSE) uint32 excludeAura = 0;
|| HasBreakableByDamageAuraType(SPELL_AURA_MOD_FEAR) if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : NULL)
|| HasBreakableByDamageAuraType(SPELL_AURA_MOD_STUN) excludeAura = currentChanneledSpell->GetSpellInfo()->Id; //Avoid self interrupt of channeled Crowd Control spells like Seduction
|| HasBreakableByDamageAuraType(SPELL_AURA_MOD_ROOT)
|| HasBreakableByDamageAuraType(SPELL_AURA_TRANSFORM)); 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) 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 HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint32 familyFlags) const;
bool virtual HasSpell(uint32 /*spellID*/) const { return false; } bool virtual HasSpell(uint32 /*spellID*/) const { return false; }
bool HasBreakableByDamageAuraType(AuraType type) const; bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura = 0) const;
bool HasBreakableByDamageCrowdControlAura() const; bool HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel = NULL) const;
bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); } bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }
bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); } bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); }
+1 -1
View File
@@ -1738,7 +1738,7 @@ public:
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
if (me->getVictim()->HasBreakableByDamageCrowdControlAura()) if (me->getVictim()->HasBreakableByDamageCrowdControlAura(me))
{ {
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
return; return;