Skip to content

Commit

Permalink
Spell: Fix division by zero in pull effect
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Sep 23, 2024
1 parent fe73271 commit e06dbff
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e06dbff

Please sign in to comment.