aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-25 23:50:58 -0500
committermegamage <none@none>2009-08-25 23:50:58 -0500
commitf05f6d3d3140a3ae6d5192bba8fe75f5fd174144 (patch)
treef8b2e04d5d3f36e90066f3e6e4180c1bb245584d /src
parent3f978a99e1ec731b94c4b2497f8c3a41fac798cd (diff)
*Fix the calculation of knockback.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellEffects.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 05f27b4567a..30fe8af0d0a 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6376,9 +6376,11 @@ 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 ratio = m_caster->GetCombatReach() / std::max(unitTarget->GetCombatReach(), 1.0f);
+ if(ratio < 1.0f)
+ ratio = ratio * ratio * ratio * 0.1f; // volume = length^3
+ else
+ ratio = 0.1f; // dbc value ratio
float speedxy = float(m_spellInfo->EffectMiscValue[i]) * ratio;
float speedz = float(damage) * ratio;
if(speedxy < 0.1f && speedz < 0.1f)