feat(Core/AI): Implement delay option to the Talk() function (#14950)
This commit is contained in:
parent
af88c2428b
commit
76c9eb9159
3 changed files with 39 additions and 26 deletions
|
|
@ -67,13 +67,11 @@ public:
|
|||
boss_captain_skarlocAI(Creature* creature) : ScriptedAI(creature), summons(me) { }
|
||||
|
||||
EventMap events;
|
||||
EventMap events2;
|
||||
SummonList summons;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
events.Reset();
|
||||
events2.Reset();
|
||||
summons.DespawnAll();
|
||||
}
|
||||
|
||||
|
|
@ -130,8 +128,24 @@ public:
|
|||
|
||||
if (me->movespline->Finalized())
|
||||
{
|
||||
events2.ScheduleEvent(EVENT_INITIAL_TALK, 500);
|
||||
events2.ScheduleEvent(EVENT_START_FIGHT, 8000);
|
||||
Talk(SAY_ENTER, 500ms);
|
||||
|
||||
me->m_Events.AddEventAtOffset([this]()
|
||||
{
|
||||
me->SetImmuneToAll(false);
|
||||
me->SetInCombatWithZone();
|
||||
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
|
||||
{
|
||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
|
||||
{
|
||||
if (summon->GetEntry() != NPC_SKARLOC_MOUNT)
|
||||
{
|
||||
summon->SetImmuneToAll(false);
|
||||
summon->SetInCombatWithZone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 8s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,25 +175,6 @@ public:
|
|||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
events2.Update(diff);
|
||||
switch (events2.ExecuteEvent())
|
||||
{
|
||||
case EVENT_INITIAL_TALK:
|
||||
Talk(SAY_ENTER);
|
||||
break;
|
||||
case EVENT_START_FIGHT:
|
||||
me->SetImmuneToAll(false);
|
||||
me->SetInCombatWithZone();
|
||||
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
|
||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
|
||||
if (summon->GetEntry() != NPC_SKARLOC_MOUNT)
|
||||
{
|
||||
summon->SetImmuneToAll(false);
|
||||
summon->SetInCombatWithZone();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue