aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeo2003 <none@none>2008-10-05 15:17:41 -0500
committerNeo2003 <none@none>2008-10-05 15:17:41 -0500
commitc2dc0b62ce4bfd34f0678bc9c9e4c4ae7eb99e4b (patch)
tree3329f9b73cd37207257e75e9b7e9a1d93cf73fac
parent843f789f58b73b5af6d8be46fe97448a341ceb8d (diff)
[svn] * Make Grounding totem disappear after any spell redirection
Patch provided by Albrecht de Endrau --HG-- branch : trunk
-rw-r--r--src/game/Spell.cpp18
-rw-r--r--src/game/Spell.h1
-rw-r--r--src/game/SpellAuras.h1
3 files changed, 18 insertions, 2 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index d97cc2c6f0d..7cefcc1de8f 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -267,6 +267,8 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_caster = Caster;
m_selfContainer = NULL;
m_triggeringContainer = triggeringContainer;
+ m_magnetPair.first = false;
+ m_magnetPair.second = NULL;
m_deletable = true;
m_delayAtDamageCount = 0;
@@ -947,6 +949,14 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if(!unit || !effectMask)
return;
+ // remove spell_magnet aura after first spell redirect and destroy target if its totem
+ if(m_magnetPair.first && m_magnetPair.second && m_magnetPair.second == unit)
+ {
+ if(unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->isTotem())
+ unit->DealDamage(unit,unit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ return;
+ }
+
// Recheck immune (only for delayed spells)
if( m_spellInfo->speed && (
unit->IsImmunedToDamage(GetSpellSchoolMask(m_spellInfo),true) ||
@@ -4837,7 +4847,7 @@ CurrentSpellTypes Spell::GetCurrentContainer()
bool Spell::CheckTarget( Unit* target, uint32 eff, bool hitPhase )
{
// Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets)
- if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_SELF )
+ if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_SELF && !m_magnetPair.first)
{
if (!CheckTargetCreatureType(target))
return false;
@@ -4918,8 +4928,12 @@ Unit* Spell::SelectMagnetTarget()
{
if(Unit* magnet = (*itr)->GetCaster())
{
- if(magnet->IsWithinLOSInMap(m_caster))
+ if((*itr)->m_procCharges>0 && magnet->IsWithinLOSInMap(m_caster))
{
+ (*itr)->SetAuraProcCharges((*itr)->m_procCharges-1);
+ m_magnetPair.first = true;
+ m_magnetPair.second = magnet;
+
target = magnet;
m_targets.setUnitTarget(target);
break;
diff --git a/src/game/Spell.h b/src/game/Spell.h
index d606fd71f34..62e5fdb40b2 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -335,6 +335,7 @@ class Spell
void SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap);
Unit* SelectMagnetTarget();
+ std::pair <bool,Unit *> m_magnetPair;
bool CheckTarget( Unit* target, uint32 eff, bool hitPhase );
void SendCastResult(uint8 result);
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 24b94202978..54beccf9dbf 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -283,6 +283,7 @@ class MANGOS_DLL_SPEC Aura
void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; }
int32 m_procCharges;
+ void SetAuraProcCharges(int32 charges) { m_procCharges = charges; }
virtual Unit* GetTriggerTarget() const { return m_target; }