Grounding Totem

Hi,

I do this first time, so have patience with me /emoticons/default_smile.png and sorry for my bad English.

Shaman spell Grounding totem works on TC:

Any Spell which is redirected destroy totem this is ok, but not when spellinfo

There are 2 kinds of spell Instant hit and travell spells (or ->speed == 0 and ->speed > 0)

Travell spell cant destroy totem when spellinfo. GT is destroyed at hit.

Another bug in TC is

If GT is alive and harm spell hit shaman; GT die (destroy)

I have one teory about mechanic GT

GT is destroyed:

When spell hit = damage > totem HP + absorb effects

When spell hit = immuned or damage < totem hp + absorb; then totem still redirecting spells for 0.600s and then die

GT have immunities like any other totem.

Code:

[CODE]@@ -9738,23 +9738,41 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo)

     return NULL;


 // Magic case
  • if (spellInfo && (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC))

  • {

  •    //I am not sure if this should be redirected.
    
  •    if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE)
    
  •        return victim;
    
  •    Unit::AuraEffectList const& magnetAuras = victim->GetAuraEffectsByType(SPELL_AURA_SPELL_MAGNET);
    
  •    for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
    
  •        if (Unit* magnet = (*itr)->GetBase()->GetUnitOwner())
    
  •            if (magnet->isAlive())
    
  •            {
    
  •                (*itr)->GetBase()->DropCharge();
    
  •                return magnet;
    
  •            }
    
  • }

  • // Melee && ranged case

  • else

  • if (spellInfo && (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC))

  • {

  •   if (victim->HasAura(8178)) //Grounding totem    
    
  •   {           
    
  •   	for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)         
    
  •   	{               
    
  •   		if (spellInfo->EffectApplyAuraName[j] == SPELL_AURA_MOD_TAUNT && spellInfo->EffectApplyAuraName[j] != 49560)                      
    
  •   			return victim;// Death Grip        
    
  •   	}          
    
  •   	if (spellInfo->SpellIconID == 2818 && spellInfo->AttributesEx != 335561860) // PENANCE in Group                
    
  •   		return victim;        
    
  •   	if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE && !IsChanneledSpell(spellInfo))              
    
  •   		return victim;
    
  •   }      
    
  •   else
    
  •   	//I am not sure if this should be redirected.          
    
  •   	if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE)   
    
  •   		return victim;
    
  •   Unit::AuraEffectList const& magnetAuras = victim->GetAuraEffectsByType(SPELL_AURA_SPELL_MAGNET);
    
  •   for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
    
  •   	if (Unit* magnet = (*itr)->GetBase()->GetUnitOwner())
    
  •   		if (magnet->isAlive())              
    
  •   			if (magnet->HasAura(8178)) // Grounding totem
    
  •   				return magnet;
    
  •   			else            
    
  •   			{                   
    
  •   				(*itr)->GetBase()->DropCharge();                   
    
  •   				return magnet;              
    
  •   			}
    
  • }

  • // Melee && ranged case

  • else

    {

     AuraEffectList const& hitTriggerAuras = victim->GetAuraEffectsByType(SPELL_AURA_ADD_CASTER_HIT_TRIGGER);
    
     for (AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i)
    

@@ -13813,6 +13831,20 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit * pTarget, uint32 procFlag,

         }

     }

 }
  • if (GetEntry() == 5925) //Grounding totem and (wand, periodic effects)

  •   if (HasAura(8178))		   
    
  •   	for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)              
    
  •   		if (procSpell && procSpell->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && (procSpell->Id == 5019 || procSpell->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || procSpell->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH || procSpell->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE_PERCENT)) // wand proc
    
  •   		{
    
  •   			Aura * aura = GetAura(8178);
    
  •   			if (aura->GetMaxDuration() != 0)
    
  •   			{                         	
    
  •   				aura->SetMaxDuration(0);                    	
    
  •   				AuraEffect * aurEff = GetAuraEffect(8179, 0);	
    
  •   				aurEff->SetPeriodicTimer(10000);                      	
    
  •   				aura->SetDuration(600); 
    
  •   			}
    
  •   		}
    

    ProcTriggeredList procTriggered;

    // Fill procTriggered list

@@ -14056,6 +14088,22 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit * pTarget, uint32 procFlag,

                 break;

         }

     }
  •   if (Id == 8178) //Grounding totem bug after spell hit shaman
    
  •   	takeCharges = false;
    
  •   if (GetEntry() == 5925) //Grounding totem (other spells)
    
  •   	if (HasAura(8178))
    
  •   		if (procSpell && (procSpell->DmgClass == SPELL_DAMAGE_CLASS_NONE || procSpell->DmgClass == SPELL_DAMAGE_CLASS_MAGIC))
    
  •   		{
    
  •   			Aura * aura = GetAura(8178);
    
  •   			if (aura->GetMaxDuration() != 0)
    
  •   			{                         	
    
  •   				aura->SetMaxDuration(0);                    	
    
  •   				AuraEffect * aurEff = GetAuraEffect(8179, 0);	
    
  •   				aurEff->SetPeriodicTimer(10000);                      	
    
  •   				aura->SetDuration(600); 
    
  •   			}
    
  •   		}
    
       // Remove charge (aura can be removed by triggers)
    
       if (useCharges && takeCharges)
    
           i->aura->DropCharge();
    

