Jump to content

Spellsteal resist chance


Guest maly32167

Recommended Posts

Spellsteal should have the same chances to miss(resist) as dispel (it is dispel-type mechanic)

this applies such chance to miss spellsteal effect

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 5e9cd37..9bc0fe3 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -9196,7 +9196,22 @@ void Spell::EffectStealBeneficialBuff(SpellEffectIndex eff_idx)
            SpellAuraHolder *holder = steal_list[urand(0, list_size-1)];
            // Not use chance for steal
            // TODO possible need do it
-            success_list.push_back( std::pair<uint32,uint64>(holder->GetId(),holder->GetCasterGUID()));
+
+            int32 miss_chance = 0;
+            // Apply dispel mod from aura caster
+            if (Unit *caster = holder->GetCaster())
+            {
+                if (Player* modOwner = caster->GetSpellModOwner())
+                {
+                    modOwner->ApplySpellMod(holder->GetSpellProto()->Id, SPELLMOD_RESIST_DISPEL_CHANCE, miss_chance, this);
+                    miss_chance += modOwner->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
+                }
+            }
+
+            // Try dispel
+            if (!roll_chance_i(miss_chance))
+                success_list.push_back( std::pair<uint32,uint64>(holder->GetId(),holder->GetCasterGUID()));
+            else m_caster->SendSpellMiss(unitTarget, holder->GetSpellProto()->Id, SPELL_MISS_RESIST);

            // Remove buff from list for prevent doubles
            for (std::vector<SpellAuraHolder *>::iterator j = steal_list.begin(); j != steal_list.end(); )

Link to comment
Share on other sites

  • 9 months later...

Yes Im sure about aura's casters DISPEL_RESIST mod (for example Silent Resolve talent of priest - it reduces change your helpful spells will be dispelled - therfore if you buff someone else, it must be chance lowering must be taken from aura caster itself)

Also I have used this patch for almost 1 year now and everything seems to work pretty much fine :)

Link to comment
Share on other sites

Updated: Now dispel chances are properly taken for caster/target. thx for pointing out as I didnt test at diff targets, now everything is fine.

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 40c9709..ee7d6bc 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -9041,9 +9041,34 @@ void Spell::EffectStealBeneficialBuff(SpellEffectIndex eff_idx)
        {
            // Random select buff for dispel
            SpellAuraHolder *holder = steal_list[urand(0, list_size-1)];
-            // Not use chance for steal
-            // TODO possible need do it
-            success_list.push_back(SuccessList::value_type(holder->GetId(),holder->GetCasterGuid()));
+
+            int32 miss_chance = 0;
+            // Apply dispel mod from aura caster
+
+            Unit * caster = holder->GetCaster();
+            Unit * target = holder->GetTarget();
+            if(!caster || !target)
+                continue;
+
+            if (Player* modOwner = caster->GetSpellModOwner())
+            {
+                modOwner->ApplySpellMod(holder->GetSpellProto()->Id, SPELLMOD_RESIST_DISPEL_CHANCE, miss_chance, this);
+                miss_chance += modOwner->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
+            }
+
+            if (caster != target)
+            {
+                if (Player* modOwner = target->GetSpellModOwner())
+                {
+                    modOwner->ApplySpellMod(holder->GetSpellProto()->Id, SPELLMOD_RESIST_DISPEL_CHANCE, miss_chance, this);
+                    miss_chance += modOwner->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
+                }
+            }
+
+            // Try dispel
+            if (!roll_chance_i(miss_chance))
+                success_list.push_back(SuccessList::value_type(holder->GetId(),holder->GetCasterGuid()));
+            else m_caster->SendSpellMiss(unitTarget, holder->GetSpellProto()->Id, SPELL_MISS_RESIST);

            // Remove buff from list for prevent doubles
            for (StealList::iterator j = steal_list.begin(); j != steal_list.end(); )

Link to comment
Share on other sites

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