rendered paste bodyIndex: game/Spell.cpp
===================================================================
--- game/Spell.cpp (revision 5279)
+++ game/Spell.cpp (working copy)
@@ -325,7 +325,7 @@
// determine reflection
m_canReflect = false;
- if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && (m_spellInfo->AttributesEx2 & 0x4)==0)
+ if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && (m_spellInfo->AttributesEx & 0x80)==0)
{
for(int j=0;j<3;j++)
{
Index: game/Unit.cpp
===================================================================
--- game/Unit.cpp (revision 5279)
+++ game/Unit.cpp (working copy)
@@ -2779,10 +2780,53 @@
int32 reflectchance = pVictim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
Unit::AuraList const& mReflectSpellsSchool = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
for(Unit::AuraList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
+ {
if((*i)->GetModifier()->m_miscvalue & int32(1 << spell->School))
reflectchance += (*i)->GetModifier()->m_amount;
+ }
+ // Try to reflect now
if (reflectchance > 0 && roll_chance_i(reflectchance))
+ {
+ // Drop charges for SPELL_AURA_REFLECT_SPELLS
+ Unit::AuraList const& mReflectSpells = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS);
+ for(AuraList::const_iterator i = mReflectSpells.begin(); i != mReflectSpells.end(); ++i)
+ {
+ if((*i)->m_procCharges > 0)
+ (*i)->m_procCharges -= 1;
+ }
+ // SPELL_AURA_REFLECT_SPELLS_SCHOOL
+ for(Unit::AuraList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
+ {
+ if((*i)->GetModifier()->m_miscvalue & int32(1 << spell->School))
+ {
+ if((*i)->m_procCharges > 0)
+ (*i)->m_procCharges -= 1;
+ }
+ }
+ // Remove Auras with no charges
+ // School based
+ for(AuraList::const_iterator i = mReflectSpellsSchool.begin(), next; i != mReflectSpellsSchool.end(); i = next)
+ {
+ next = i; ++next;
+ if((*i)->m_procCharges == 0)
+ {
+ RemoveAurasDueToSpell((*i)->GetId());
+ next = mReflectSpellsSchool.begin();
+ }
+ }
+ // General
+ for(AuraList::const_iterator i = mReflectSpells.begin(), next; i != mReflectSpells.end(); i = next)
+ {
+ next = i; ++next;
+ if((*i)->m_procCharges == 0)
+ {
+ RemoveAurasDueToSpell((*i)->GetId());
+ next = mReflectSpells.begin();
+ }
+ }
+
return SPELL_MISS_REFLECT;
+ }
}
// TODO need add here hit result calculation for spells