@@ -1666,6 +1666,12 @@ bool Spell::UpdateChanneledTargetList()

         modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);

 }
  • //If target has Grounding totem aura and totem is not in range of channeling spell

  • if (Unit *Ttarget = m_targets.getUnitTarget())

  •   if (!IsAreaOfEffectSpell(m_spellInfo) && m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE && IsChanneledSpell(m_spellInfo))       
    
  •   	if (Ttarget->GetEntry() == 5925)          
    
  •   		range += 31;
    
 for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)

 {

     if (ihit->missCondition == SPELL_MISS_NONE && (channelTargetEffectMask & ihit->effectMask))

@@ -6477,8 +6483,8 @@ bool Spell::CheckTargetCreatureType(Unit* target) const

 if (m_spellInfo->Id == 2641 || m_spellInfo->Id == 23356)

     spellCreatureTargetMask =  0;
  • // Polymorph and Grounding Totem

  • if (target->GetEntry() == 5925 && m_spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellInfo->SpellFamilyFlags[0] & 0x1000000) && m_spellInfo->EffectApplyAuraName[0] == SPELL_AURA_MOD_CONFUSE)

  • // Grounding Totem

  • if (target->GetEntry() == 5925 && spellCreatureTargetMask && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC))

    return true;
    

    if (spellCreatureTargetMask)

@@ -164,11 +164,14 @@ void Totem::UnSummon()

bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const

{

 // TODO: possibly all negative auras immune?
  • if (GetEntry() == 5925)

  •    return false;
    
  • //if (GetEntry() == 5925)

  •    //return false;
    

    switch(spellInfo->EffectApplyAuraName[index])

    {

  •    case SPELL_AURA_PERIODIC_DAMAGE:
    
  •    case SPELL_AURA_PERIODIC_DAMAGE:       
    
  •   	for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)  
    
  •   		if (spellInfo->Effect[i] == SPELL_EFFECT_SCHOOL_DAMAGE)                                       
    
  •   			return false;
    
       case SPELL_AURA_PERIODIC_LEECH:
    
       case SPELL_AURA_MOD_FEAR:
    
       case SPELL_AURA_TRANSFORM:
    

[/CODE]

Ask and say what do you thing.

@Code edit 23.01.2011

Self Channel spell cause crash. Fixed

@Code edit 30.01.2011

i must admit, i didn’t understand all, you’ve written, but if it’s just about the totem not dying upon redirecting any spell, than this could be solved quite simple.

don’t know if this is fully, blizzlike, but hey ^^


diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp

index 4f67d9c..36c2e3e 100755

--- a/src/server/game/Entities/Unit/Unit.cpp

+++ b/src/server/game/Entities/Unit/Unit.cpp

@@ -9747,9 +9747,14 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo)

         Unit::AuraEffectList const& magnetAuras = victim->GetAuraEffectsByType(SPELL_AURA_SPELL_MAGNET);

         for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)

             if (Unit* magnet = (*itr)->GetBase()->GetUnitOwner())

-                if (magnet->isAlive())

+                if (magnet->isAlive() && IsWithinLOSInMap(magnet))

                 {

                     (*itr)->GetBase()->DropCharge();

+

+                    // Totems are destroyed upon redirection

+                    if (magnet->ToTotem())

+                        magnet->DealDamage(magnet, magnet->GetMaxHealth());

+

                     return magnet;

                 }

     }

as i understand need make “Redirect” from player or his party/raid to totem when it get a “redicerted” spell it die. i am no have any ideas at the moment. bu i think for that need 1-5 code lines =]

Hmmm I must better explain it. The main thing about this is WHEN the Grounding totem is destroyed.

Spell which is redirected by Grounding totem destroy the totem instantly. Because of

[CODE] if (spellInfo && (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC))

            if (magnet->isAlive())


					(*itr)->GetBase()->DropCharge();[/CODE]

Because of another thing in void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)

But this is not correct. Totem must be destroyed after spell hit but still is here another condition. If spell hit damage > Grounding totem Hp + absorb effect totem is destroyed normally and do not redirect another spells

But If spell hit damage < Grounding totem Hp + absorb effect or Immuned or no-damage or miss.

Then The totem redirecting spells for 0.6s and then die. The time I get from one video with stopwath. This note from WoWwiki confirm my teory

It is possible, though rare, for a Grounding Totem to be able to absorb more than one direct damage spell. This typically can happen if the two spells finish casting before the totem is hit by the initial spell. Being as how spells with a travel time (such as Frostbolt) do not damage the target until the projectile hits, the totem will redirect any of these types of spells until it takes damage and summarily gets destroyed (after which the Grounding Totem buff will be removed).

0001-Grounding-totem-Fix.patch

In my server grounding totem it’s working, but polymorph,hex and rep not, any ideas how to fix?

me too.


Fix by dr.skul is very old, the code is very different to the new trinitycore.

Somebody have the fix?

— Canned message start —

You smell that? It was this thread rotting.

You just played:

http://img227.imageshack.us/img227/8899/threadnecromancerji6.jpg

Just kidding /emoticons/default_smile.png but seriously if you need help and search shows no relevant results please make your own topic so it can get the attention it deserves.

— Canned message end —

update please patch for last rev