Core/Spells: Remade trajectory target selection (#19048)

* Remade trajectory target selection
* Added possibility to apply conditions to trajectory spells
* Properly recalculate delay time if CMSG_UPDATE_PROJECTILE_POSITION is received

(cherry picked from commit c6060dd0c511ddad3cb1f0423aa9ccf2de7aedec)
This commit is contained in:
xinef1 authored and funjoker committed 2022-01-22 22:29:20 +01:00
1 parent a07f73c846
commit 9da4acce08
12 files changed
+105 -122

No files matched your search

+2 -1
View File
@@ -170,11 +170,12 @@ bool Position::HasInArc(float arc, const Position* obj, float border) const
return ((angle >= lborder) && (angle <= rborder));
}
bool Position::HasInLine(Position const* pos, float width) const
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;
}