diff options
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r-- | src/game/Spell.cpp | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 5990c70a2e9..9590322617f 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -925,7 +925,16 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) spellHitTarget = m_caster; } - DoSpellHitOnUnit(spellHitTarget, mask); + if(spellHitTarget) + { + SpellMissInfo missInfo = DoSpellHitOnUnit(spellHitTarget, mask); + if(missInfo != SPELL_MISS_NONE) + { + m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo); + m_damage = 0; + spellHitTarget = NULL; + } + } // Do not take combo points on dodge if (m_needComboPoints && m_targets.getUnitTargetGUID() == target->targetGUID) @@ -1034,19 +1043,17 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) } } -void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) +SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) { if(!unit || !effectMask) - return; + return SPELL_MISS_EVADE; // Recheck immune (only for delayed spells) if( m_spellInfo->speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo))) { - m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_IMMUNE); - m_damage = 0; - return; + return SPELL_MISS_IMMUNE; } if (unit->GetTypeId() == TYPEID_PLAYER) @@ -1067,9 +1074,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) { - m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); - m_damage = 0; - return; + return SPELL_MISS_EVADE; } if( !m_caster->IsFriendlyTo(unit) ) @@ -1077,9 +1082,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) // for delayed spells ignore not visible explicit target if(m_spellInfo->speed > 0.0f && unit==m_targets.getUnitTarget() && !unit->isVisibleForOrDetect(m_caster,false)) { - m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); - m_damage = 0; - return; + return SPELL_MISS_EVADE; } unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL); @@ -1092,9 +1095,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) // TODO: this cause soul transfer bugged if(m_spellInfo->speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !IsPositiveSpell(m_spellInfo->Id)) { - m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); - m_damage = 0; - return; + return SPELL_MISS_EVADE; } // assisting case, healing and resurrection @@ -1165,6 +1166,8 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if (unit->AddAura(Aur)) m_spellAura = Aur; } + + return SPELL_MISS_NONE; } void Spell::DoTriggersOnSpellHit(Unit *unit) @@ -1988,17 +1991,13 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) break; } - if(cur == TARGET_DEST_DEST) - break; - - float x, y, z, angle, dist; - - dist = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); - if (cur == TARGET_DEST_DEST_RANDOM) - dist *= rand_norm(); - + float angle; switch(cur) { + case TARGET_DEST_DYNOBJ_ENEMY: + case TARGET_DEST_DYNOBJ_ALLY: + case TARGET_DEST_DEST: + return; case TARGET_DEST_DEST_FRONT: angle = 0.0f; break; case TARGET_DEST_DEST_BACK: angle = M_PI; break; case TARGET_DEST_DEST_RIGHT: angle = M_PI/2; break; @@ -2010,6 +2009,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) default: angle = rand_norm()*2*M_PI; break; } + float dist, x, y, z; + dist = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); + if (cur == TARGET_DEST_DEST_RANDOM) + dist *= rand_norm(); + x = m_targets.m_destX; y = m_targets.m_destY; z = m_targets.m_destZ; |