aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Spell.cpp26
-rw-r--r--src/game/SpellEffects.cpp2
-rw-r--r--src/game/SpellMgr.cpp7
-rw-r--r--src/game/SpellMgr.h14
-rw-r--r--src/game/Unit.cpp12
5 files changed, 29 insertions, 32 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index c2463d9738a..4795d64bfcc 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1055,12 +1055,15 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
- if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 1))
+ if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id + 1000000))
{
- if(spell_triggered > 0)
- unit->CastSpell(unit, spell_triggered, true, 0, 0, m_caster->GetGUID());
- else
- unit->RemoveAurasDueToSpell(-spell_triggered);
+ for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
+ {
+ if(spell_triggered < 0)
+ unit->RemoveAurasDueToSpell(-(*i));
+ else
+ unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID());
+ }
}
}
@@ -2252,12 +2255,15 @@ void Spell::cast(bool skipCheck)
}
}
- if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 0))
+ if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id))
{
- if(spell_triggered > 0)
- m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, spell_triggered, true);
- else
- m_caster->RemoveAurasDueToSpell(-spell_triggered);
+ for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
+ {
+ if(spell_triggered < 0)
+ m_caster->RemoveAurasDueToSpell(-(*i));
+ else
+ m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, *i, true);
+ }
}
// traded items have trade slot instead of guid in m_itemTargetGUID
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 9ac2d4f2ded..45830146e67 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -2118,7 +2118,7 @@ void Spell::EffectApplyAura(uint32 i)
// Now Reduce spell duration using data received at spell hit
int32 duration = Aur->GetAuraMaxDuration();
- unitTarget->ApplyDiminishingToDuration(m_diminishGroup,duration,m_caster,m_diminishLevel);
+ unitTarget->ApplyDiminishingToDuration(m_diminishGroup,duration,caster,m_diminishLevel);
Aur->setDiminishGroup(m_diminishGroup);
// if Aura removed and deleted, do not continue.
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 532eb839af1..2922208b963 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -2087,10 +2087,9 @@ void SpellMgr::LoadSpellLinked()
continue;
}
- SpellLinkedSpell linkedSpell;
- linkedSpell.spell = effect;
- linkedSpell.type = type;
- mSpellLinkedMap[trigger] = linkedSpell;
+ if(type) //we will find a better way when more types are needed
+ trigger += 1000000;
+ mSpellLinkedMap[trigger].push_back(effect);
++count;
} while( result->NextRow() );
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 4e4f524a8dc..4006fff3b59 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -648,12 +648,7 @@ struct SpellExtraAttribute
typedef std::map<uint32, SpellExtraAttribute> SpellExtraAttrMap;
-struct SpellLinkedSpell
-{
- int32 spell;
- uint32 type;
-};
-typedef std::map<int32, SpellLinkedSpell> SpellLinkedMap;
+typedef std::map<int32, std::vector<int32> > SpellLinkedMap;
class SpellMgr
{
@@ -862,13 +857,10 @@ class SpellMgr
return 0;
}
- int32 GetSpellLinked(int32 spell_id, uint32 type) const
+ const std::vector<int32> *GetSpellLinked(int32 spell_id) const
{
SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id);
- if(itr != mSpellLinkedMap.end())
- return itr->second.type == type ? itr->second.spell : 0;
- else
- return 0;
+ return itr != mSpellLinkedMap.end() ? &(itr->second) : NULL;
}
// Modifiers
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index f997ce6b506..e0f242313a7 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -4154,15 +4154,15 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
statue = ((Totem*)caster);
- if(int32 spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id, 0))
+ if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id))
{
- if(spell_triggered > 0)
+ for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
{
- if(Unit* caster = Aur->GetCaster())
- CastSpell(this, spell_triggered, true, 0, 0, caster->GetGUID());
+ if(spell_triggered < 0)
+ RemoveAurasDueToSpell(-(*i));
+ else if(Unit* caster = Aur->GetCaster())
+ CastSpell(this, *i, true, 0, 0, caster->GetGUID());
}
- else
- RemoveAurasDueToSpell(-spell_triggered);
}
sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);