aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellEffects.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2008-12-21 12:33:03 -0600
committermegamage <none@none>2008-12-21 12:33:03 -0600
commit81a860e781b3b8e0b1daa20e8ab86c92c03f9e07 (patch)
tree72cf94b56c7b451b143b0ef5343118d0e2d8359f /src/game/SpellEffects.cpp
parent34fbc26a07c3e95dfb68dec3753f10072046f8c4 (diff)
*Let vanish interrupt enemies' casting.
--HG-- branch : trunk
Diffstat (limited to 'src/game/SpellEffects.cpp')
-rw-r--r--src/game/SpellEffects.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 271b4ad68da..8581a81d5ef 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -58,6 +58,8 @@
#include "TemporarySummon.h"
#include "ScriptCalls.h"
#include "CellImpl.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
{
@@ -5002,7 +5004,25 @@ void Spell::EffectSanctuary(uint32 /*i*/)
{
if(!unitTarget)
return;
- //unitTarget->CombatStop();
+
+ std::list<Unit*> targets;
+ Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(unitTarget, unitTarget, World::GetMaxVisibleDistance());
+ Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(targets, u_check);
+ unitTarget->VisitNearbyObject(World::GetMaxVisibleDistance(), searcher);
+ for(std::list<Unit*>::iterator iter = targets.begin(); iter != targets.end(); ++iter)
+ {
+ if(!(*iter)->hasUnitState(UNIT_STAT_CASTING))
+ continue;
+
+ for(uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
+ {
+ if((*iter)->m_currentSpells[i]
+ && (*iter)->m_currentSpells[i]->m_targets.getUnitTargetGUID() == unitTarget->GetGUID())
+ {
+ (*iter)->InterruptSpell(i, false);
+ }
+ }
+ }
unitTarget->CombatStop();
unitTarget->getHostilRefManager().deleteReferences(); // stop all fighting