From e06dbff12503e4d7fe93c6a5ebeb0ece60448323 Mon Sep 17 00:00:00 2001 From: killerwife Date: Mon, 23 Sep 2024 18:43:34 +0200 Subject: [PATCH] Spell: Fix division by zero in pull effect --- src/game/Spells/SpellEffects.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 91f1faf8a15..ac3b8e3cd27 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -11764,14 +11764,11 @@ void Spell::EffectPullTowards(SpellEffectIndex eff_idx) dist = sqrt(unitTarget->GetDistance2d(x, y, DIST_CALC_NONE)); } - if (damage && dist > damage) - dist = float(damage); - if (dist < 0.1f) return; // Projectile motion - float speedXY = float(m_spellInfo->EffectMiscValue[eff_idx]) * 0.1f; + float speedXY = float(std::max(1, m_spellInfo->EffectMiscValue[eff_idx])) * 0.1f; float time = dist / speedXY; float speedZ = ((z - unitTarget->GetPositionZ()) + 0.5f * time * time * Movement::gravity) / time; float angle = unitTarget->GetAngle(x, y);