diff options
| author | Jeremy <Golrag@users.noreply.github.com> | 2018-02-16 20:59:19 +0100 |
|---|---|---|
| committer | funjoker <funjoker109@gmail.com> | 2021-08-08 21:21:34 +0200 |
| commit | 69edf282fa777912385dbb4d921b9f3a8f92a00e (patch) | |
| tree | 986a2f8c5037182b04a3f3cc035bbc1d77efdc41 /src/server/game/Spells/Spell.cpp | |
| parent | fcead0b4eae298c1a46c42fea56a3b3b9ae2bf8f (diff) | |
Partial: Core/Entities: Reduce the probability of units dropping under the map (#21322)
Reduce the probabilty of going under the map
(cherry picked from commit 9e0faace9a5114fc2324c2c601ba943272e0d6ff)
Revert "Core/Entities: Reduce the probability of units dropping under the map (#21322)"
(cherry picked from commit 2dadbda24ac1c2e6ff3dad650c7e25f4b3322342)
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 26 |
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; |
