Jump to content

[Fix] auras of the same resistance


Auntie Mangos

Recommended Posts

What bug does the patch fix? What features does the patch add?

you can now have two auras of the same resistances, but only the highest value counts

For which repository revision was the patch created?

newest mangos 0.12

Is there a thread in the bug report section or at lighthouse?

http://getmangos.eu/community/showthread.php?13143-Scrolls-Of-Different-Ranks-Stack-Together

Who has been writing this patch? Please include either forum user names or email addresses.

Me

Final Version:

http://github.com/insider42/mangos/commit/c09b9d101e70d05533544fdec5f7469474a338c7

Link to comment
Share on other sites

  • 40 years later...

looks like you scan for the first resistance aura, then compare it with current value. Shouldn't it calculate the max value of all auras instead? maybe something like:GetMaxPositiveAuraModifier (duno if exact name, don't have sources at hand). Besides that the remove process could be assimetric (and leave you with rong resistance value)

Link to comment
Share on other sites

In wow exist only two spells of resistances with"SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE" for one player which is stacking.(2 for every resistance) These increase the green value^^ All other Spells for example the: http://www.wowhead.com/spell=14673 are not spells of this case.

Sry for my english :)

I hope I understood any of you questions. :)

edit:

and therefore we must consider only two and not all.

Link to comment
Share on other sites

GetMaxPositiveAuraModifier() may be the better choice.

your current implementation results in conflicts with auras, adding resistance to more than one type. ie Mark of the Wild

reproduce:

1. buff yourself Mark of the Wild

2. Buff yourself some other Resistance Aura (I used Fire Resistance Totem)

3. Remove Mark of the Wild (right-click the icon)

3a. note, that you'll still have the resistances in your character-sheet

4. Remove Fire Resistance Totem (unsummon Totem or run out of range)

4a. note, that your fire-resistance will show the correct value (0) while all other will have values like 20

anyway, nice that your working on it :>

Link to comment
Share on other sites

I think it would be better to handle Mark of the Wild correctly instead of ignoring it

Its 25/35 resistance shouldn't stack with the other 2 auras either

Mark of Wild will be ignored by this code (No Druide Family)

i_Aura->GetSpellProto()->SpellFamilyName != 7 && GetSpellProto()->SpellFamilyName != 7

unfortunately I have found another misstack in the scrip. I will fix it

Link to comment
Share on other sites

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 11ac823..5b5cced 100644 (file)
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -4680,13 +4680,21 @@ void Aura::HandlePeriodicManaLeech(bool apply, bool /*Real*/)

void Aura::HandleAuraModResistanceExclusive(bool apply, bool /*Real*/)
{
-    for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++)
+    for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++)
    {
-        if(m_modifier.m_miscvalue & int32(1<<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);
-            if(m_target->GetTypeId() == TYPEID_PLAYER)
-                m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply);
+            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, value, apply);
        }
    }
}

Thats how Emme and I did it. Works with Mark of the Wild.

Link to comment
Share on other sites

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index b7cb5aa..5eadc8d 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -4470,11 +4496,22 @@ 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
+                    && (*i)->GetSpellProto()->SpellFamilyName != 7 && GetSpellProto()->SpellFamilyName != 7) //ignore Mark of Wild
+                    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);
        }
    }
}

In this form it works with your script

Link to comment
Share on other sites

I think you misunderstood something.

Mark of the Wild isn't supposed to stack with Totems/Auras and so it should NOT be ignored by this patch

Mark of the Wild is supposed to stack with other resistance auras, because mark of the wild effect is gaining resistance to all schools (except holy) and is also gaining armor. This is other effect then totem auras, which gives only resistance to one school, so totem resistances must stack with mark of the wild, but totem resistances must not stack with the same resistance totems on different ranks.

Link to comment
Share on other sites

Oh yes, I apologize, I didnt read this http://www.wowwiki.com/Buffs carefully, so resistances should not stack, but there is exceptions for some buffs

for example if you have mark of the wild, and then receive for example shaman fire resist totem buff, then you must have fire resist taken from totem, but all other resistances must be taken from mark of the wild

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use