diff options
author | megamage <none@none> | 2009-03-23 15:26:13 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-23 15:26:13 -0600 |
commit | ba957ed9f476a39f5bbea621814bbe191493428c (patch) | |
tree | ed4eca5202986ac53997c10c783fb7f649611645 /src/game/SpellEffects.cpp | |
parent | 41a73f284beb26819f75da5c10f174fb24c57bc4 (diff) |
*Allow knockback creatures.
--HG--
branch : trunk
Diffstat (limited to 'src/game/SpellEffects.cpp')
-rw-r--r-- | src/game/SpellEffects.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index b81c32c21d4..a6f003ac28d 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5894,10 +5894,6 @@ void Spell::EffectKnockBack(uint32 i) if(!unitTarget) return; - // Effect only works on players - if(unitTarget->GetTypeId()!=TYPEID_PLAYER) - return; - float x, y; if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { @@ -5907,26 +5903,20 @@ void Spell::EffectKnockBack(uint32 i) else { x = m_caster->GetPositionX(); - y = m_caster->GetPositionX(); + y = m_caster->GetPositionY(); } - float dx = unitTarget->GetPositionX() - x; - float dy = unitTarget->GetPositionY() - y; - 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 speedxy = float(m_spellInfo->EffectMiscValue[i])/10; + float speedz = float(damage/-10); + + if(unitTarget->GetTypeId() == TYPEID_UNIT) { - float dist = sqrt((dx*dx) + (dy*dy)); - vcos = dx / dist; - vsin = dy / dist; + unitTarget->GetMotionMaster()->MoveJumpFrom(x, y, speedxy, -speedz); + return; } - float speedxy = float(m_spellInfo->EffectMiscValue[i])/10; - float speedz = float(damage/-10); + + float vcos, vsin; + unitTarget->GetSinCos(x, y, vsin, vcos); WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4)); data.append(unitTarget->GetPackGUID()); |