From fa38449620ffc49c3510c03a3f731bb56e2d70d2 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 25 Aug 2009 16:34:17 -0500 Subject: *Do not allow to knockback target which is much larger than caster. --HG-- branch : trunk --- src/game/SpellEffects.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index a34ec67d9c9..05f27b4567a 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -6376,6 +6376,14 @@ void Spell::EffectKnockBack(uint32 i) return; } + float ratio = m_caster->GetCombatReach() / unitTarget->GetCombatReach(); + ratio = ratio * ratio * ratio; // volume = length^3 + ratio *= 0.1f; // dbc value + float speedxy = float(m_spellInfo->EffectMiscValue[i]) * ratio; + float speedz = float(damage) * ratio; + if(speedxy < 0.1f && speedz < 0.1f) + return; + float x, y; if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { @@ -6388,9 +6396,6 @@ void Spell::EffectKnockBack(uint32 i) y = m_caster->GetPositionY(); } - float speedxy = float(m_spellInfo->EffectMiscValue[i])/10; - float speedz = float(damage/10); - unitTarget->KnockbackFrom(x, y, speedxy, speedz); } -- cgit v1.2.3