fix(Script/Sunwell): Adjust Singularity behaviors (#21919)

This commit is contained in:
blinkysc
2025-04-15 17:02:44 -05:00
committed by GitHub
parent fd62c99670
commit 5b957ab403
2 changed files with 33 additions and 6 deletions

View File

@@ -285,27 +285,50 @@ struct npc_singularity : public NullCreatureAI
me->m_Events.AddEventAtOffset([&] {
DoCastSelf(SPELL_BLACK_HOLE_VISUAL2, true);
DoCastSelf(SPELL_BLACK_HOLE_PASSIVE, true);
// Start following players after visuals are complete
FindAndFollowTarget();
}, 8s);
me->m_Events.AddEventAtOffset([&] {
me->KillSelf();
}, 17s);
}
scheduler.Schedule(8s, [this](TaskContext context)
void FindAndFollowTarget()
{
scheduler.Schedule(1s, [this](TaskContext context)
{
Player* target = nullptr;
auto const& playerList = me->GetMap()->GetPlayers();
for (auto const& playerRef : playerList)
{
if (Player* player = playerRef.GetSource())
{
if (me->IsWithinLOSInMap(player) && player->IsAlive() && !player->HasAura(SPELL_BLACK_HOLE_EFFECT))
{
me->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), false, true);
context.Repeat();
return;
target = player;
break;
}
}
}
context.Repeat(1s);
if (target)
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f);
scheduler.Schedule(6s, [this](TaskContext)
{
FindAndFollowTarget();
});
}
else
{
// No valid target found, check again soon
context.Repeat(1s);
}
});
}
@@ -410,7 +433,9 @@ class spell_entropius_black_hole_effect : public SpellScript
if (target->GetDistance(GetCaster()) < 5.0f)
{
float o = frand(0, 2 * M_PI);
pos.Relocate(GetCaster()->GetPositionX() + 4.0f * cos(o), GetCaster()->GetPositionY() + 4.0f * std::sin(o), GetCaster()->GetPositionZ() + frand(10.0f, 15.0f));
pos.Relocate(GetCaster()->GetPositionX() + 8.0f * cos(o),
GetCaster()->GetPositionY() + 8.0f * std::sin(o),
GetCaster()->GetPositionZ() + frand(2.0f, 5.0f));
}
else
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);