mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 18:40:28 +00:00
fix(Core/Spells): Jump Speed Calculations (#20479)
Core/Spell: Jump Speed Calculations
0197a2f990
Co-authored-by: DanVS <33371360+DanVS@users.noreply.github.com>
This commit is contained in:
@@ -1152,13 +1152,29 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex)
|
||||
|
||||
void Spell::CalculateJumpSpeeds(uint8 i, float dist, float& speedXY, float& speedZ)
|
||||
{
|
||||
if (m_spellInfo->Effects[i].MiscValue)
|
||||
speedZ = float(m_spellInfo->Effects[i].MiscValue) / 10;
|
||||
else if (m_spellInfo->Effects[i].MiscValueB)
|
||||
speedZ = float(m_spellInfo->Effects[i].MiscValueB) / 10;
|
||||
float runSpeed = m_caster->IsControlledByPlayer() ? playerBaseMoveSpeed[MOVE_RUN] : baseMoveSpeed[MOVE_RUN];
|
||||
if (Creature* creature = m_caster->ToCreature())
|
||||
runSpeed *= creature->GetCreatureTemplate()->speed_run;
|
||||
|
||||
float multiplier = m_spellInfo->Effects[i].ValueMultiplier;
|
||||
if (multiplier <= 0.0f)
|
||||
multiplier = 1.0f;
|
||||
|
||||
speedXY = std::min(runSpeed * 3.0f * multiplier, std::max(28.0f, m_caster->GetSpeed(MOVE_RUN) * 4.0f));
|
||||
|
||||
float duration = dist / speedXY;
|
||||
float durationSqr = duration * duration;
|
||||
float minHeight = m_spellInfo->Effects[i].MiscValue ? m_spellInfo->Effects[i].MiscValue / 10.0f : 0.5f; // Lower bound is blizzlike
|
||||
float maxHeight = m_spellInfo->Effects[i].MiscValueB ? m_spellInfo->Effects[i].MiscValueB / 10.0f : 1000.0f; // Upper bound is unknown
|
||||
float height;
|
||||
if (durationSqr < minHeight * 8 / Movement::gravity)
|
||||
height = minHeight;
|
||||
else if (durationSqr > maxHeight * 8 / Movement::gravity)
|
||||
height = maxHeight;
|
||||
else
|
||||
speedZ = 10.0f;
|
||||
speedXY = dist * 10.0f / speedZ;
|
||||
height = Movement::gravity * durationSqr / 8;
|
||||
|
||||
speedZ = std::sqrt(2 * Movement::gravity * height);
|
||||
}
|
||||
|
||||
void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
|
||||
|
||||
Reference in New Issue
Block a user