aboutsummaryrefslogtreecommitdiff
path: root/src/game/Spell.cpp
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-06-15 04:09:41 +0200
committerKudlaty <none@none>2009-06-15 04:09:41 +0200
commitd1d8e2d171b1b7fc3c1fc0b83238ac5b0f8af64d (patch)
tree752c90f5f7c192cd277c1107df3f40d9005af7d1 /src/game/Spell.cpp
parentb1a8df0cde6311a6116417785c658786267636ba (diff)
parentd86194147741840cbf4642d7a23003dc0f5bbb2b (diff)
*merge
--HG-- branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r--src/game/Spell.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 87be2d381c2..0f2def62271 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1410,12 +1410,20 @@ bool Spell::UpdateChanneledTargetList()
uint8 needAliveTargetMask = m_needAliveTargetMask;
uint8 needAuraMask = 0;
- for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
needAuraMask |= 1<<i;
needAuraMask &= needAliveTargetMask;
+ float range;
+ if(needAuraMask)
+ {
+ range = GetSpellMaxRange(m_spellInfo, IsPositiveSpell(m_spellInfo->Id));
+ if(Player * modOwner = m_caster->GetSpellModOwner())
+ modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
+ }
+
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) )
@@ -1428,9 +1436,6 @@ bool Spell::UpdateChanneledTargetList()
{
if(Aura * aur = unit->GetAura(m_spellInfo->Id, m_originalCasterGUID))
{
- float range = m_caster->GetSpellMaxRangeForTarget(unit,GetSpellRangeStore()->LookupEntry(m_spellInfo->rangeIndex));
- if(Player * modOwner = m_caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
if (m_caster != unit && !m_caster->IsWithinDistInMap(unit,range))
{
ihit->effectMask &= ~aur->GetEffectMask();
@@ -1438,7 +1443,7 @@ bool Spell::UpdateChanneledTargetList()
continue;
}
}
- else
+ else // aura is dispelled
continue;
}
@@ -2520,16 +2525,12 @@ void Spell::cancel()
case SPELL_STATE_CASTING:
{
- for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
- {
- if( ihit->missCondition == SPELL_MISS_NONE )
- {
- Unit* unit = m_caster->GetGUID()==(*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
- if( unit && unit->isAlive() )
- unit->RemoveAurasDueToSpell(m_spellInfo->Id, m_originalCasterGUID, AURA_REMOVE_BY_CANCEL);
- }
- }
- m_caster->RemoveAurasDueToSpell(m_spellInfo->Id, m_originalCasterGUID, AURA_REMOVE_BY_CANCEL);
+ for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+ if(ihit->missCondition == SPELL_MISS_NONE)
+ if(Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
+ if(unit->isAlive())
+ unit->RemoveAurasDueToSpell(m_spellInfo->Id, m_originalCasterGUID, AURA_REMOVE_BY_CANCEL);
+
SendChannelUpdate(0);
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
@@ -2912,6 +2913,7 @@ void Spell::update(uint32 difftime)
if(m_targets.getUnitTargetGUID() && !m_targets.getUnitTarget())
{
+ sLog.outDebug("Spell %u is cancelled due to removal of target.", m_spellInfo->Id);
cancel();
return;
}
@@ -5934,6 +5936,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
{
// no, we aren't, do the typical update
// check, if we have channeled spell on our hands
+ /*
if (IsChanneledSpell(m_Spell->m_spellInfo))
{
// evented channeled spell is processed separately, casted once after delay, and not destroyed till finish
@@ -5956,6 +5959,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
// event will be re-added automatically at the end of routine)
}
else
+ */
{
// run the spell handler and think about what we can do next
uint64 t_offset = e_time - m_Spell->GetDelayStart();