Jump to content

[Patch] Rend and Tear & AuraState:18


Auntie Mangos

Recommended Posts

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

- Implements AuraState: 18

- Implements Spell:48432 and Ranks

- Spell:6807 and Ranks now too benefits from effects, that increase effects with MECHANIC_BLEED

For which repository revision was the patch created?

- master @ 5953d559f5876628942cee1ee013bba72c8caf14

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

- http://getmangos.eu/community/viewtopic.php?id=10004

Who has been writing this patch?

AuraState-component by laise -> source (corrected remove)

everything else by Sarjuuk

Notes

AuraState:18 is not explicitly needed for this spell. However, i found it vastly supperior to another iterator over another set of auras. And since it would also be needed for Spell:51662 which is not entirely fixed by this), i included it here.

Patch

diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index 62fb2c0..b39a39e 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -909,7 +909,7 @@ enum AuraState
    AURA_STATE_SWIFTMEND                    = 15,           //   T |
    AURA_STATE_DEADLY_POISON                = 16,           //   T |
    AURA_STATE_ENRAGE                       = 17,           // C   |
-    //AURA_STATE_UNKNOWN18                  = 18,           // C  t|
+    AURA_STATE_MECHANIC_BLEED               = 18,           // C  t|
    //AURA_STATE_UNKNOWN19                  = 19,           //     | not used
    //AURA_STATE_UNKNOWN20                  = 20,           //  c  | only (45317 Suicide)
    //AURA_STATE_UNKNOWN21                  = 21,           //     | not used
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 662cd5a..feb1ca4 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -1079,6 +1079,10 @@ void Aura::_AddAura()
            // Enrage aura state
            if(m_spellProto->Dispel == DISPEL_ENRAGE)
                m_target->ModifyAuraState(AURA_STATE_ENRAGE, true);
+
+            // Mechanic bleed aura state
+            if(GetAllSpellMechanicMask(m_spellProto) & (1 << (MECHANIC_BLEED-1)))
+                m_target->ModifyAuraState(AURA_STATE_MECHANIC_BLEED, true);
        }
    }
}
@@ -1156,6 +1160,23 @@ bool Aura::_RemoveAura()
        if(m_spellProto->Dispel == DISPEL_ENRAGE)
            m_target->ModifyAuraState(AURA_STATE_ENRAGE, false);

+        // Mechanic bleed aura state
+       if(GetAllSpellMechanicMask(m_spellProto) & (1 << (MECHANIC_BLEED-1)))
+       {
+           bool found = false;
+           Unit::AuraList const& mPerDmg = m_target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
+           for(Unit::AuraList::const_iterator i = mPerDmg.begin(); i != mPerDmg.end(); ++i)
+           {
+               if(GetAllSpellMechanicMask((*i)->m_spellProto) & (1 << (MECHANIC_BLEED-1)))
+               {
+                   found = true;
+                   break;
+               }
+           }
+           if(!found)
+               m_target->ModifyAuraState(AURA_STATE_MECHANIC_BLEED, false);
+       }
+
        uint32 removeState = 0;
        uint64 removeFamilyFlag = m_spellProto->SpellFamilyFlags;
        uint32 removeFamilyFlag2 = m_spellProto->SpellFamilyFlags2;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index c45f8cb..106882e 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8809,9 +8809,32 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
            break;
        }
        case SPELL_DAMAGE_CLASS_MELEE:
+        case SPELL_DAMAGE_CLASS_RANGED:
        {
+            if (pVictim)
+            {
+                crit_chance = GetUnitCriticalChance(attackType, pVictim);
+                crit_chance+= GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask);
+            }
+
+            // Rend and Tear - eff:1
+            if(spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellIconID == 1680 && spellProto->SpellFamilyFlags & UI64LIT(0x00800000))
+            {
+                if(pVictim->HasAuraState(AURA_STATE_MECHANIC_BLEED))
+                {
+                    AuraList const& dummyAuras = GetAurasByType(SPELL_AURA_DUMMY);
+                    for(AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i)
+                    {
+                        if((*i)->GetEffIndex() == 1 && (*i)->GetSpellProto()->SpellIconID == 2859)
+                        {
+                            crit_chance += (*i)->GetModifier()->m_amount;
+                            break;
+                        }
+                    }
+                }
+            }
            // Judgement of Command proc always crits on stunned target
