diff options
| author | Jeremy <Golrag@users.noreply.github.com> | 2018-02-16 20:59:19 +0100 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2018-02-16 20:59:19 +0100 |
| commit | 9e0faace9a5114fc2324c2c601ba943272e0d6ff (patch) | |
| tree | ee7cb56b687598c96d5e967d8f8857fc5cee8b07 /src/server/game/Spells/Spell.cpp | |
| parent | 8aa10f6c65ba7fc8363a663b305fede95d0ccb58 (diff) | |
Core/Entities: Reduce the probability of units dropping under the map (#21322)
Reduce the probabilty of going under the map
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 b6b5c22b6e1..7eaad1835ec 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1359,6 +1359,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->Effects[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; + } default: { float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); |
