fix(Core/Spells): updates trajectory target selection (#23031)

Co-authored-by: xinef1 <w.szyszko2@gmail.com>
This commit is contained in:
sogladev
2025-09-28 12:47:01 +02:00
committed by GitHub
parent bac2ae4e11
commit 0d1f885b57
7 changed files with 65 additions and 133 deletions

View File

@@ -41,10 +41,17 @@ void Position::RelocatePolarOffset(float angle, float dist, float z /*= 0.0f*/)
}
bool Position::HasInLine(Position const* pos, float width) const
{
return HasInLine(pos, 0, width);
}
bool Position::HasInLine(Position const* pos, float objSize, float width) const
{
if (!HasInArc(float(M_PI), pos))
return false;
width += objSize;
float angle = GetRelativeAngle(pos);
return std::fabs(std::sin(angle)) * GetExactDist2d(pos->GetPositionX(), pos->GetPositionY()) < width;
}

View File

@@ -231,6 +231,7 @@ struct Position
[[nodiscard]] bool IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const;
bool HasInArc(float arcangle, const Position* pos, float targetRadius = 0.0f) const;
bool HasInLine(Position const* pos, float width) const;
bool HasInLine(Position const* pos, float objSize, float width) const;
[[nodiscard]] std::string ToString() const;
// modulos a radian orientation to the range of 0..2PI