Jump to content

[patch]Remove Immunity Effect for Shattering Throw


Guest NetSky

Recommended Posts

Fixed in hackish form in my repo, but you need to use both patches (17 and this) or apply it manually http://github.com/insider42/mangos/commit/3851daef08ccf708ddc87f0e30c0ee55c15a35cc

anyway spell won't remove immunities if you add precast spell. I just allowed spell 64382 to remove immunity effects and it works.

in your last stable repo? I have it and don't work T_T

Link to comment
Share on other sites

  • 2 weeks later...

maybe more generic approach but still hacky

http://www.pastebin.org/83413

affected spells:

mysql> SELECT id, spellname FROM spell_entry WHERE mechanic = 29;
+-------+--------------------+
| id    | spellname          |
+-------+--------------------+
|   498 | Divine Protection  |
|   642 | Divine Shield      |
|  1022 | Hand of Protection |
|  5599 | Hand of Protection |
| 10278 | Hand of Protection |
| 27619 | Ice Block          |
| 41367 | Divine Shield      |
| 45438 | Ice Block          |
| 46604 | Ice Block          |
| 63148 | Divine Shield      |
| 65802 | Ice Block          |
| 66009 | Hand of Protection |
| 66010 | Divine Shield      |
| 67251 | Divine Shield      |
+-------+--------------------+
14 rows in set (0.13 sec)

Link to comment
Share on other sites

  • 5 weeks later...

    // Check for immune
   if (pVictim->IsImmunedToSpell(spell))
   {
       if (spell->Id == 64382)
           pVictim->RemoveAurasBySpellMechanic(MECHANIC_IMMUNE_SHIELD); 
       else
           return SPELL_MISS_IMMUNE;
   }

void Unit::RemoveAurasBySpellMechanic(uint32 mechMask)
{
   Unit::AuraMap& auras = GetAuras();
   for(Unit::AuraMap::iterator iter = auras.begin(); iter != auras.end()
   {
       SpellEntry const *spell = iter->second->GetSpellProto();
       if (spell->Mechanic & mechMask)
       {
           RemoveAurasDueToSpell(spell->Id);
           if(auras.empty())
               break;
           else
               iter = auras.begin();
       }
       else
           ++iter;
   }
}

        void RemoveAurasBySpellMechanic(uint32 mechMask);

Link to comment
Share on other sites

    // Check for immune
   if (pVictim->IsImmunedToSpell(spell))
   {
       if (spell->Id == 64382)
           pVictim->RemoveAurasBySpellMechanic(MECHANIC_IMMUNE_SHIELD); 
       else
           return SPELL_MISS_IMMUNE;
   }

void Unit::RemoveAurasBySpellMechanic(uint32 mechMask)
{
   Unit::AuraMap& auras = GetAuras();
   for(Unit::AuraMap::iterator iter = auras.begin(); iter != auras.end()
   {
       SpellEntry const *spell = iter->second->GetSpellProto();
       if (spell->Mechanic & mechMask)
       {
           RemoveAurasDueToSpell(spell->Id);
           if(auras.empty())
               break;
           else
               iter = auras.begin();
       }
       else
           ++iter;
   }
}

        void RemoveAurasBySpellMechanic(uint32 mechMask);

it will remove forbearance debuff too.

I think should be a flag, that allow spell to avoid immuned effects, because id checks (hacks) is not generic solution :/ can someone try to find it in DBC's?

hacked, but working version of patch + fix for Mass Dispel >> HERE <<

it would be good if someone create a function that can find all triggered spells by first spell and save it in array (to call it by id of main spell). This can simplify patch.

Link to comment
Share on other sites

bug with forbearance removing by function related to this

void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/)
{
   uint32 misc  = m_modifier.m_miscvalue;
   // Forbearance
   // in DBC wrong mechanic immune since 3.0.x
   if (GetId() == 25771)
       misc = MECHANIC_IMMUNE_SHIELD;

in spellauras.cpp

Link to comment
Share on other sites

rewritten version, with flag using

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index d44df94..9aced18 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1038,7 +1038,8 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
    // Recheck immune (only for delayed spells)
    if (m_spellInfo->speed && (
        unit->IsImmunedToDamage(GetSpellSchoolMask(m_spellInfo)) ||
-        unit->IsImmunedToSpell(m_spellInfo)))
+        unit->IsImmunedToSpell(m_spellInfo)) && 
+        !(m_spellInfo->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
    {
        if (realCaster)
            realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_IMMUNE);
@@ -2556,6 +2557,10 @@ void Spell::cast(bool skipCheck)
        }
    }

+    if (m_spellInfo->Id == 32592)
+        if(const SpellEntry* spellInfo = sSpellStore.LookupEntry(m_spellInfo->Id))
+            const_cast<SpellEntry*>(spellInfo)->Attributes |= SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY;
+
    // different triggred (for caster) and precast (casted before apply effect to target) cases
    switch(m_spellInfo->SpellFamilyName)
    {
@@ -2648,6 +2653,13 @@ void Spell::cast(bool skipCheck)
                AddTriggeredSpell(30708);                   // Totem of Wrath
            break;
        }
+        case SPELLFAMILY_WARRIOR:
+        {
+            // Shattering Throw
+            if (m_spellInfo->Id == 64382)
+                AddPrecastSpell(64380);                     // Shattering Throw
+            break;
+        }
        default:
            break;
    }
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 9c7d8f8..d347dcb 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6115,6 +6115,27 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
            }
            break;
        }