-            if(spellProto->SpellFamilyName == SPELLFAMILY_PALADIN)
+            else if(spellProto->SpellFamilyName == SPELLFAMILY_PALADIN)
            {
                if(spellProto->SpellFamilyFlags & 0x0000000000800000LL && spellProto->SpellIconID == 561)
                {
@@ -8819,14 +8842,6 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
                        return true;
                }
            }
-        }
-        case SPELL_DAMAGE_CLASS_RANGED:
-        {
-            if (pVictim)
-            {
-                crit_chance = GetUnitCriticalChance(attackType, pVictim);
-                crit_chance+= GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask);
-            }
            break;
        }
        default:
@@ -9273,8 +9288,8 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att
    uint32 schoolMask       = spellProto ? spellProto->SchoolMask : GetMeleeDamageSchoolMask();
    uint32 mechanicMask     = spellProto ? GetAllSpellMechanicMask(spellProto) : 0;

-    // Shred also have bonus as MECHANIC_BLEED damages
-    if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008000))
+    // Shred and Maul also have bonus as MECHANIC_BLEED damages
+    if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008800))
        mechanicMask |= (1 << (MECHANIC_BLEED-1));


@@ -9374,6 +9389,28 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att
    if (!owner)
        owner = this;

+    // ..done (dummy auras)
+    if(spellProto)
+    {
+        AuraList const& casterDummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY);
+        for(AuraList::const_iterator i = casterDummyAuras.begin(); i != casterDummyAuras.end(); ++i)
+        {
+            if (!(*i)->isAffectedOnSpell(spellProto))
+                continue;
+
+            switch((*i)->GetSpellProto()->SpellIconID)
+            {
+                // Rend and Tear - eff:0
+                case 2859:
+                {
+                    if(pVictim->HasAuraState(AURA_STATE_MECHANIC_BLEED))
+                        DonePercent *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f;
+                    break;
+                }
+            }
+        }
+    }
+
    // ..done (class scripts)
    if(spellProto)
    {

Link to comment
Share on other sites

i wished to test this patch but found strange thing in core. Mechanic bleed exeption for shred is definied twice in clean core - 1st in MeleeDmgBonusDone and 2nd MeleeDmgBonusTaken. Wouldn't that cause double bonus counting?

secound thing this thread doubles http://getmangos.eu/community/viewtopic.php?id=11548&highlight=bleeding. should be merged beacuse solution is quite the same.

till this time i was using it for about 1year and didn't found any performance issues, but for some testers shred dmg was far to great. personaly i never counted it.

Link to comment
Share on other sites

  • 39 years later...

had some spare time ;)

updated to: master @ b9d2db3a3737ec795b34fb755851c0c65afd5999

fixed an issue in mask generation by shiftig. ... I still wonder how the hell it worked initially.

/E: small fix

- reset a missplaced break, preventing most cirtical strikes in melee >_>

- added IconID-Check to prevent Rip to benefit from Rend and Tears +crit

Link to comment
Share on other sites

  • 3 weeks later...

Which one, AURA_STATE_MECHANIC_BLEED ? Well, any physical bleed should add this state, and they all have differents icons.

But after seeing the comments on Hunger for Blood (link) requiring the same mechanics, maybe mechanic_bleed isn't required :

one of the comment at the end list all bleeds allowing the talent to work, and some of them do not have the mechanic bleed information. But all of them are periodic damage, physical type.

Link to comment
Share on other sites

  • 1 month later...

someone forgot to apply ths part or similar code to master when reviewing this:

-    // Shred also have bonus as MECHANIC_BLEED damages
-    if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008000))
+    // Shred and Maul also have bonus as MECHANIC_BLEED damages
+    if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008800))

that disables maul to contribute from bleeding effects on target

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
  • 5 weeks later...

updated to: r9784

Note, that i just checked, whether it compiles. I didn't retest functionality!

diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index d1d792f..f86f2e4 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -915,7 +915,7 @@ enum AuraState
    AURA_STATE_SWIFTMEND                    = 15,           //   T |
    AURA_STATE_DEADLY_POISON                = 16,           //   T |
    AURA_STATE_ENRAGE                       = 17,           // C   |
