mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Core/Mmaps: Charge ignoring z position of target (#17516)
* Core/Mmaps: Charge ignoring z position of target By cemak closes #15011
This commit is contained in:
@@ -940,3 +940,8 @@ void PathGenerator::ReducePathLenghtByDist(float dist)
|
||||
nextVec = currVec; // we're going backwards
|
||||
}
|
||||
}
|
||||
|
||||
bool PathGenerator::IsInvalidDestinationZ(Unit const* target) const
|
||||
{
|
||||
(target->GetPositionZ() - GetActualEndPosition().z) > 5.0f;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ class PathGenerator
|
||||
// Calculate the path from owner to given destination
|
||||
// return: true if new path was calculated, false otherwise (no change needed)
|
||||
bool CalculatePath(float destX, float destY, float destZ, bool forceDest = false, bool straightLine = false);
|
||||
bool IsInvalidDestinationZ(Unit const* target) const
|
||||
|
||||
// option setters - use optional
|
||||
void SetUseStraightPath(bool useStraightPath) { _useStraightPath = useStraightPath; }
|
||||
|
||||
@@ -5267,7 +5267,11 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
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;
|
||||
|
||||
m_preGeneratedPath.ReducePathLenghtByDist(objSize); // move back
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user