diff options
Diffstat (limited to 'src/game/SpellEffects.cpp')
-rw-r--r-- | src/game/SpellEffects.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 85420fcc233..b529e5139c9 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5935,7 +5935,7 @@ void Spell::EffectKnockBack(uint32 i) return; float x, y; - if(m_targets.HasDest()) + if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { x = m_targets.m_destX; y = m_targets.m_destY; @@ -5948,10 +5948,19 @@ void Spell::EffectKnockBack(uint32 i) float dx = unitTarget->GetPositionX() - x; float dy = unitTarget->GetPositionY() - y; - float dist = sqrt((dx*dx) + (dy*dy)); - - float vcos = dx / dist; - float vsin = dy / dist; + float vcos, vsin; + if(dx < 0.001f && dy < 0.001f) + { + float angle = rand_norm()*2*M_PI; + vcos = cos(angle); + vsin = sin(angle); + } + else + { + float dist = sqrt((dx*dx) + (dy*dy)); + vcos = dx / dist; + vsin = dy / dist; + } WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4)); data.append(unitTarget->GetPackGUID()); |