try a new way by keeping a random teleport

This commit is contained in:
Grimdhex
2024-09-15 17:01:04 +02:00
parent 03a710b535
commit 7cd9bd940e

View File

@@ -215,7 +215,18 @@ class spell_mother_shahraz_fatal_attraction : public SpellScript
void SetDest(SpellDestination& dest)
{
dest.Relocate(CenterOfOutdoorCourt);
// Initialize a first destination
Position teleportDest = GetCaster()->GetRandomNearPosition(50.0f);
// Ensure that the destination is not too close to the caster.
// @todo: Need maybe a LOS Check?
while (teleportDest.GetExactDist(GetCaster()->GetPosition()) < 50.0f)
{
teleportDest = GetCaster()->GetRandomNearPosition(50.0f);
}
// When a valid destination is found, relocate it.
dest.Relocate(teleportDest);
}
void HandleTeleportUnits(SpellEffIndex /*effIndex*/)