-    //AURA_STATE_UNKNOWN18                  = 18,           // C  t|
+    AURA_STATE_MECHANIC_BLEED               = 18,           // C  t|
    //AURA_STATE_UNKNOWN19                  = 19,           //     | not used
    //AURA_STATE_UNKNOWN20                  = 20,           //  c  | only (45317 Suicide)
    //AURA_STATE_UNKNOWN21                  = 21,           //     | not used
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 6d3bd1e..eeafbfd 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -1063,6 +1063,10 @@ void Aura::_AddAura()
            // Enrage aura state
            if(m_spellProto->Dispel == DISPEL_ENRAGE)
                m_target->ModifyAuraState(AURA_STATE_ENRAGE, true);
+
+            // Mechanic bleed aura state
+            if(GetAllSpellMechanicMask(m_spellProto) & (1 << (MECHANIC_BLEED-1)))
+                m_target->ModifyAuraState(AURA_STATE_MECHANIC_BLEED, true);
        }
    }
}
@@ -1140,6 +1144,23 @@ bool Aura::_RemoveAura()
        if(m_spellProto->Dispel == DISPEL_ENRAGE)
            m_target->ModifyAuraState(AURA_STATE_ENRAGE, false);

+        // Mechanic bleed aura state
+       if(GetAllSpellMechanicMask(m_spellProto) & (1 << (MECHANIC_BLEED-1)))
+       {
+           bool found = false;
+           Unit::AuraList const& mPerDmg = m_target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
+           for(Unit::AuraList::const_iterator i = mPerDmg.begin(); i != mPerDmg.end(); ++i)
+           {
+               if(GetAllSpellMechanicMask((*i)->m_spellProto) & (1 << (MECHANIC_BLEED-1)))
+               {
+                   found = true;
+                   break;
+               }
+           }
+           if(!found)
+               m_target->ModifyAuraState(AURA_STATE_MECHANIC_BLEED, false);
+       }
+
        uint32 removeState = 0;
        uint64 removeFamilyFlag = m_spellProto->SpellFamilyFlags;
        uint32 removeFamilyFlag2 = m_spellProto->SpellFamilyFlags2;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index c29ce02..efdf0c2 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -9463,8 +9463,27 @@ bool Unit::IsSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
        case SPELL_DAMAGE_CLASS_RANGED:
        {
            if (pVictim)
+            {
                crit_chance = GetUnitCriticalChance(attackType, pVictim);

+                // Rend and Tear - eff:1
+                if(spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellIconID == 1680 && spellProto->SpellFamilyFlags & UI64LIT(0x00800000))
+                {
+                    if(pVictim->HasAuraState(AURA_STATE_MECHANIC_BLEED))
+                    {
+                        AuraList const& dummyAuras = GetAurasByType(SPELL_AURA_DUMMY);
+                        for(AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i)
+                        {
+                            if((*i)->GetEffIndex() == 1 && (*i)->GetSpellProto()->SpellIconID == 2859)
+                            {
+                                crit_chance += (*i)->GetModifier()->m_amount;
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+
            crit_chance+= GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask);
            break;
        }
@@ -9932,8 +9951,8 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att
    uint32 schoolMask       = spellProto ? spellProto->SchoolMask : GetMeleeDamageSchoolMask();
    uint32 mechanicMask     = spellProto ? GetAllSpellMechanicMask(spellProto) : 0;

-    // Shred also have bonus as MECHANIC_BLEED damages
-    if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008000))
+    // Shred and Maul also have bonus as MECHANIC_BLEED damages
+    if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008800))
        mechanicMask |= (1 << (MECHANIC_BLEED-1));


@@ -10033,6 +10052,28 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att
    if (!owner)
        owner = this;

+    // ..done (dummy auras)
+    if(spellProto)
+    {
+        AuraList const& casterDummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY);
+        for(AuraList::const_iterator i = casterDummyAuras.begin(); i != casterDummyAuras.end(); ++i)
+        {
+            if (!(*i)->isAffectedOnSpell(spellProto))
+                continue;
+
+            switch((*i)->GetSpellProto()->SpellIconID)
+            {
+                // Rend and Tear - eff:0
+                case 2859:
+                {
+                    if(pVictim->HasAuraState(AURA_STATE_MECHANIC_BLEED))
+                        DonePercent *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f;
+                    break;
+                }
+            }
+        }
+    }
+
    // ..done (class scripts)
    if(spellProto)
    {

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
  • 1 month later...
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