fix(Scripts/BlackwingLair): Improve Nefarian's add animations (#11414)

This commit is contained in:
Skjalf
2022-04-16 10:36:04 -03:00
committed by GitHub
parent 5a9bf21cd8
commit ca95a986ba
2 changed files with 48 additions and 29 deletions

View File

@@ -931,13 +931,15 @@ struct npc_drakonid_spawner : public ScriptedAI
}
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(Unit* summoner) override
{
DoCastSelf(SPELL_SPAWN_DRAKONID_GEN);
_scheduler.Schedule(10s, 60s, [this](TaskContext /*context*/)
{
DoCastSelf(SPELL_SPAWN_CHROMATIC_DRAKONID);
});
_owner = summoner->GetGUID();
}
void UpdateAI(uint32 diff) override
@@ -945,8 +947,44 @@ struct npc_drakonid_spawner : public ScriptedAI
_scheduler.Update(diff);
}
void SummonedCreatureDies(Creature* summon, Unit* /*unit*/) override
{
if (summon->GetEntry() != NPC_BONE_CONSTRUCT)
{
if (Creature* victor = ObjectAccessor::GetCreature(*me, _owner))
{
victor->AI()->DoAction(ACTION_NEFARIUS_ADD_KILLED);
}
ObjectGuid summonGuid = summon->GetGUID();
summon->SetCorpseDelay(DAY * IN_MILLISECONDS);
summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
summon->SetHomePosition(summon->GetPosition());
_scheduler.Schedule(1s, [this, summonGuid](TaskContext /*context*/)
{
if (Creature* construct = ObjectAccessor::GetCreature(*me, summonGuid))
{
construct->SetVisible(false);
}
}).Schedule(2s, [this, summonGuid](TaskContext /*context*/)
{
if (Creature* construct = ObjectAccessor::GetCreature(*me, summonGuid))
{
construct->UpdateEntry(NPC_BONE_CONSTRUCT);
construct->SetReactState(REACT_PASSIVE);
construct->SetStandState(UNIT_STAND_STATE_DEAD);
construct->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
construct->SetVisible(true);
}
});
}
}
protected:
TaskScheduler _scheduler;
ObjectGuid _owner;
};
std::unordered_map<uint32, uint8> const classCallSpells =

View File

@@ -91,6 +91,12 @@ public:
void OnCreatureCreate(Creature* creature) override
{
// This is required because the tempspawn at Vael overwrites his GUID.
if (creature->GetEntry() == NPC_VICTOR_NEFARIUS && creature->ToTempSummon())
{
return;
}
InstanceScript::OnCreatureCreate(creature);
switch (creature->GetEntry())
@@ -275,14 +281,13 @@ public:
case DATA_NEFARIAN:
switch (state)
{
case FAIL:
_events.ScheduleEvent(EVENT_RESPAWN_NEFARIUS, 15 * 60 * IN_MILLISECONDS); //15min
[[fallthrough]];
case NOT_STARTED:
if (Creature* nefarian = instance->GetCreature(nefarianGUID))
nefarian->DespawnOrUnsummon();
break;
case FAIL:
_events.ScheduleEvent(EVENT_RESPAWN_NEFARIUS, 15 * 60 * IN_MILLISECONDS); //15min
SetBossState(DATA_NEFARIAN, NOT_STARTED);
break;
default:
break;
}
@@ -378,30 +383,6 @@ public:
{
switch (unit->GetEntry())
{
case NPC_BLACK_DRAKONID:
case NPC_BLUE_DRAKONID:
case NPC_BRONZE_DRAKONID:
case NPC_CHROMATIC_DRAKONID:
case NPC_GREEN_DRAKONID:
case NPC_RED_DRAKONID:
if (Creature* summon = unit->ToTempSummon())
{
summon->SetCorpseDelay(DAY * IN_MILLISECONDS);
summon->UpdateEntry(NPC_BONE_CONSTRUCT);
summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
summon->SetReactState(REACT_PASSIVE);
summon->SetStandState(UNIT_STAND_STATE_DEAD);
summon->SetHomePosition(summon->GetPosition());
if (Creature* nefarius = GetCreature(DATA_LORD_VICTOR_NEFARIUS))
{
if (nefarius->AI())
{
nefarius->AI()->DoAction(ACTION_NEFARIUS_ADD_KILLED);
}
}
}
break;
case NPC_BLACKWING_DRAGON:
--addsCount[0];
if (EggEvent != DONE && _events.GetTimeUntilEvent(EVENT_RAZOR_SPAWN) == Milliseconds::max())