diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 10 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 4 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 4 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Totem/Totem.cpp | 4 | ||||
| -rw-r--r-- | src/server/game/Entities/Totem/Totem.h | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 30 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 4 | ||||
| -rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 4 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 2 | 
11 files changed, 37 insertions, 37 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index c8b39205199..2d6a5d3ded4 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1824,7 +1824,7 @@ void Creature::DespawnOrUnsummon(uint32 msTimeToDespawn /*= 0*/, Seconds const&          ForcedDespawn(msTimeToDespawn, forceRespawnTimer);  } -bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) const +bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster) const  {      if (!spellInfo)          return false; @@ -1840,7 +1840,7 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) const      {          if (!spellInfo->Effects[i].IsEffect())              continue; -        if (!IsImmunedToSpellEffect(spellInfo, i)) +        if (!IsImmunedToSpellEffect(spellInfo, i, caster))          {              immunedToAllEffects = false;              break; @@ -1849,10 +1849,10 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) const      if (immunedToAllEffects)          return true; -    return Unit::IsImmunedToSpell(spellInfo); +    return Unit::IsImmunedToSpell(spellInfo, caster);  } -bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const +bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const  {      if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Effects[index].Mechanic - 1)))          return true; @@ -1860,7 +1860,7 @@ bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index)      if (GetCreatureTemplate()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effects[index].Effect == SPELL_EFFECT_HEAL)          return true; -    return Unit::IsImmunedToSpellEffect(spellInfo, index); +    return Unit::IsImmunedToSpellEffect(spellInfo, index, caster);  }  bool Creature::isElite() const diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 98ba6e5ccea..4f770cedb7b 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -469,8 +469,8 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma          bool isCanInteractWithBattleMaster(Player* player, bool msg) const;          bool isCanTrainingAndResetTalentsOf(Player* player) const;          bool CanCreatureAttack(Unit const* victim, bool force = true) const; -        bool IsImmunedToSpell(SpellInfo const* spellInfo) const override;                     // override Unit::IsImmunedToSpell -        bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const override; // override Unit::IsImmunedToSpellEffect +        bool IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster) const override; +        bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const override;          bool isElite() const;          bool isWorldBoss() const; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f964d668121..1faba46ec83 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2162,7 +2162,7 @@ void Player::RemoveFromWorld()      }  } -bool Player::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const +bool Player::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const  {      // players are immune to taunt (the aura and the spell effect)      if (spellInfo->Effects[index].IsAura(SPELL_AURA_MOD_TAUNT)) @@ -2170,7 +2170,7 @@ bool Player::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) co      if (spellInfo->Effects[index].IsEffect(SPELL_EFFECT_ATTACK_ME))          return true; -    return Unit::IsImmunedToSpellEffect(spellInfo, index); +    return Unit::IsImmunedToSpellEffect(spellInfo, index, caster);  }  void Player::RegenerateAll() diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 256deef4d73..f5552772b54 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1065,7 +1065,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>          static bool BuildEnumData(PreparedQueryResult result, WorldPacket* data); -        bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const override; +        bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const override;          void SetInWater(bool apply); diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index 5e8544246a6..e4d6c032930 100644 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -149,7 +149,7 @@ void Totem::UnSummon(uint32 msTime)      AddObjectToRemoveList();  } -bool Totem::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const +bool Totem::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const  {      /// @todo possibly all negative auras immune?      if (GetEntry() == 5925) @@ -166,5 +166,5 @@ bool Totem::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) con              break;      } -    return Creature::IsImmunedToSpellEffect(spellInfo, index); +    return Creature::IsImmunedToSpellEffect(spellInfo, index, caster);  } diff --git a/src/server/game/Entities/Totem/Totem.h b/src/server/game/Entities/Totem/Totem.h index 42be4525a0c..55605087a75 100644 --- a/src/server/game/Entities/Totem/Totem.h +++ b/src/server/game/Entities/Totem/Totem.h @@ -55,7 +55,7 @@ class TC_GAME_API Totem : public Minion          void UpdateAttackPowerAndDamage(bool /*ranged*/) override { }          void UpdateDamagePhysical(WeaponAttackType /*attType*/) override { } -        bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const override; +        bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const override;      protected:          TotemType m_type; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6212ea6a836..9e8f5cc9ed1 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2674,13 +2674,13 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo  //   Parry  // For spells  //   Resist -SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spellInfo, bool CanReflect) +SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spellInfo, bool canReflect /*= false*/)  {      if (spellInfo->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT))          return SPELL_MISS_NONE;      // Check for immune -    if (victim->IsImmunedToSpell(spellInfo)) +    if (victim->IsImmunedToSpell(spellInfo, this))          return SPELL_MISS_IMMUNE;      // Damage immunity is only checked if the spell has damage effects, this immunity must not prevent aura apply @@ -2701,7 +2701,7 @@ SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spellInfo, boo          return SPELL_MISS_EVADE;      // Try victim reflect spell -    if (CanReflect) +    if (canReflect)      {          int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);          Unit::AuraEffectList const& mReflectSpellsSchool = victim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL); @@ -7931,7 +7931,7 @@ bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) const      return false;  } -bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) const +bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster) const  {      if (!spellInfo)          return false; @@ -7964,7 +7964,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) const      {          // State/effect immunities applied by aura expect full spell immunity          // Ignore effects with mechanic, they are supposed to be checked separately -        if (!IsImmunedToSpellEffect(spellInfo, i)) +        if (!IsImmunedToSpellEffect(spellInfo, i, caster))          {              immuneToAllEffects = false;              break; @@ -7981,7 +7981,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) const          {              SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->second);              if ((itr->first & spellInfo->GetSchoolMask()) -                && !(immuneSpellInfo && immuneSpellInfo->IsPositive() && spellInfo->IsPositive()) +                && !(immuneSpellInfo && immuneSpellInfo->IsPositive() && spellInfo->IsPositive() && IsFriendlyTo(caster))                  && !spellInfo->CanPierceImmuneAura(immuneSpellInfo))                  return true;          } @@ -8010,7 +8010,7 @@ uint32 Unit::GetMechanicImmunityMask() const      return mask;  } -bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const +bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const  {      if (!spellInfo || !spellInfo->Effects[index].IsEffect())          return false; @@ -8020,13 +8020,13 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons      // If m_immuneToEffect type contain this effect type, IMMUNE effect.      uint32 effect = spellInfo->Effects[index].Effect; -    auto const& effectList = m_spellImmune[IMMUNITY_EFFECT]; +    SpellImmuneContainer const& effectList = m_spellImmune[IMMUNITY_EFFECT];      if (effectList.count(effect) > 0)          return true;      if (uint32 mechanic = spellInfo->Effects[index].Mechanic)      { -        auto const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; +        SpellImmuneContainer const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];          if (mechanicList.count(mechanic) > 0)              return true;      } @@ -8044,8 +8044,8 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons                  // Check for immune to application of harmful magical effects                  AuraEffectList const& immuneAuraApply = GetAuraEffectsByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL);                  for (AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter) -                    if (((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) &&  // Check school -                        !spellInfo->IsPositiveEffect(index))                       // Harmful +                    if (((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) &&        // Check school +                        (!IsFriendlyTo(caster) || !spellInfo->IsPositiveEffect(index)))  // Harmful                          return true;              }          } @@ -12635,15 +12635,15 @@ Aura* Unit::AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target)      if (!spellInfo)          return NULL; -    if (target->IsImmunedToSpell(spellInfo)) +    if (target->IsImmunedToSpell(spellInfo, this))          return NULL;      for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)      { -        if (!(effMask & (1<<i))) +        if (!(effMask & (1 << i)))              continue; -        if (target->IsImmunedToSpellEffect(spellInfo, i)) -            effMask &= ~(1<<i); +        if (target->IsImmunedToSpellEffect(spellInfo, i, this)) +            effMask &= ~(1 << i);      }      if (Aura* aura = Aura::TryRefreshStackOrCreate(spellInfo, effMask, target, this)) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index a854e96606e..228929e4af6 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2022,13 +2022,13 @@ class TC_GAME_API Unit : public WorldObject          uint32 GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const;          void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); -        virtual bool IsImmunedToSpell(SpellInfo const* spellInfo) const; // redefined in Creature +        virtual bool IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster) const; // redefined in Creature          uint32 GetSchoolImmunityMask() const;          uint32 GetMechanicImmunityMask() const;          bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const;          bool IsImmunedToDamage(SpellInfo const* spellInfo) const; -        virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; // redefined in Creature +        virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const; // redefined in Creature          static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS);          uint32 CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType = MAX_ATTACK); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 084130ec999..7e605382e84 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -541,11 +541,11 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)          // check target immunities          for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)          { -            if (itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex)) +            if (itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex, caster))                  itr->second &= ~(1 << effIndex);          }          if (!itr->second -            || itr->first->IsImmunedToSpell(GetSpellInfo()) +            || itr->first->IsImmunedToSpell(GetSpellInfo(), caster)              || !CanBeAppliedOn(itr->first))              addUnit = false; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 7df1e75d021..a717ac97b68 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1177,7 +1177,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge              // find last added target for this effect              for (std::list<TargetInfo>::reverse_iterator ihit = m_UniqueTargetInfo.rbegin(); ihit != m_UniqueTargetInfo.rend(); ++ihit)              { -                if (ihit->effectMask & (1<<effIndex)) +                if (ihit->effectMask & (1 << effIndex))                  {                      referer = ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);                      break; @@ -2072,7 +2072,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=      // Check for effect immune skip if immuned      for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) -        if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex)) +        if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex, m_caster))              effectMask &= ~(1 << effIndex);      ObjectGuid targetGUID = target->GetGUID(); @@ -2542,7 +2542,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA          return SPELL_MISS_EVADE;      // For delayed spells immunity may be applied between missile launch and hit - check immunity for that case -    if (m_spellInfo->Speed && unit->IsImmunedToSpell(m_spellInfo)) +    if (m_spellInfo->Speed && unit->IsImmunedToSpell(m_spellInfo, m_caster))          return SPELL_MISS_IMMUNE;      // disable effects to which unit is immune @@ -2551,7 +2551,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA      {          if (effectMask & (1 << effectNumber))          { -            if (unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber)) +            if (unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber, m_caster))                  effectMask &= ~(1 << effectNumber);              else if (m_spellInfo->Effects[effectNumber].IsAura() && !m_spellInfo->IsPositiveEffect(effectNumber))              { diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 189f73d2a71..0937d916868 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3193,7 +3193,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)              }              if (m_spellInfo->SpellFamilyFlags[0] & 0x8000000) // Mocking Blow              { -                if (unitTarget->IsImmunedToSpellEffect(m_spellInfo, EFFECT_1) || unitTarget->GetTypeId() == TYPEID_PLAYER) +                if (unitTarget->IsImmunedToSpellEffect(m_spellInfo, EFFECT_1, m_caster) || unitTarget->GetTypeId() == TYPEID_PLAYER)                  {                      m_damage = 0;                      return;  | 
