Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Spell::SpellEffectApplyAura(uint32 i) // Apply Aura
- {
- if( unitTarget == NULL )
- return;
- // can't apply stuns/fear/polymorph/root etc on boss
- if( unitTarget->IsCreature() )
- {
- if( u_caster != NULL && ( u_caster != unitTarget ) )
- {
- Creature * c = TO< Creature* >( unitTarget );
- /*
- Charm (Mind Control, enslave demon): 1
- Confuse (Blind etc): 2
- Fear: 4
- Root: 8
- Silence : 16
- Stun: 32
- Sheep: 64
- Banish: 128
- Sap: 256
- Frozen : 512
- Ensnared 1024
- Sleep 2048
- Taunt (aura): 4096
- Decrease Speed (Hamstring) (aura): 8192
- Spell Haste (Curse of Tongues) (aura): 16384
- Interrupt Cast: 32768
- Mod Healing % (Mortal Strike) (aura): 65536
- Total Stats % (Vindication) (aura): 131072
- */
- //Spells with Mechanic also add other ugly auras, but if the main aura is the effect --> immune to whole spell
- if (c->GetProto()->modImmunities)
- {
- bool immune = false;
- if (m_spellInfo->MechanicsType)
- {
- switch(m_spellInfo->MechanicsType)
- {
- case MECHANIC_CHARMED:
- if (c->GetProto()->modImmunities & 1)
- immune = true;
- break;
- case MECHANIC_DISORIENTED:
- if (c->GetProto()->modImmunities & 2)
- immune = true;
- break;
- case MECHANIC_FLEEING:
- if (c->GetProto()->modImmunities & 4)
- immune = true;
- break;
- case MECHANIC_ROOTED:
- if (c->GetProto()->modImmunities & 8)
- immune = true;
- break;
- case MECHANIC_SILENCED:
- if ( c->GetProto()->modImmunities & 16)
- immune = true;
- break;
- case MECHANIC_STUNNED:
- if (c->GetProto()->modImmunities & 32)
- immune = true;
- break;
- case MECHANIC_POLYMORPHED:
- if (c->GetProto()->modImmunities & 64)
- immune = true;
- break;
- case MECHANIC_BANISHED:
- if (c->GetProto()->modImmunities & 128)
- immune = true;
- break;
- case MECHANIC_SAPPED:
- if (c->GetProto()->modImmunities & 256)
- immune = true;
- break;
- case MECHANIC_FROZEN:
- if (c->GetProto()->modImmunities & 512)
- immune = true;
- break;
- case MECHANIC_ENSNARED:
- if (c->GetProto()->modImmunities & 1024)
- immune = true;
- break;
- case MECHANIC_ASLEEP:
- if (c->GetProto()->modImmunities & 2048)
- immune = true;
- break;
- }
- }
- if (!immune)
- {
- // Spells that do more than just one thing (damage and the effect) don't have a mechanic and we should only cancel the aura to be placed
- switch (m_spellInfo->EffectApplyAuraName[i])
- {
- case SPELL_AURA_MOD_CONFUSE:
- if (c->GetProto()->modImmunities & 2)
- immune = true;
- break;
- case SPELL_AURA_MOD_FEAR:
- if (c->GetProto()->modImmunities & 4)
- immune = true;
- break;
- case SPELL_AURA_MOD_TAUNT:
- if (c->GetProto()->modImmunities & 4096)
- immune = true;
- break;
- case SPELL_AURA_MOD_STUN:
- if (c->GetProto()->modImmunities & 32)
- immune = true;
- break;
- case SPELL_AURA_MOD_SILENCE:
- if ((c->GetProto()->modImmunities & 32768) || (c->GetProto()->modImmunities & 16))
- immune = true;
- break;
- case SPELL_AURA_MOD_DECREASE_SPEED:
- if (c->GetProto()->modImmunities & 8192)
- immune = true;
- break;
- case SPELL_AURA_INCREASE_CASTING_TIME_PCT:
- if (c->GetProto()->modImmunities & 16384)
- immune = true;
- break;
- case SPELL_AURA_MOD_LANGUAGE: //hacky way to prefer that the COT icon is set to mob
- if (c->GetProto()->modImmunities & 16384)
- immune = true;
- break;
- case SPELL_AURA_MOD_HEALING_DONE_PERCENT:
- if (c->GetProto()->modImmunities & 65536)
- immune = true;
- break;
- case SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE:
- if (c->GetProto()->modImmunities & 131072)
- immune = true;
- break;
- }
- }
- if( immune )
- return;
- }
- }
- }
- #ifdef GM_Z_DEBUG_DIRECTLY
- else {
- if( unitTarget->IsPlayer() && unitTarget->IsInWorld() && TO< Player* >( unitTarget )->GetSession() && TO< Player* >( unitTarget )->GetSession()->CanUseCommand('z') ) {
- sChatHandler.BlueSystemMessage( TO< Player* >( unitTarget )->GetSession(), "[%sSystem%s] |rSpell::SpellEffectApplyAura: %s EffectApplyAuraName [%u] .", MSG_COLOR_WHITE, MSG_COLOR_LIGHTBLUE, MSG_COLOR_SUBWHITE,
- i );
- }
- }
- #endif
- // avoid map corruption.
- if(unitTarget->GetInstanceID() != m_caster->GetInstanceID())
- return;
- //check if we already have stronger aura
- Aura *pAura;
- std::map<uint64, Aura*>::iterator itr = m_pendingAuras.find(unitTarget->GetGUID());
- //if we do not make a check to see if the aura owner is the same as the caster then we will stack the 2 auras and they will not be visible client sided
- if(itr == m_pendingAuras.end())
- {
- if( GetProto()->NameHash == SPELL_HASH_BLOOD_FRENZY && ProcedOnSpell )//Warrior's Blood Frenzy
- GetProto()->DurationIndex = ProcedOnSpell->DurationIndex;
- uint32 Duration = GetDuration();
- // Handle diminishing returns, if it should be resisted, it'll make duration 0 here.
- if(!(GetProto()->Attributes & ATTRIBUTES_PASSIVE)) // Passive
- ::ApplyDiminishingReturnTimer(&Duration, unitTarget, GetProto());
- if(!Duration)
- {
- SendCastResult(SPELL_FAILED_IMMUNE);
- return;
- }
- if( g_caster && g_caster->GetUInt32Value(OBJECT_FIELD_CREATED_BY) && g_caster->m_summoner )
- pAura = new Aura( GetProto(), Duration, g_caster->m_summoner, unitTarget, m_triggeredSpell, i_caster );
- else
- pAura = new Aura( GetProto(), Duration, m_caster, unitTarget, m_triggeredSpell, i_caster );
- pAura->pSpellId = pSpellId; //this is required for triggered spells
- m_pendingAuras.insert(std::make_pair(unitTarget->GetGUID(), pAura));
- AddRef();
- sEventMgr.AddEvent(this, &Spell::HandleAddAura, unitTarget->GetGUID(), EVENT_SPELL_HIT, 100, 1, 0);
- }
- else
- {
- pAura = itr->second;
- }
- pAura->AddMod( GetProto()->EffectApplyAuraName[i], damage, GetProto()->EffectMiscValue[i], i );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement