diff options
| author | Giuseppe Montesanto <montesanto.giuseppe@live.it> | 2011-12-14 16:13:10 +0100 |
|---|---|---|
| committer | Giuseppe Montesanto <montesanto.giuseppe@live.it> | 2011-12-14 16:13:10 +0100 |
| commit | 72e48ef8b3f0115dfa509c5e9a14d7738cb85b59 (patch) | |
| tree | 517e8ce9e7733b7592db1408053694ce20d53386 /src/server/game/Entities/Unit | |
| parent | f5b3553bb3e6cf9d055cfdc7f230e3ddaeea559b (diff) | |
Fix immunity system for many spells.
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 2e2f5591a5d..8997fad9d0d 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11448,7 +11448,8 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) return true; } - if (spellInfo->Mechanic) + // Spells that don't have effectMechanics. + if (!spellInfo->HasAnyEffectMechanic() && spellInfo->Mechanic) { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) @@ -11456,14 +11457,19 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) return true; } - for (int i = 0; i < MAX_SPELL_EFFECTS; ++i) + bool immuneToAllEffects = true; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { // State/effect immunities applied by aura expect full spell immunity // Ignore effects with mechanic, they are supposed to be checked separately - if (!spellInfo->Effects[i].Mechanic) - if (IsImmunedToSpellEffect(spellInfo, i)) - return true; + if (spellInfo->Effects[i].Mechanic || !IsImmunedToSpellEffect(spellInfo, i)) + { + immuneToAllEffects = false; + break; + } } + if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects. + return true; if (spellInfo->Id != 42292 && spellInfo->Id !=59752) { |
