Skip to content

Commit

Permalink
[patch 143] Fixed replacing of effects that increase same resistance …
Browse files Browse the repository at this point in the history
…type, now only effect with biggest resistance bonus value will be applied. Patch provided by Hundekuchen
  • Loading branch information
insider42 committed May 7, 2010
1 parent 59c67e8 commit c09b9d1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/game/SpellAuras.cpp
Expand Up @@ -5271,11 +5271,21 @@ void Aura::HandleAuraModResistanceExclusive(bool apply, bool /*Real*/)
{
for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++)
{
int32 oldMaxValue = 0;
if(m_modifier.m_miscvalue & int32(1<<x))
{
m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_modifier.m_amount), apply);
// no same resistance auras stack together
Unit::AuraList const& REAuras = m_target->GetAurasByType(SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE);
for (Unit::AuraList::const_iterator i = REAuras.begin(); i != REAuras.end(); ++i)
if (((*i)->GetMiscValue() & int32(1<<x)) && (*i)->GetSpellProto()->Id != GetSpellProto()->Id)
if (oldMaxValue < (*i)->GetModifier()->m_amount)
oldMaxValue = (*i)->GetModifier()->m_amount;

float value = (m_modifier.m_amount > oldMaxValue) ? m_modifier.m_amount - oldMaxValue : 0.0f;

m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, value, apply);
if(m_target->GetTypeId() == TYPEID_PLAYER)
m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply);
m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, value, apply);
}
}
}
Expand Down

0 comments on commit c09b9d1

Please sign in to comment.