aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellAuras.cpp
diff options
context:
space:
mode:
authorQAston <none@none>2009-07-11 15:58:19 +0200
committerQAston <none@none>2009-07-11 15:58:19 +0200
commitbf5447b469fe957cb9ba27583d5d7f3b4df5f5b6 (patch)
tree872f92a43ac538d8277dd368093b4838253c08ad /src/game/SpellAuras.cpp
parentb52b3581095a7022ec01d354e7c62083b4ed6c6d (diff)
*Handle breaking on damage auras by procflags - original patch by thenecromancer
*Implement Glyph of Fear - by thenecromancer --HG-- branch : trunk
Diffstat (limited to 'src/game/SpellAuras.cpp')
-rw-r--r--src/game/SpellAuras.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 333759358a4..3b98301cb2e 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -486,6 +486,9 @@ m_target(parentAura->GetTarget()), m_tickNumber(0)
else
m_amount = m_currentBasePoints + 1;
+ if (int32 amount = CalculateCrowdControlAuraAmount(caster))
+ m_amount = amount;
+
if (!m_amount && castItem && castItem->GetItemSuffixFactor())
{
ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId()));
@@ -7421,3 +7424,37 @@ void AuraEffect::HandleReflectSpells( bool Apply, bool Real , bool /*changeAmoun
}
}
+int32 AuraEffect::CalculateCrowdControlAuraAmount(Unit * caster)
+{
+ // Damage cap for CC effects
+ if (!m_spellProto->procFlags)
+ return 0;
+
+ if (m_auraName !=SPELL_AURA_MOD_CONFUSE &&
+ m_auraName !=SPELL_AURA_MOD_FEAR &&
+ m_auraName !=SPELL_AURA_MOD_STUN &&
+ m_auraName !=SPELL_AURA_MOD_ROOT)
+ return 0;
+
+ int32 damageCap = (int32)(m_target->GetCreateHealth()*0.10f);
+
+ if (!caster)
+ return damageCap;
+
+ // Glyphs increasing damage cap
+ Unit::AuraEffectList const& overrideClassScripts = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(Unit::AuraEffectList::const_iterator itr = overrideClassScripts.begin();itr != overrideClassScripts.end(); ++itr)
+ {
+ if((*itr)->isAffectedOnSpell(m_spellProto))
+ {
+ // Glyph of Fear
+ if ((*itr)->GetMiscValue() == 7801)
+ {
+ damageCap += (int32)(damageCap*(*itr)->GetAmount()/100.0f);
+ break;
+ }
+ }
+ }
+ return damageCap;
+}
+