fix(Scripts/Underbog): modernise boss scripts (#16149)

This commit is contained in:
Dan
2023-06-05 04:42:40 +02:00
committed by GitHub
parent 3564027f53
commit 3e19b5e637
6 changed files with 112 additions and 137 deletions

View File

@@ -344,6 +344,32 @@ void MotionMaster::MoveBackwards(Unit* target, float dist)
init.Launch();
}
void MotionMaster::MoveForwards(Unit* target, float dist)
{
//like movebackwards, but without the inversion
if (!target)
{
return;
}
Position const& pos = target->GetPosition();
float angle = target->GetAngle(_owner);
G3D::Vector3 point;
point.x = pos.m_positionX + dist * cosf(angle);
point.y = pos.m_positionY + dist * sinf(angle);
point.z = pos.m_positionZ;
if (!_owner->GetMap()->CanReachPositionAndGetValidCoords(_owner, point.x, point.y, point.z, true, true))
{
return;
}
Movement::MoveSplineInit init(_owner);
init.MoveTo(point.x, point.y, point.z, false);
init.SetFacing(target);
init.Launch();
}
void MotionMaster::MoveCircleTarget(Unit* target)
{
if (!target)

View File

@@ -205,6 +205,7 @@ public:
void MoveChase(Unit* target, float dist) { MoveChase(target, ChaseRange(dist)); }
void MoveCircleTarget(Unit* target);
void MoveBackwards(Unit* target, float dist);
void MoveForwards(Unit* target, float dist);
void MoveConfused();
void MoveFleeing(Unit* enemy, uint32 time = 0);
void MovePoint(uint32 id, const Position& pos, bool generatePath = true, bool forceDestination = true)