Core/Spell: SPELL_EFFECT_PULL_TOWARDS correction

Port From (https://github.com/TrinityCore/TrinityCore/commit/cc1c67183f9e35c4495cd19a7fd1c786c653e368)
This commit is contained in:
hondacrx
2022-01-07 12:45:27 -05:00
parent fcf47da853
commit 5b73cb06e7
+8 -5
View File
@@ -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)]