From 5b73cb06e7ebb66928297b111c21324dad573ea3 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Fri, 7 Jan 2022 12:45:27 -0500 Subject: [PATCH] Core/Spell: SPELL_EFFECT_PULL_TOWARDS correction Port From (https://github.com/TrinityCore/TrinityCore/commit/cc1c67183f9e35c4495cd19a7fd1c786c653e368) --- Source/Game/Spells/SpellEffects.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 28ba01b02..980b62746 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -3756,12 +3756,15 @@ namespace Game.Spells if (!unitTarget) return; - float speedXY = effectInfo.MiscValue / 10.0f; - float speedZ = damage / 10.0f; - Position pos = new(); - pos.Relocate(m_caster); + Position pos = m_caster.GetFirstCollisionPosition(m_caster.GetCombatReach(), m_caster.GetRelativeAngle(unitTarget)); - unitTarget.GetMotionMaster().MoveJump(pos, speedXY, speedZ); + // This is a blizzlike mistake: this should be 2D distance according to projectile motion formulas, but Blizzard erroneously used 3D distance. + float distXY = unitTarget.GetExactDist(pos); + float distZ = pos.GetPositionZ() - unitTarget.GetPositionZ(); + float speedXY = effectInfo.MiscValue != 0 ? effectInfo.MiscValue / 10.0f : 30.0f; + float speedZ = (float)((2 * speedXY * speedXY * distZ + MotionMaster.gravity * distXY * distXY) / (2 * speedXY * distXY)); + + unitTarget.JumpTo(speedXY, speedZ, true, pos); } [SpellEffectHandler(SpellEffectName.PullTowardsDest)]