mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[8649] Implement SPELL_AURA_MECHANIC_IMMUNITY_MASK (147) and related cleanups.
* Always use machanic masks in form (1 << (mech-1)), fix all cases. * Imppement SPELL_AURA_MECHANIC_IMMUNITY_MASK (mostly boss/elite spells). Note: db stored mechannic masks already stored in proper format so not affected.
This commit is contained in:
parent
369e50e068
commit
a4d61a6988
11 changed files with 158 additions and 119 deletions
|
|
@ -4078,10 +4078,13 @@ void Unit::RemoveArenaAuras(bool onleave)
|
|||
// used to remove positive visible auras in arenas
|
||||
for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();)
|
||||
{
|
||||
if ( !(iter->second->GetSpellProto()->AttributesEx4 & (1<<21)) // don't remove stances, shadowform, pally/hunter auras
|
||||
&& !iter->second->IsPassive() // don't remove passive auras
|
||||
&& (!(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) || !(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNK8)) // not unaffected by invulnerability auras or not having that unknown flag (that seemed the most probable)
|
||||
&& (iter->second->IsPositive() != onleave)) // remove positive buffs on enter, negative buffs on leave
|
||||
if (!(iter->second->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_UNK21) &&
|
||||
// don't remove stances, shadowform, pally/hunter auras
|
||||
!iter->second->IsPassive() && // don't remove passive auras
|
||||
(!(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) ||
|
||||
!(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNK8)) &&
|
||||
// not unaffected by invulnerability auras or not having that unknown flag (that seemed the most probable)
|
||||
(iter->second->IsPositive() != onleave)) // remove positive buffs on enter, negative buffs on leave
|
||||
RemoveAura(iter);
|
||||
else
|
||||
++iter;
|
||||
|
|
@ -5191,7 +5194,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
|
|||
if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) || this == pVictim)
|
||||
return false;
|
||||
// Need stun or root mechanic
|
||||
if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_ROOT)|(1<<MECHANIC_STUN))))
|
||||
if (!(GetAllSpellMechanicMask(procSpell) & IMMUNE_TO_ROOT_AND_STUN_MASK))
|
||||
return false;
|
||||
|
||||
switch (dummySpell->Id)
|
||||
|
|
@ -6355,7 +6358,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
|
|||
if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) || this == pVictim)
|
||||
return false;
|
||||
// Need snare or root mechanic
|
||||
if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_ROOT)|(1<<MECHANIC_SNARE))))
|
||||
if (!(GetAllSpellMechanicMask(procSpell) & IMMUNE_TO_ROOT_AND_SNARE_MASK))
|
||||
return false;
|
||||
triggered_spell_id = 61258;
|
||||
target = this;
|
||||
|
|
@ -7159,7 +7162,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
|
|||
return false;
|
||||
|
||||
// Need stun, fear or silence mechanic
|
||||
if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_SILENCE)|(1<<MECHANIC_STUN)|(1<<MECHANIC_FEAR))))
|
||||
if (!(GetAllSpellMechanicMask(procSpell) & IMMUNE_TO_SILENCE_AND_STUN_AND_FEAR_MASK))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
|
@ -7169,7 +7172,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
|
|||
if(!procSpell)
|
||||
return false;
|
||||
// Need Interrupt or Silenced mechanic
|
||||
if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_INTERRUPT)|(1<<MECHANIC_SILENCE))))
|
||||
if (!(GetAllSpellMechanicMask(procSpell) & IMMUNE_TO_INTERRUPT_AND_SILENCE_MASK))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
|
@ -8964,8 +8967,9 @@ int32 Unit::SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit *pVi
|
|||
int32 AdvertisedBenefit = 0;
|
||||
AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_HEALING);
|
||||
for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i)
|
||||
if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0)
|
||||
if ((*i)->GetModifier()->m_miscvalue & schoolMask)
|
||||
AdvertisedBenefit += (*i)->GetModifier()->m_amount;
|
||||
|
||||
return AdvertisedBenefit;
|
||||
}
|
||||
|
||||
|
|
@ -8974,13 +8978,13 @@ bool Unit::IsImmunedToDamage(SpellSchoolMask shoolMask)
|
|||
//If m_immuneToSchool type contain this school type, IMMUNE damage.
|
||||
SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
|
||||
for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
|
||||
if(itr->type & shoolMask)
|
||||
if (itr->type & shoolMask)
|
||||
return true;
|
||||
|
||||
//If m_immuneToDamage type contain magic, IMMUNE damage.
|
||||
SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
|
||||
for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
|
||||
if(itr->type & shoolMask)
|
||||
if (itr->type & shoolMask)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -8996,26 +9000,30 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
|
|||
|
||||
SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL];
|
||||
for(SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr)
|
||||
if(itr->type == spellInfo->Dispel)
|
||||
if (itr->type == spellInfo->Dispel)
|
||||
return true;
|
||||
|
||||
if( !(spellInfo->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) && // unaffected by school immunity
|
||||
if (!(spellInfo->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) && // unaffected by school immunity
|
||||
!(spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)) // can remove immune (by dispell or immune it)
|
||||
{
|
||||
SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
|
||||
for(SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
|
||||
if( !(IsPositiveSpell(itr->spellId) && IsPositiveSpell(spellInfo->Id)) &&
|
||||
(itr->type & GetSpellSchoolMask(spellInfo)) )
|
||||
if (!(IsPositiveSpell(itr->spellId) && IsPositiveSpell(spellInfo->Id)) &&
|
||||
(itr->type & GetSpellSchoolMask(spellInfo)))
|
||||
return true;
|
||||
}
|
||||
|
||||
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
|
||||
for(SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
|
||||
if(uint32 mechanic = spellInfo->Mechanic)
|
||||
{
|
||||
if(itr->type == spellInfo->Mechanic)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
|
||||
for(SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
|
||||
if (itr->type == mechanic)
|
||||
return true;
|
||||
|
||||
AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MECHANIC_IMMUNITY_MASK);
|
||||
for(AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
|
||||
if ((*iter)->GetModifier()->m_miscvalue & (1 << (mechanic-1)))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -9027,14 +9035,19 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) con
|
|||
uint32 effect = spellInfo->Effect[index];
|
||||
SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT];
|
||||
for (SpellImmuneList::const_iterator itr = effectList.begin(); itr != effectList.end(); ++itr)
|
||||
if(itr->type == effect)
|
||||
if (itr->type == effect)
|
||||
return true;
|
||||
|
||||
if(uint32 mechanic = spellInfo->EffectMechanic[index])
|
||||
{
|
||||
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
|
||||
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
|
||||
if(itr->type == mechanic)
|
||||
if (itr->type == mechanic)
|
||||
return true;
|
||||
|
||||
AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MECHANIC_IMMUNITY_MASK);
|
||||
for(AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
|
||||
if ((*iter)->GetModifier()->m_miscvalue & (1 << (mechanic-1)))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -9042,8 +9055,9 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) con
|
|||
{
|
||||
SpellImmuneList const& list = m_spellImmune[IMMUNITY_STATE];
|
||||
for(SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr)
|
||||
if(itr->type == aura)
|
||||
if (itr->type == aura)
|
||||
return true;
|
||||
|
||||
// Check for immune to application of harmful magical effects
|
||||
AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL);
|
||||
for(AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
|
||||
|
|
@ -9058,13 +9072,13 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) con
|
|||
|
||||
bool Unit::IsDamageToThreatSpell(SpellEntry const * spellInfo) const
|
||||
{
|
||||
if(!spellInfo)
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
uint32 family = spellInfo->SpellFamilyName;
|
||||
uint64 flags = spellInfo->SpellFamilyFlags;
|
||||
|
||||
if((family == 5 && flags == 256) || //Searing Pain
|
||||
if ((family == 5 && flags == 256) || //Searing Pain
|
||||
(family == 6 && flags == 8192) || //Mind Blast
|
||||
(family == 11 && flags == 1048576)) //Earth Shock
|
||||
return true;
|
||||
|
|
@ -9074,10 +9088,10 @@ bool Unit::IsDamageToThreatSpell(SpellEntry const * spellInfo) const
|
|||
|
||||
uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType attType, SpellEntry const *spellProto, DamageEffectType damagetype, uint32 stack)
|
||||
{
|
||||
if(!pVictim)
|
||||
if (!pVictim)
|
||||
return pdamage;
|
||||
|
||||
if(pdamage == 0)
|
||||
if (pdamage == 0)
|
||||
return pdamage;
|
||||
|
||||
// differentiate for weapon damage based spells
|
||||
|
|
@ -9089,7 +9103,7 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att
|
|||
|
||||
// Shred also have bonus as MECHANIC_BLEED damages
|
||||
if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008000))
|
||||
mechanicMask |= (1 << MECHANIC_BLEED);
|
||||
mechanicMask |= (1 << (MECHANIC_BLEED-1));
|
||||
|
||||
|
||||
// FLAT damage bonus auras
|
||||
|
|
@ -12416,6 +12430,31 @@ void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo)
|
|||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveAurasAtMechanicImmunity(uint32 mechMask, uint32 exceptSpellId, bool non_positive /*= false*/)
|
||||
{
|
||||
Unit::AuraMap& auras = GetAuras();
|
||||
for(Unit::AuraMap::iterator iter = auras.begin(); iter != auras.end();)
|
||||
{
|
||||
SpellEntry const *spell = iter->second->GetSpellProto();
|
||||
if (spell->Id == exceptSpellId)
|
||||
++iter;
|
||||
else if (non_positive && iter->second->IsPositive())
|
||||
++iter;
|
||||
else if (spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY)
|
||||
++iter;
|
||||
else if (GetSpellMechanicMask(spell, iter->second->GetEffIndex()) & mechMask)
|
||||
{
|
||||
RemoveAurasDueToSpell(spell->Id);
|
||||
if(auras.empty())
|
||||
break;
|
||||
else
|
||||
iter = auras.begin();
|
||||
}
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
{
|
||||
if(newPhaseMask==GetPhaseMask())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue