fix(Scripts/Temple of AhnQiraj): Qiraji Champion. (#12965)

This commit is contained in:
UltraNix
2022-09-28 05:40:50 +02:00
committed by GitHub
parent e00242d8f0
commit 6a4dbb7436
5 changed files with 65 additions and 4 deletions

View File

@@ -15,9 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureGroups.h"
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "TaskScheduler.h"
#include "temple_of_ahnqiraj.h"
ObjectData const creatureData[] =
@@ -69,6 +71,8 @@ public:
uint32 BugTrioDeathCount;
uint32 CthunPhase;
TaskScheduler scheduler;
void Initialize() override
{
BugTrioDeathCount = 0;
@@ -140,6 +144,37 @@ public:
InstanceScript::OnGameObjectCreate(go);
}
void OnUnitDeath(Unit* unit) override
{
switch (unit->GetEntry())
{
case NPC_QIRAJI_SLAYER:
case NPC_QIRAJI_MINDSLAYER:
if (Creature* creature = unit->ToCreature())
{
if (CreatureGroup* formation = creature->GetFormation())
{
scheduler.Schedule(100ms, [formation](TaskContext /*context*/)
{
if (!formation->IsAnyMemberAlive(true))
{
if (Creature* leader = formation->GetLeader())
{
if (leader->IsAlive())
{
leader->AI()->SetData(0, 1);
}
}
}
});
}
}
break;
default:
break;
}
}
uint32 GetData(uint32 type) const override
{
switch (type)
@@ -217,6 +252,11 @@ public:
return true;
}
void Update(uint32 diff) override
{
scheduler.Update(diff);
}
};
};

View File

@@ -75,7 +75,10 @@ enum Creatures
NPC_VEKNILASH = 15275,
NPC_OURO = 15517,
NPC_OURO_SPAWNER = 15957,
NPC_SARTURA = 15516
NPC_SARTURA = 15516,
NPC_QIRAJI_SLAYER = 15250,
NPC_QIRAJI_MINDSLAYER = 15246
};
enum ObjectsAQ40