aboutsummaryrefslogtreecommitdiff
path: root/src/game/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r--src/game/Spell.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index dbd0a74dc76..1e9a2a7d60e 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1221,10 +1221,28 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsAIEnabled)
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
- for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i)
+ if (m_ChanceTriggerSpells.size())
{
- if(roll_chance_i(i->second))
- m_caster->CastSpell(unit, i->first, true);
+ int _duration=0;
+ for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i)
+ {
+ if(roll_chance_i(i->second))
+ {
+ m_caster->CastSpell(unit, i->first, true);
+ // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
+ // set duration equal to triggering spell
+ if (GetSpellDuration(i->first)==-1)
+ {
+ // get duration from aura-only once
+ if (!_duration)
+ {
+ Aura * aur = unit->GetAuraByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
+ _duration = aur ? aur->GetAuraDuration() : -1;
+ }
+ unit->SetAurasDurationByCasterSpell(i->first->Id, m_caster->GetGUID(), _duration);
+ }
+ }
+ }
}
if(m_customAttr & SPELL_ATTR_CU_LINK_HIT)