Trying To Work On Mind Flay And Da Voodoo Shuffle Bug

I have recently ventured into trying to fix a specific bug (reported here long ago).

By looking up Mind Flay (48156) in SpellWork I have noticed a specific effect being applied on the caster:



BasePoints = 196


I thought it was something to do with channeling spells but upon looking at Mind Sear I got the expected result of it being applied to the enemy only.

Since these values come from some source I cannot argue with (my guess the DBC) I am left to wonder as to why it has to be applied to the caster. which by looking at the bug report might be the reason this bug is caused.

Could someone shed some light on this?

Channelling spells is like this:

[ul][li]You apply the channelled spell aura to target (in mind flay case it’s slow) also this causes beam visual to form[/li]
[li]You apply aura to yourself, that causes you to cast damage part of spell each X milliseconds (max rank mind flay case it’s spell 58381 each 1000ms) (arcane missiles have visual for this spell and not for main aura for example)[/li]

You should check if aura’s applied effects are slowing you, not if aura has slowing effect for Voodoo Shuffle imo

Did this some time ago. It’s a workaround however.

diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 6fb8065..755449a 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4480,15 +4480,26 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_
	 return modifier;

-int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
+int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value, SpellInfo const* spellProto) const
	 int32 modifier = 0;

	 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
	 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
-	    if ((*i)->GetMiscValue() == misc_value)
-		    modifier += (*i)->GetAmount();
+	    if (spellProto)
+	    {
+		    if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellIconID == 548 && (*i)->GetId() == 58943)) // Mind Flay & Da Voodoo Shuffle
+		    {
+			    if ((*i)->GetMiscValue() == misc_value)
+				    modifier += (*i)->GetAmount();
+		    }
+	    }
+	    else
+	    {
+		    if ((*i)->GetMiscValue() == misc_value)
+			    modifier += (*i)->GetAmount();
+	    }
	 return modifier;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 6371124..682a51c 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1806,7 +1806,7 @@ class Unit : public WorldObject
		 int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect* except = NULL) const;
		 int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;

-	    int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
+	    int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value, SpellInfo const* spellProto = NULL) const;
		 float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const;
		 int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
		 int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;

And since this patch did break lots of stuff, I re-fixed it ontop of it :

diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index d9e5908..3d2e7d0 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4489,13 +4489,21 @@ int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value,
		 if (spellProto)
-		    // Mind Flay & Da Voodoo Shuffle
-		    if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellIconID == 548 && (*i)->GetId() == 58943))
+		    // Mind Flay - Prevent Da Vodoo Shuffle from affecting it
+		    if (spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellIconID == 548)
+		    {
+			    if ((*i)->GetId() != 58943)
+				    if ((*i)->GetMiscValue() == misc_value)
+					    modifier += (*i)->GetAmount();
+		    }
+		    // Any other case, even though a spellProto was provided - Just ignore the spellProto
+		    else
				 if ((*i)->GetMiscValue() == misc_value)
					 modifier += (*i)->GetAmount();
+	    // No SpellProto was provided, just add the modifier if miscValues matches
			 if ((*i)->GetMiscValue() == misc_value)
@@ -13124,7 +13132,7 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in
			 if (!(mechanic & 1<<i))
			 // Find total mod value (negative bonus)
-		    int32 new_durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, i);
+		    int32 new_durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, i, spellProto);
			 // Find max mod (negative bonus)
			 int32 new_durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, i);
			 // Check if mods applied before were weaker

Apply the first one, then the second. preferably by hand.

Thx to both of you, I actually saw your fix some time ago but since (as you said it yourself) it’s kind of a specific case workaround I would like to find some other way to fix it.

Kerhong, may I ask, when that aura is applied to me (for dmg infliction upon the target as you say) what is done code wise to prevent that spell’s aura effects (such as slowness in this case) to be applied to the caster?

Or maybe another aura is applied which is not exactly the whole Mind Flay package just some special aura that means dmg infliction?

Well after some looking around I thought this might do the trick (and it does):

--- /TrinityCore/src/server/game/Entities/Unit/Unit.cpp Tue Oct 18 18:34:17 2011

+++ /TrinityCore/src/server/game/Entities/Unit/Unit - Altered.cpp Tue Oct 18 19:05:57 2011

@@ -13040,9 +13040,18 @@

         int32 mechanic = spellProto->GetAllEffectsMechanicMask();

+        /*

+            Don't alter total duration value if aura applied effects include snaring effects and the target is the original caster

+            This pertains to cases such as that of Mind Flay and Da Voodoo Shuffle where the latter would cut the duration of the Mind Flay spell

+        */

+            if (target->GetTypeId() == TYPEID_PLAYER && target == this

+                && mechanic & 1<<MECHANIC_SNARE)            

+            return duration;


         int32 durationMod;

         int32 durationMod_always = 0;

         int32 durationMod_not_stack = 0;

         for (uint8 i = 1; i <= MECHANIC_ENRAGED; ++i)


but I am not sure that is even the right way to do it (very little experience with TC), could anyone more seasoned with TC could maybe give me some feedback on this?

And please if you have criticism, make it constructive, Thanks

How it works with reflected frostbolts/slow on troll mage?

opened pull request for a fix