fix(Scripts/SunwellPlateau): Vapor should chase the player targeted b… (#21740)

This commit is contained in:
Andrew
2025-03-21 05:00:17 -03:00
committed by GitHub
parent a0fc2a553c
commit 3cbe976a4e

View File

@@ -376,6 +376,16 @@ struct npc_demonic_vapor : public NullCreatureAI
me->CastSpell(me, SPELL_DEMONIC_VAPOR_SPAWN_TRIGGER, true);
}
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner || !summoner->ToUnit())
return;
me->m_Events.AddEventAtOffset([this, summoner] {
me->GetMotionMaster()->MoveFollow(summoner->ToUnit(), 0.0f, 0.0f, MOTION_SLOT_CONTROLLED);
}, 2s);
}
void UpdateAI(uint32 diff) override
{
if (_timer)
@@ -387,16 +397,6 @@ struct npc_demonic_vapor : public NullCreatureAI
_timer = 0;
}
}
else if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
{
Map::PlayerList const& players = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (me->GetDistance2d(itr->GetSource()) < 20.0f && itr->GetSource()->IsAlive())
{
me->GetMotionMaster()->MoveFollow(itr->GetSource(), 0.0f, 0.0f, MOTION_SLOT_CONTROLLED);
break;
}
}
}
private:
uint32 _timer;