Jump to content

Recommended Posts

Posted

I found a bug, or rather dummy code for Vigilance in this commit. Spell 59665 has no dummy aura, so there is no reset executed. I suggest this solution:

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 907fa37..b9af9bd 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -2468,7 +2468,6 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
            }
            case 35079:                                     // Misdirection, triggered buff
            case 59628:                                     // Tricks of the Trade, triggered buff
-            case 59665:                                     // Vigilance, redirection spell
            {
                if (Unit* pCaster = GetCaster())
                    pCaster->getHostileRefManager().ResetThreatRedirection();
@@ -5084,14 +5083,33 @@ void Aura::HandleAuraProcTriggerSpell(bool apply, bool Real)
    if(!Real)
        return;

+    Unit *caster = GetCaster();
+    Unit *target = GetTarget();
+
    if(apply)
    {
-        // some spell have charges by functionality not have its in spell data
        switch (GetId())
        {
+            // some spell have charges by functionality not have its in spell data
            case 28200:                                     // Ascendance (Talisman of Ascendance trinket)
                GetHolder()->SetAuraCharges(6);
                break;
+            case 50720:                                     // Vigilance (threat transfering)
+                if (caster && target)
+                    target->CastSpell(caster, 59665, true);
+                break;
+            default: break;
+        }
+    }
+    // remove
+    else
+    {
+        switch (GetId())
+        {
+            case 50720:                                     // Vigilance (reset threat transfering)
+                if (target)
+                    target->getHostileRefManager().ResetThreatRedirection();
+                break;
            default: break;
        }
    }

At first I wanted to add triggered spell in Spell::Cast, but the spell should be cast by target of aura on the caster, so I moved it to ProcAura applying/removing handler.

Also, I have rewritten part for latest revision for cooldown resetting posted above by breakwater:

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 5500140..b46b27e 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6662,6 +6662,14 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)

                    return;
                }
+                case 50725:                                 //Vigilance - remove cooldown on Taunt
+                {
+                    if (Player* pAuraCaster = (Player*)(m_caster->GetAura(50720, EFFECT_INDEX_0)->GetCaster()))
+                    {
+                        if (pAuraCaster->HasSpellCooldown(355))
+                            pAuraCaster->RemoveSpellCooldown(355, true);
+                    }
+                }
                case 51770:                                 // Emblazon Runeblade
                {
                    Unit* caster = GetAffectiveCaster();

I'm still working on damage reduction (and also for (G)BoS, Renewed Hope, since they shouldn't stack and should be handled in one place in code).

EDIT:

I came up with something like this for damage reduction:

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 35fe7f5..0a0a716 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -6970,6 +6970,18 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto,
    // .. taken pct: dummy auras
    if (GetTypeId() == TYPEID_PLAYER)
    {
+        // non-stacking auras - Vigilance, Renewed Hope and (Greater) Blessing of Sanctuary
+        Aura *pAura = GetAura(50720, EFFECT_INDEX_0);  // Vigilance
+        if (!pAura)
+            pAura = GetDummyAura(63944);               // Renewed Hope
+        if (!pAura)
+            pAura = GetDummyAura(20911);               // Blessing of Sanctuary
+        if (!pAura)
+            pAura = GetDummyAura(25899);               // Greater Blessing of Sanctuary
+
+        if (pAura)
+            TakenTotalMod *= (float(pAura->GetModifier()->m_amount) + 100.0f) / 100.0f;
+
        //Cheat Death
        if (Aura *dummy = GetDummyAura(45182))
        {
@@ -8005,6 +8017,17 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp
                break;
        }
    }
+    // non-stacking auras - Vigilance, Renewed Hope and (Greater) Blessing of Sanctuary
+    Aura *pAura = GetAura(50720, EFFECT_INDEX_0);  // Vigilance
+    if (!pAura)
+        pAura = GetDummyAura(63944);               // Renewed Hope
+    if (!pAura)
+        pAura = GetDummyAura(20911);               // Blessing of Sanctuary
+    if (!pAura)
+        pAura = GetDummyAura(25899);               // Greater Blessing of Sanctuary
+
+    if (pAura)
+        TakenPercent *= (float(pAura->GetModifier()->m_amount) + 100.0f) / 100.0f;

    // final calculation
    // =================

Posted

About first patch: not good ask GetCaster() for all handler code, this slow operation (search guids lists for pointer) so must be used in specific spell code part only if need. Aura target can't be NULL in any cases. I can store corrupted pointer if some bug but not NULL.

Cooldown reset look hackish. We have special fucntion for reset specific spell category: Player::RemoveSpellCategoryCooldown

I will replace this part code by direct unconditional call this function.

for original spell caster selection better use:

                    Unit* caster = GetAffectiveCaster();

For triggered spells it point to original main spell that triggering chain of casts

This 2 patches added in [11024]. Thank you.

Damage redunction is unacceptable hack. Becase for this exist special spell 68066

×
×
  • 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