aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authorQAston <none@none>2009-04-25 18:53:29 +0200
committerQAston <none@none>2009-04-25 18:53:29 +0200
commita00563a1278f0bc6f816750b3c92d0117eac913e (patch)
tree883cf925a8f07affd11bcdf794ea4bfa7c2a8ea5 /src/game/Unit.cpp
parentf89cd6318daba66d9761c1cdbf012210ca31f918 (diff)
*Fix deadly brew.
*Some changes in flag SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY. --HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index bd6e494c23a..1ebbd606c2f 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2890,10 +2890,6 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
if (pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
return SPELL_MISS_EVADE;
- // If Spel has this flag cannot be resisted/immuned/etc
- if (spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY)
- return SPELL_MISS_NONE;
-
// Check for immune
if (pVictim->IsImmunedToSpell(spell))
return SPELL_MISS_IMMUNE;
@@ -2903,9 +2899,8 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
if (IsPositiveSpell(spell->Id)
&&(!IsHostileTo(pVictim))) //prevent from affecting enemy by "positive" spell
return SPELL_MISS_NONE;
-
// Check for immune
- if (pVictim->IsImmunedToDamage(GetSpellSchoolMask(spell)))
+ if (pVictim->IsImmunedToDamage(spell))
return SPELL_MISS_IMMUNE;
if(this == pVictim)
@@ -9266,6 +9261,29 @@ bool Unit::IsImmunedToDamage(SpellSchoolMask shoolMask)
return false;
}
+bool Unit::IsImmunedToDamage(SpellEntry const* spellInfo)
+{
+ uint32 shoolMask = GetSpellSchoolMask(spellInfo);
+ 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)
+ && (spellInfo->Id != 42292))
+ {
+ //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 &&!IsDispelableBySpell(spellInfo, itr->spellId))
+ 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)
+ return true;
+
+ return false;
+}
+
bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
{
if (!spellInfo)
@@ -9283,7 +9301,7 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
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)) )
+ (itr->type & GetSpellSchoolMask(spellInfo)) && !IsDispelableBySpell(spellInfo, itr->spellId))
return true;
}
@@ -11635,7 +11653,6 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
if(!IsTriggeredAtSpellProcEvent(pTarget, triggerData.aura, procSpell, procFlag, procExtra, attType, isVictim, (damage > 0), triggerData.spellProcEvent))
continue;
-
for (uint8 i=0; i<MAX_SPELL_EFFECTS;++i)
{
if (AuraEffect * aurEff = itr->second->GetPartAura(i))
@@ -11646,7 +11663,6 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
// If not trigger by default and spellProcEvent==NULL - skip
if (!isTriggerAura[aurEff->GetAuraName()] && triggerData.spellProcEvent==NULL)
continue;
-
triggerData.effMask |= 1<<i;
}
}
@@ -12456,7 +12472,6 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry co
// Check spellProcEvent data requirements
if(!spellmgr.IsSpellProcEventCanTriggeredBy(spellProcEvent, EventProcFlag, procSpell, procFlag, procExtra, active))
return false;
-
// In most cases req get honor or XP from kill
if (EventProcFlag & PROC_FLAG_KILL && GetTypeId() == TYPEID_PLAYER)
{