Fix(spells): saut reel pour Bond heroique & sorts JUMP_DEST
CalculateJumpSpeeds lisait MiscValue/MiscValueB de SpellEffect comme une vitesse verticale brute (speedZ = MiscValue/10), alors que la data DB2 7.3.5 moderne y stocke les hauteurs d arc min/max (en 1/10 yard). Pour le saut de Bond heroique (94954: MiscValue=25, MiscValueB=100) cela donnait speedZ=2.5 -> arc plat ~0.16y + vitesse horizontale enorme = glissade facon Charge au lieu d un vrai saut. Portage du calcul base hauteur: speedXY derive de la vitesse de course, hauteur d arc bornee entre MiscValue/10 et MiscValueB/10, convertie en speedZ = sqrt(2 * gravity * height). Corrige tous les SPELL_EFFECT_JUMP_DEST (Bond heroique, Desengagement, sauts Chasseur de demons, ...). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -945,14 +945,33 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex)
|
||||
|
||||
void Spell::CalculateJumpSpeeds(SpellEffectInfo const* effInfo, float dist, float& speedXY, float& speedZ)
|
||||
{
|
||||
if (effInfo->MiscValue)
|
||||
speedZ = float(effInfo->MiscValue) / 10;
|
||||
else if (effInfo->MiscValueB)
|
||||
speedZ = float(effInfo->MiscValueB) / 10;
|
||||
else
|
||||
speedZ = 10.0f;
|
||||
// SpellEffect DB2 stores arc heights (in 1/10 yards), not a raw vertical speed:
|
||||
// MiscValue = minimum arc height, MiscValueB = maximum arc height.
|
||||
// Derive a horizontal speed from run speed, clamp the arc height, then convert
|
||||
// the chosen height into the vertical speed expected by MotionMaster::MoveJump.
|
||||
float runSpeed = m_caster->IsControlledByPlayer() ? playerBaseMoveSpeed[MOVE_RUN] : baseMoveSpeed[MOVE_RUN];
|
||||
if (Creature* creature = m_caster->ToCreature())
|
||||
runSpeed *= creature->GetCreatureTemplate()->speed_run;
|
||||
|
||||
speedXY = dist * 10.0f / speedZ;
|
||||
float multiplier = effInfo->Amplitude;
|
||||
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 = effInfo->MiscValue ? effInfo->MiscValue / 10.0f : 0.5f; // Lowest height
|
||||
float maxHeight = effInfo->MiscValueB ? effInfo->MiscValueB / 10.0f : 1000.0f; // Highest height
|
||||
float height;
|
||||
if (durationSqr < minHeight * 8 / Movement::gravity)
|
||||
height = minHeight;
|
||||
else if (durationSqr > maxHeight * 8 / Movement::gravity)
|
||||
height = maxHeight;
|
||||
else
|
||||
height = Movement::gravity * durationSqr / 8;
|
||||
|
||||
speedZ = std::sqrt(2 * Movement::gravity * height);
|
||||
}
|
||||
|
||||
void Spell::EffectTeleportToLFG(SpellEffIndex /*effIndex*/)
|
||||
|
||||
Reference in New Issue
Block a user