+        case SPELLFAMILY_WARRIOR:
+        {
+            switch(m_spellInfo->Id)
+            {
+                case 64380:                                 // Shattering Throw
+                {
+                    if (!unitTarget || !unitTarget->isAlive())
+                        return;
+
+                    // remove immunity effects
+                    unitTarget->RemoveAurasDueToSpell(642); // Divine Shield
+                    unitTarget->RemoveAurasDueToSpell(1022); // Hand of Protection rank 1
+                    unitTarget->RemoveAurasDueToSpell(5599); // Hand of Protection rank 2
+                    unitTarget->RemoveAurasDueToSpell(10278); // Hand of Protection rank 3
+                    unitTarget->RemoveAurasDueToSpell(19753); // Divine Intervention
+                    unitTarget->RemoveAurasDueToSpell(45438); // Ice Block
+                    break;
+                }
+            }
+            break;
+        }
    }

    // normal DB scripted effect
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 5bfe192..e0743f3 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2932,18 +2932,23 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
    if (pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
        return SPELL_MISS_EVADE;

-    // Check for immune
-    if (pVictim->IsImmunedToSpell(spell))
-        return SPELL_MISS_IMMUNE;
+    if (!(spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
+    {
+        // Check for immune
+        if (pVictim->IsImmunedToSpell(spell))
+            return SPELL_MISS_IMMUNE;

-    // All positive spells can`t miss
-    // TODO: client not show miss log for this spells - so need find info for this in dbc and use it!
-    if (IsPositiveSpell(spell->Id))
-        return SPELL_MISS_NONE;
+        // All positive spells can`t miss
+        // TODO: client not show miss log for this spells - so need find info for this in dbc and use it!
+        if (IsPositiveSpell(spell->Id) && IsFriendlyTo(pVictim))
+            return SPELL_MISS_NONE;

-    // Check for immune
-    if (pVictim->IsImmunedToDamage(GetSpellSchoolMask(spell)))
-        return SPELL_MISS_IMMUNE;
+        // Check for immune
+        if (pVictim->IsImmunedToDamage(GetSpellSchoolMask(spell)))
+            return SPELL_MISS_IMMUNE;
+    }
+    else if (IsPositiveSpell(spell->Id) && IsFriendlyTo(pVictim))
+        return SPELL_MISS_NONE;

    // Try victim reflect spell
    if (CanReflect)

As said one of my offy testers, spell doesn't gets "Immune" at hit target under immunity effects, maybe PreCast method to fix this is wrong, it should cast one of spells 64380 or 64382, 64380 if target is immuned, 64382 if target without any immunity auras.

another problem: i was added this flag (to ignore immunity's) for spell 32592 because spell divided on three parts, main part has this flag, then main spell triggers second spell (spell 32592 _doesn't_ have this flag and gets immune), second spell triggers last spell that should dispel immunity on target and have this flag too. So you can't dispel bubble from paladin because second spell fails from immune.

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Works quiet good on 9605, but however mass dispell should dispell Devineshield, Iceblock etc first, as you can read on wowhead comments.

This is no longer the case. Mass dispel now prioritises buffs/debuffs that can only be dispelled using mass dispel before others. So iceblock and divine shield will get priorities over arcane intellect or blessing of might, for example.

Beside that, sometimes you dispell 1 spell twice, noticed often with mark of the wild.

And players resist dispell much often, then before fix, although i have 3% hit with my discipline priest.

Hope you can solve the stuff and bring it into master.

Thank you!

Link to comment
Share on other sites

  • 1 month later...

umm, is it possible to check before cast if the target has invulnerability aura? if it does, then switch casting to that one which removes invulnerability only. the description of spell says something like this. i'll try to implement this.

something like:

//somewhere
case 64382:   // shattering throw
if (target has invulnerability aura)
{
   caster->stopcasting;
   caster->castspell(64380);
}

I wrote a new hacky version:

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index c7d5104..efa2bbf 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2983,7 +2983,7 @@ void Spell::cast(bool skipCheck)
        {
            // Shattering Throw
            if (m_spellInfo->Id == 64382)
-                AddTriggeredSpell(64380);                     // Shattering Throw
+                m_targets.getUnitTarget()->CastSpell(m_targets.getUnitTarget(), 64380, true); // Shattering Throw removing immunity
            break;
        }
        default:

works faster than AddTriggeredSpell.

still, has anyone any idea how to check the target's aurastate and cast 64380 instead of 64382 if the target has immunity aura?

patch from KAPATEJIb for removing immunity makes it remove aura after about 0.5 sec, so it's way too slow imho. dunno why it takes so long for removing it...

EDIT: oh, i get it, it doesnt have the visual effect but the removing applies after some time, based on the distance (warrior throws his weapon but client cant see it), so to improve it i swapped m_caster with the target.

Link to comment
Share on other sites

starts at about 7:45

good example video. as soon as warrior finishes casting shattering throw, pally's bubble fades. there is also the Immune notification, but I'm not shure if it's for Throw or Charge (but pally's casting has stopped, so imho charge worked and interrupted casting while Throw resulted in Immune notification).

imo this should look like:

shattering throw->weapon meets the target and [(deals damage+reduces armor)OR(removes immunity)]

Link to comment
Share on other sites

  • 2 months later...
×
×
  • 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