aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 44bff9f6932..094cbb2045a 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1377,6 +1377,32 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
dest = SpellDestination(x, y, liquidLevel, m_caster->GetOrientation());
break;
}
+ case TARGET_DEST_CASTER_FRONT_LEAP:
+ {
+ float dist = m_spellInfo->GetEffect(effIndex)->CalcRadius(m_caster);
+ float angle = targetType.CalcDirectionAngle();
+
+ Position pos = dest._position;
+
+ m_caster->MovePositionToFirstCollision(pos, dist, angle);
+ // Generate path to that point.
+ if (!m_preGeneratedPath)
+ m_preGeneratedPath = std::make_unique<PathGenerator>(m_caster);
+
+ m_preGeneratedPath->SetPathLengthLimit(dist);
+
+ // Should we use straightline here ? What do we do when we don't have a full path ?
+ bool pathResult = m_preGeneratedPath->CalculatePath(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false, true);
+ if (pathResult && m_preGeneratedPath->GetPathType() & (PATHFIND_NORMAL | PATHFIND_SHORTCUT))
+ {
+ pos.m_positionX = m_preGeneratedPath->GetActualEndPosition().x;
+ pos.m_positionY = m_preGeneratedPath->GetActualEndPosition().y;
+ pos.m_positionZ = m_preGeneratedPath->GetActualEndPosition().z;
+ }
+
+ dest.Relocate(pos);
+ break;
+ }
case TARGET_DEST_CASTER_GROUND:
m_caster->UpdateAllowedPositionZ(dest._position.GetPositionX(), dest._position.GetPositionY(), dest._position.m_positionZ);
break;