fix(Script/Sunwell): Adjust Singularity behaviors (#21919)
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
-- Singularity speed
|
||||||
|
UPDATE `creature_template` SET `speed_walk` = 2, `speed_run` = 0.7142 WHERE (`entry` = 25855);
|
||||||
@@ -285,27 +285,50 @@ struct npc_singularity : public NullCreatureAI
|
|||||||
me->m_Events.AddEventAtOffset([&] {
|
me->m_Events.AddEventAtOffset([&] {
|
||||||
DoCastSelf(SPELL_BLACK_HOLE_VISUAL2, true);
|
DoCastSelf(SPELL_BLACK_HOLE_VISUAL2, true);
|
||||||
DoCastSelf(SPELL_BLACK_HOLE_PASSIVE, true);
|
DoCastSelf(SPELL_BLACK_HOLE_PASSIVE, true);
|
||||||
|
|
||||||
|
// Start following players after visuals are complete
|
||||||
|
FindAndFollowTarget();
|
||||||
}, 8s);
|
}, 8s);
|
||||||
|
|
||||||
me->m_Events.AddEventAtOffset([&] {
|
me->m_Events.AddEventAtOffset([&] {
|
||||||
me->KillSelf();
|
me->KillSelf();
|
||||||
}, 17s);
|
}, 17s);
|
||||||
|
}
|
||||||
|
|
||||||
scheduler.Schedule(8s, [this](TaskContext context)
|
void FindAndFollowTarget()
|
||||||
|
{
|
||||||
|
scheduler.Schedule(1s, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
|
Player* target = nullptr;
|
||||||
|
|
||||||
auto const& playerList = me->GetMap()->GetPlayers();
|
auto const& playerList = me->GetMap()->GetPlayers();
|
||||||
for (auto const& playerRef : playerList)
|
for (auto const& playerRef : playerList)
|
||||||
{
|
{
|
||||||
if (Player* player = playerRef.GetSource())
|
if (Player* player = playerRef.GetSource())
|
||||||
|
{
|
||||||
if (me->IsWithinLOSInMap(player) && player->IsAlive() && !player->HasAura(SPELL_BLACK_HOLE_EFFECT))
|
if (me->IsWithinLOSInMap(player) && player->IsAlive() && !player->HasAura(SPELL_BLACK_HOLE_EFFECT))
|
||||||
{
|
{
|
||||||
me->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), false, true);
|
target = player;
|
||||||
context.Repeat();
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
if (target->GetDistance(GetCaster()) < 5.0f)
|
||||||
{
|
{
|
||||||
float o = frand(0, 2 * M_PI);
|
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
|
else
|
||||||
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);
|
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);
|
||||||
|
|||||||
Reference in New Issue
Block a user