mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +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)
|
void Spell::CalculateJumpSpeeds(uint8 i, float dist, float& speedXY, float& speedZ)
|
||||||
{
|
{
|
||||||
if (m_spellInfo->Effects[i].MiscValue)
|
float runSpeed = m_caster->IsControlledByPlayer() ? playerBaseMoveSpeed[MOVE_RUN] : baseMoveSpeed[MOVE_RUN];
|
||||||
speedZ = float(m_spellInfo->Effects[i].MiscValue) / 10;
|
if (Creature* creature = m_caster->ToCreature())
|
||||||
else if (m_spellInfo->Effects[i].MiscValueB)
|
runSpeed *= creature->GetCreatureTemplate()->speed_run;
|
||||||
speedZ = float(m_spellInfo->Effects[i].MiscValueB) / 10;
|
|
||||||
|
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
|
else
|
||||||
speedZ = 10.0f;
|
height = Movement::gravity * durationSqr / 8;
|
||||||
speedXY = dist * 10.0f / speedZ;
|
|
||||||
|
speedZ = std::sqrt(2 * Movement::gravity * height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
|
void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
|
||||||
|
|||||||
Reference in New Issue
Block a user