aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Movement/PathGenerator.cpp31
-rw-r--r--src/server/game/Spells/Spell.cpp18
2 files changed, 20 insertions, 29 deletions
diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp
index 3321e22c10a..f8176dfe33d 100644
--- a/src/server/game/Movement/PathGenerator.cpp
+++ b/src/server/game/Movement/PathGenerator.cpp
@@ -205,23 +205,22 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: farFromPoly distToStartPoly=%.3f distToEndPoly=%.3f", distToStartPoly, distToEndPoly);
bool buildShotrcut = false;
- if (_sourceUnit->GetTypeId() == TYPEID_UNIT)
- {
- Creature* owner = (Creature*)_sourceUnit;
- G3D::Vector3 const& p = (distToStartPoly > 7.0f) ? startPos : endPos;
- if (_sourceUnit->GetBaseMap()->IsUnderWater(p.x, p.y, p.z))
- {
- TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: underWater case");
- if (owner->CanSwim())
- buildShotrcut = true;
- }
- else
- {
- TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: flying case");
- if (owner->CanFly())
- buildShotrcut = true;
- }
+ G3D::Vector3 const& p = (distToStartPoly > 7.0f) ? startPos : endPos;
+ if (_sourceUnit->GetBaseMap()->IsUnderWater(p.x, p.y, p.z))
+ {
+ TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: underWater case");
+ if (_sourceUnit->CanSwim())
+ buildShotrcut = true;
+ }
+ else
+ {
+ TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: flying case");
+ if (_sourceUnit->CanFly())
+ buildShotrcut = true;
+ // Allow to build a shortcut if the unit is falling and it's trying to move downwards towards a target (i.e. charging)
+ else if (_sourceUnit->IsFalling() && endPos.z < startPos.z)
+ buildShotrcut = true;
}
if (buildShotrcut)
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 740f7afdfab..ec83602fa36 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -5507,23 +5507,15 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
m_preGeneratedPath = Trinity::make_unique<PathGenerator>(unitCaster);
m_preGeneratedPath->SetPathLengthLimit(range);
+
// first try with raycast, if it fails fall back to normal path
- float targetObjectSize = std::min(target->GetCombatReach(), 4.0f);
- bool result = m_preGeneratedPath->CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + targetObjectSize, false, true);
+ bool result = m_preGeneratedPath->CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), false, false);
if (m_preGeneratedPath->GetPathType() & PATHFIND_SHORT)
return SPELL_FAILED_OUT_OF_RANGE;
else if (!result || m_preGeneratedPath->GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE))
- {
- result = m_preGeneratedPath->CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + targetObjectSize, false, false);
- if (m_preGeneratedPath->GetPathType() & PATHFIND_SHORT)
- return SPELL_FAILED_OUT_OF_RANGE;
- else if (!result || m_preGeneratedPath->GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE))
- return SPELL_FAILED_NOPATH;
- else if (m_preGeneratedPath->IsInvalidDestinationZ(target)) // Check position z, if not in a straight line
- return SPELL_FAILED_NOPATH;
- }
- else if (m_preGeneratedPath->IsInvalidDestinationZ(target)) // Check position z, if in a straight line
- return SPELL_FAILED_NOPATH;
+ return SPELL_FAILED_NOPATH;
+ else if (m_preGeneratedPath->IsInvalidDestinationZ(target)) // Check position z, if not in a straight line
+ return SPELL_FAILED_NOPATH;
m_preGeneratedPath->ShortenPathUntilDist(PositionToVector3(target), objSize); // move back
}