mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Azure Vault: Converted Leymor intro to use new OnCreatureGroupDepleted hook
This commit is contained in:
@@ -54,6 +54,11 @@ enum AVGameObjectIds
|
||||
GO_ARCANE_VAULTS_DOOR_LEYMOR_EXIT = 377951
|
||||
};
|
||||
|
||||
enum AVActionIds
|
||||
{
|
||||
ACTION_FINISH_LEYMOR_INTRO = 251501
|
||||
};
|
||||
|
||||
template <class AI, class T>
|
||||
inline AI* GetAzureVaultAI(T* obj)
|
||||
{
|
||||
|
||||
@@ -91,15 +91,10 @@ enum LeymorNpcs
|
||||
NPC_LEYLINE_SPROUTS = 190509
|
||||
};
|
||||
|
||||
enum LeymorActions
|
||||
{
|
||||
ACTION_ARCANE_TENDER_DEATH = 1
|
||||
};
|
||||
|
||||
// 186644 - Leymor
|
||||
struct boss_leymor : public BossAI
|
||||
{
|
||||
boss_leymor(Creature* creature) : BossAI(creature, DATA_LEYMOR), _killedArcaneTender(0) { }
|
||||
boss_leymor(Creature* creature) : BossAI(creature, DATA_LEYMOR) { }
|
||||
|
||||
void JustAppeared() override
|
||||
{
|
||||
@@ -112,21 +107,15 @@ struct boss_leymor : public BossAI
|
||||
|
||||
void DoAction(int32 action) override
|
||||
{
|
||||
if (action == ACTION_ARCANE_TENDER_DEATH)
|
||||
if (action == ACTION_FINISH_LEYMOR_INTRO)
|
||||
{
|
||||
_killedArcaneTender++;
|
||||
if (_killedArcaneTender >= 3)
|
||||
scheduler.Schedule(1s, [this](TaskContext /*context*/)
|
||||
{
|
||||
instance->SetData(DATA_LEYMOR_INTRO_DONE, 1);
|
||||
|
||||
scheduler.Schedule(1s, [this](TaskContext /*context*/)
|
||||
{
|
||||
me->RemoveAurasDueToSpell(SPELL_STASIS);
|
||||
me->RemoveUnitFlag(UnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC));
|
||||
DoCastSelf(SPELL_ARCANE_ERUPTION);
|
||||
Talk(SAY_ANNOUNCE_AWAKEN);
|
||||
});
|
||||
}
|
||||
me->RemoveAurasDueToSpell(SPELL_STASIS);
|
||||
me->RemoveUnitFlag(UnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC));
|
||||
DoCastSelf(SPELL_ARCANE_ERUPTION);
|
||||
Talk(SAY_ANNOUNCE_AWAKEN);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +138,7 @@ struct boss_leymor : public BossAI
|
||||
{
|
||||
if (spell->Id == SPELL_CONSUMING_STOMP)
|
||||
DoCastAOE(SPELL_CONSUMING_STOMP_DAMAGE, true);
|
||||
};
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
@@ -206,9 +195,6 @@ struct boss_leymor : public BossAI
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int32 _killedArcaneTender;
|
||||
};
|
||||
|
||||
// 191164 - Arcane Tender
|
||||
@@ -216,18 +202,6 @@ struct npc_arcane_tender : public ScriptedAI
|
||||
{
|
||||
npc_arcane_tender(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
Creature* leymor = me->GetInstanceScript()->GetCreature(DATA_LEYMOR);
|
||||
if (!leymor)
|
||||
return;
|
||||
|
||||
if (!leymor->IsAIEnabled())
|
||||
return;
|
||||
|
||||
leymor->AI()->DoAction(ACTION_ARCANE_TENDER_DEATH);
|
||||
}
|
||||
|
||||
void JustAppeared() override
|
||||
{
|
||||
Creature* leymor = me->GetInstanceScript()->GetCreature(DATA_LEYMOR);
|
||||
|
||||
@@ -16,16 +16,19 @@
|
||||
*/
|
||||
|
||||
#include "AreaBoundary.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "CreatureGroups.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "azure_vault.h"
|
||||
|
||||
BossBoundaryData const boundaries =
|
||||
static BossBoundaryData const boundaries =
|
||||
{
|
||||
{ DATA_LEYMOR, new CircleBoundary(Position(-5129.39f, 1253.30f), 75.0f) }
|
||||
};
|
||||
|
||||
ObjectData const creatureData[] =
|
||||
static constexpr ObjectData creatureData[] =
|
||||
{
|
||||
{ BOSS_LEYMOR, DATA_LEYMOR },
|
||||
{ BOSS_AZUREBLADE, DATA_AZUREBLADE },
|
||||
@@ -34,14 +37,14 @@ ObjectData const creatureData[] =
|
||||
{ 0, 0 } // END
|
||||
};
|
||||
|
||||
DoorData const doorData[] =
|
||||
static constexpr DoorData doorData[] =
|
||||
{
|
||||
{ GO_ARCANE_VAULTS_DOOR_LEYMOR_ENTRANCE, DATA_LEYMOR, EncounterDoorBehavior::OpenWhenNotInProgress },
|
||||
{ GO_ARCANE_VAULTS_DOOR_LEYMOR_EXIT, DATA_LEYMOR, EncounterDoorBehavior::OpenWhenDone },
|
||||
{ 0, 0, EncounterDoorBehavior::OpenWhenNotInProgress } // END
|
||||
};
|
||||
|
||||
DungeonEncounterData const encounters[] =
|
||||
static constexpr DungeonEncounterData encounters[] =
|
||||
{
|
||||
{ DATA_LEYMOR, {{ 2582 }} },
|
||||
{ DATA_AZUREBLADE, {{ 2585 }} },
|
||||
@@ -80,15 +83,13 @@ class instance_azure_vault : public InstanceMapScript
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetData(uint32 dataId, uint32 /*value*/) override
|
||||
void OnCreatureGroupDepleted(CreatureGroup const* creatureGroup) override
|
||||
{
|
||||
switch (dataId)
|
||||
if (!_leymorIntroDone && creatureGroup->LeaderHasStringId("leymor_arcane_tender"))
|
||||
{
|
||||
case DATA_LEYMOR_INTRO_DONE:
|
||||
_leymorIntroDone = true; // no need to pass value, it will never reset to false
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
_leymorIntroDone = true;
|
||||
if (Creature* leymor = GetCreature(DATA_LEYMOR); leymor && leymor->IsAIEnabled())
|
||||
leymor->AI()->DoAction(ACTION_FINISH_LEYMOR_INTRO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user