Jump to content

[Patch] Wrong spell mindist from Rev. 4158


Guest False.Genesis

Recommended Posts

This patch fixes wrong code from 3 years ago (Rev. 4158).

How it does work right now:

All spells that have a speed set are given a minimum distance of 5, even if these are self-targeting spells. This creates extremely high spell delays sometimes, especially with 17607 (Portal Effect: Ironforge, used by dalaran portal) and 47568 (Empower Rune Weapon). Both spells have a delay of 5 seconds, because their speed is 1 (for unknown reason).

It should work like:

The spells should be handled instantly. There is (imho) no reason to enforce a minimum distance just to delay things.

Thx to nos4r2zod for pointing out these lines.

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 5e1e430..a9cc227 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -829,7 +829,6 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex)
    {
        // calculate spell incoming interval
        float dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ());
-        if (dist < 5.0f) dist = 5.0f;
        target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);

        // Calculate minimum incoming time
@@ -894,8 +893,6 @@ void Spell::AddGOTarget(GameObject* pVictim, SpellEffectIndex effIndex)
    {
        // calculate spell incoming interval
        float dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ());
-        if (dist < 5.0f)
-            dist = 5.0f;
        target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
        if (m_delayMoment == 0 || m_delayMoment > target.timeDelay)
            m_delayMoment = target.timeDelay;

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use