Advertisement
Guest User

Untitled

a guest
Jul 18th, 2010
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.84 KB | None | 0 0
  1. diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
  2. index 3e6e790..3ecb4b8 100644
  3. --- a/src/game/Spell.cpp
  4. +++ b/src/game/Spell.cpp
  5. @@ -1949,6 +1950,29 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
  6.                  FillRaidOrPartyHealthPriorityTargets(targetUnitMap, m_caster, m_caster, radius, 1, true, false, true);
  7.              else if (m_spellInfo->Id == 54171)              // Divine Storm
  8.                  FillRaidOrPartyHealthPriorityTargets(targetUnitMap, m_caster, m_caster, radius, 3, true, false, true);
  9. +            else if (m_spellInfo->Id == 59725)              // Improved Spell Reflection
  10. +            {
  11. +                if (m_caster->HasAura(23920, EFFECT_INDEX_0) )
  12. +                    m_caster->RemoveAurasDueToSpell(23920);                     // will be replaced by imp. spell refl. aura
  13. +
  14. +                Unit::AuraList const& lDummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY);
  15. +                for(Unit::AuraList::const_iterator i = lDummyAuras.begin(); i != lDummyAuras.end(); ++i)
  16. +                {
  17. +                    if((*i)->GetSpellProto()->SpellIconID == 1935)
  18. +                    {
  19. +                        unMaxTargets = (*i)->GetModifier()->m_amount + 1;       // +1 because we are also applying this to the caster
  20. +                        break;
  21. +                    }
  22. +                }
  23. +
  24. +                radius = 20.0f;                                                 // as mentioned in the spell's tooltip (data doesn't appear in dbc)
  25. +
  26. +                FillRaidOrPartyTargets(targetUnitMap, m_caster, m_caster, radius, false, false, true);
  27. +                targetUnitMap.sort(TargetDistanceOrder(m_caster));
  28. +                if (targetUnitMap.size() > unMaxTargets)
  29. +                    targetUnitMap.resize(unMaxTargets);
  30. +                break;
  31. +            }
  32.              else
  33.                  FillRaidOrPartyTargets(targetUnitMap, m_caster, m_caster, radius, true, true, true);
  34.              break;
  35. diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
  36. index 17d4e5f..aace413 100644
  37. --- a/src/game/SpellAuras.cpp
  38. +++ b/src/game/SpellAuras.cpp
  39. @@ -78,7 +78,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
  40.      &Aura::HandleAuraModPacify,                             // 25 SPELL_AURA_MOD_PACIFY
  41.      &Aura::HandleAuraModRoot,                               // 26 SPELL_AURA_MOD_ROOT
  42.      &Aura::HandleAuraModSilence,                            // 27 SPELL_AURA_MOD_SILENCE
  43. -    &Aura::HandleNoImmediateEffect,                         // 28 SPELL_AURA_REFLECT_SPELLS        implement in Unit::SpellHitResult
  44. +    &Aura::HandleAuraModReflectSpells,                      // 28 SPELL_AURA_REFLECT_SPELLS        actual reflecting implemented in Unit::SpellHitResult
  45.      &Aura::HandleAuraModStat,                               // 29 SPELL_AURA_MOD_STAT
  46.      &Aura::HandleAuraModSkill,                              // 30 SPELL_AURA_MOD_SKILL
  47.      &Aura::HandleAuraModIncreaseSpeed,                      // 31 SPELL_AURA_MOD_INCREASE_SPEED
  48. @@ -4726,6 +4752,41 @@ void Aura::HandleAuraModSilence(bool apply, bool Real)
  49.      }
  50.  }
  51.  
  52. +void Aura::HandleAuraModReflectSpells(bool Apply, bool Real)
  53. +{
  54. +    if (!Real)
  55. +        return;
  56. +
  57. +    Unit* target = GetTarget();
  58. +    Unit* caster = GetCaster();
  59. +
  60. +    if (Apply)
  61. +    {
  62. +        switch(GetId() )
  63. +        {
  64. +            // Improved Spell Reflection
  65. +            case 23920:
  66. +            {
  67. +                if (!caster)
  68. +                    return;
  69. +
  70. +                Unit::AuraList const& lDummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY);
  71. +                for(Unit::AuraList::const_iterator i = lDummyAuras.begin(); i != lDummyAuras.end(); ++i)
  72. +                {
  73. +                    if((*i)->GetSpellProto()->SpellIconID == 1935)
  74. +                    {
  75. +                        caster->CastSpell(caster, 59725, true);
  76. +                        break;
  77. +                    }
  78. +                }
  79. +                break;
  80. +            }
  81. +            default:
  82. +                break;
  83. +        }
  84. +    }
  85. +}
  86. +
  87.  void Aura::HandleModThreat(bool apply, bool Real)
  88.  {
  89.      // only at real add/remove aura
  90. diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
  91. index ead9977..cf334a9 100644
  92. --- a/src/game/SpellAuras.h
  93. +++ b/src/game/SpellAuras.h
  94. @@ -119,6 +119,7 @@ class MANGOS_DLL_SPEC Aura
  95.          void HandleAuraModResistance(bool Apply, bool Real);
  96.          void HandleAuraModRoot(bool Apply, bool Real);
  97.          void HandleAuraModSilence(bool Apply, bool Real);
  98. +        void HandleAuraModReflectSpells(bool Apply, bool Real);
  99.          void HandleAuraModStat(bool Apply, bool Real);
  100.          void HandleAuraModIncreaseSpeed(bool Apply, bool Real);
  101.          void HandleAuraModIncreaseMountedSpeed(bool Apply, bool Real);
  102. diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
  103. index d56e6de..6d953c2 100644
  104. --- a/src/game/Unit.cpp
  105. +++ b/src/game/Unit.cpp
  106. @@ -13259,6 +13259,16 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
  107.                  removedSpells.push_back(triggeredByAura->GetId());
  108.          }
  109.  
  110. +        // If reflecting with Imp. Spell Reflection - we must also remove auras from the remaining aura's targets
  111. +        if (triggeredByAura->GetId() == 59725)
  112. +            if (Unit* pImpSRCaster = triggeredByAura->GetCaster() )
  113. +                if (Group* group = ((Player*)pImpSRCaster)->GetGroup())
  114. +                    for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
  115. +                        if (Player* member = itr->getSource())
  116. +                            if (Aura* pAura = member->GetAura(59725, EFFECT_INDEX_0) )
  117. +                                if (pAura->GetCaster() == pImpSRCaster)
  118. +                                    member->RemoveAura(pAura);
  119. +
  120.          triggeredByAura->SetInUse(false);
  121.      }
  122.      if (!removedSpells.empty())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement