Jump to content

[patch][5724] Spell Interruption


Guest thenecromancer

Recommended Posts

CC efects should interrupt casting as well, this should also get rid of casting effect staying on unit ( like burning hands ) when they were in stun while finishing the cast

Index: game/SpellAuras.cpp
===================================================================
--- game/SpellAuras.cpp        (revision 4393)
+++ game/SpellAuras.cpp        (working copy)
@@ -1885,6 +1885,16 @@
                if ( caster && (GetSpellProto()->Mechanic == MECHANIC_CONFUSED) && (GetSpellProto()->SpellFamilyName == SPELLFAMILY_ROGUE))
                        caster->AttackStop();
                // only at real add aura
+
+                // Interrupt spellcasting
+                for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
+                {
+                        if (m_target->m_currentSpells[i])
+                        {
+                                m_target->InterruptSpell(i);
+                        }
+                }
+
                if(Real)
                {
                        //This fixes blind so it doesn't continue to attack
@@ -1929,6 +1939,15 @@
                m_target->addUnitState(UNIT_STAT_FLEEING);
                m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE | UNIT_FLAG_FLEEING);

+                // Interrupt spellcasting
+                for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
+                {
+                        if (m_target->m_currentSpells[i])
+                        {
+                                m_target->InterruptSpell(i);
+                        }
+                }
+
                // only at real add aura
                if(Real)
                {
@@ -2046,6 +2065,15 @@
                        m_target->SetOrientation(m_target->GetAngle(caster));
                }

+                // Interrupt spellcasting
+                for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
+                {
+                        if (m_target->m_currentSpells[i])
+                        {
+                                m_target->InterruptSpell(i);
+                        }
+                }
+
                // Creature specific
                if(m_target->GetTypeId() != TYPEID_PLAYER)
                {

Link to comment
Share on other sites

I'm using another patch, and that feature works perfect

Index: src/game/SpellAuras.cpp
===================================================================
--- src/game/SpellAuras.cpp        (revision 4374)
+++ src/game/SpellAuras.cpp        (working copy)
@@ -1769,7 +1769,7 @@
                        m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,caster->getFaction());

                        caster->SetCharm(m_target);
-
+                        m_target->Cancelcast();
                        if(caster->getVictim()==m_target)
                                caster->AttackStop();
                        m_target->CombatStop();
@@ -1877,6 +1877,7 @@
        if( apply )
        {
                m_target->addUnitState(UNIT_STAT_CONFUSED);
+                m_target->Cancelcast();
                                                                                                                        // probably wrong
                m_target->SetFlag(UNIT_FIELD_FLAGS,(apply_stat<<16));

@@ -1927,6 +1928,8 @@
        if( Apply )
        {
                m_target->addUnitState(UNIT_STAT_FLEEING);
+                m_target->Cancelcast();
+                // m_target->AttackStop();
                m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE | UNIT_FLAG_FLEEING);

                // only at real add aura
@@ -2028,6 +2031,7 @@
                m_target->addUnitState(UNIT_STAT_STUNDED);
                m_target->SetUInt64Value (UNIT_FIELD_TARGET, 0);
                m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE);
+                m_target->Cancelcast();

                // Stop attack if spell has knockout effect
                if (caster && (GetSpellProto()->Mechanic == MECHANIC_KNOCKOUT))
@@ -2289,7 +2293,10 @@
                return;

        if(apply)
+        {
                m_target->m_silenced = true;
+                m_target->Cancelcast();
+        }
        else
        {
                // Real remove called after current aura remove from lists, check if other similar auras active
Index: src/game/Unit.cpp
===================================================================
--- src/game/Unit.cpp        (revision 4374)
+++ src/game/Unit.cpp        (working copy)
@@ -6911,3 +6911,10 @@
                        return true;
        return false;
}
+
+void Unit::Cancelcast()
+{
+        for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
+                if (m_currentSpells[i])
+                        InterruptSpell(i);
+}
Index: src/game/Unit.h
===================================================================
--- src/game/Unit.h        (revision 4374)
+++ src/game/Unit.h        (working copy)
@@ -751,6 +751,7 @@
                        return NULL;
                }
                bool Attack(Unit *victim, bool playerMeleeAttack = false);
+                void Cancelcast();
                bool AttackStop();
                void RemoveAllAttackers();
                AttackerSet const& getAttackers() const { return m_attackers; }

Link to comment
Share on other sites

  • 3 months later...

Patch is not outdated, for correct interrupt spells by charm, fear and stun we still need to use that patch; for silence case - all ok.

Here update for last revisions

Index: src/game/SpellAuras.cpp
===================================================================
--- src/game/SpellAuras.cpp        (revision 4917)
+++ src/game/SpellAuras.cpp        (working copy)
@@ -1850,7 +1850,7 @@
                {
                        m_target->SetCharmerGUID(GetCasterGUID());
                        m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,caster->getFaction());
-
+                        m_target->Cancelcast();
                        caster->SetCharm(m_target);

                        if(caster->getVictim()==m_target)
@@ -1960,6 +1960,7 @@
        if( apply )
        {
                m_target->addUnitState(UNIT_STAT_CONFUSED);
+                m_target->Cancelcast();
                m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);

                if(m_target->GetTypeId() == TYPEID_PLAYER)
@@ -2027,6 +2028,7 @@
        if( Apply )
        {
                m_target->addUnitState(UNIT_STAT_FLEEING);
+                m_target->Cancelcast();
                m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);

                // only at real add aura
@@ -2162,6 +2164,7 @@
                m_target->SetUInt64Value (UNIT_FIELD_TARGET, 0);

                m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE);
+                m_target->Cancelcast();

                if (caster)
                {
Index: src/game/Unit.cpp
===================================================================
--- src/game/Unit.cpp        (revision 4917)
+++ src/game/Unit.cpp        (working copy)
@@ -943,6 +943,13 @@
        DEBUG_LOG("DealDamageEnd");
}

+void Unit::Cancelcast()
+{
+        for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
+                if (m_currentSpells[i])
+                        InterruptSpell(i);
+}
+
void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster)
{
        SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
Index: src/game/Unit.h
===================================================================
--- src/game/Unit.h        (revision 4917)
+++ src/game/Unit.h        (working copy)
@@ -755,6 +755,7 @@
                        return NULL;
                }
                bool Attack(Unit *victim, bool playerMeleeAttack = false);
+                void Cancelcast();
                bool AttackStop();
                void RemoveAllAttackers();
                AttackerSet const& getAttackers() const { return m_attackers; }

Link to comment
Share on other sites

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