Jump to content

[~]Attempt to fix blink


Recommended Posts

  • 40 years later...

bug description: blink stopped working if you cast it while jumping, on certain maps if your destination is higher or lower it would go fail attempt

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 5e99cb7..0a68943 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -4829,13 +4829,13 @@ SpellCastResult Spell::CheckCast(bool strict)
                float fx = m_caster->GetPositionX() + dis * cos(m_caster->GetOrientation());
                float fy = m_caster->GetPositionY() + dis * sin(m_caster->GetOrientation());
                // teleport a bit above terrain level to avoid falling below it
-                float fz = m_caster->GetBaseMap()->GetHeight(fx,fy,m_caster->GetPositionZ(),true);
+                float fz = m_caster->GetBaseMap()->GetHeight(fx,fy,MAX_HEIGHT,true);
                if(fz <= INVALID_HEIGHT)                    // note: this also will prevent use effect in instances without vmaps height enabled
                    return SPELL_FAILED_TRY_AGAIN;

                float caster_pos_z = m_caster->GetPositionZ();
                // Control the caster to not climb or drop when +-fz > 8
-                if(!(fz <= caster_pos_z + 8 && fz >= caster_pos_z - 8))
+                if(!(fz <= caster_pos_z + 8))
                    return SPELL_FAILED_TRY_AGAIN;

                // not allow use this effect at battleground until battleground start
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 18b3420..c478668 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6238,6 +6238,20 @@ void Spell::EffectLeapForward(uint32 i)
        // before caster
        float fx, fy, fz;
        unitTarget->GetClosePoint(fx, fy, fz, unitTarget->GetObjectSize(), dis);
+
+        // check if map height is valid
+        float tempZ = unitTarget->GetBaseMap()->GetHeight(fx,fy,fz,true);
+
+        // relocate to map surface
+        if (tempZ <= INVALID_HEIGHT)
+        {
+            float mapHeight = unitTarget->GetBaseMap()->GetHeight(fx,fy,MAX_HEIGHT,true);
+
+            // don't allow land on map if there is high difference between map height and target z
+            if (!(mapHeight + 8 < fz))
+                fz = mapHeight;
+        }
+
        float ox, oy, oz;
        unitTarget->GetPosition(ox, oy, oz);

from the retail info you can blink while standing on the hill but almost sure that you can't climb

1) this will adjust you blink landing point according to a map height instead of expecting flat surface always

2) if you jump from too high hill u will appear in the air and fall

3) maybe i needed to change spell effect part after getting position from vmap

4)idk why blink broke only after 3.3 so maybe its wrong to fix it like that

Link to comment
Share on other sites

Blink need some love :).

Thank you Laise.

However, the "blink knockback" version won't "fix" blink, because with leveled surfaces you will face up to main problem, blink removes stuns and bonds but doesn't teleport the caster if the surface is very leveled even with a "knockback effect".

I know it's not very clear, but we have to fix the real blink which is important as a feature ^^.

Sorry for my english, speaking about surface, field or ground is not easy ^^.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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