mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Improvements to Pyroguard Emberseer (UBRS) script (#24405)
* UBRS: Improve Pyroguard Emberseer script
* Remove whitespaces
* More whitespaces removed
* Addressing change requests
Removed cast from constructor
Removing unused member field
* That should be the last white spaces
* Forgot to remove the declaration
* Update boss_pyroguard_emberseer.cpp
* Add break to For loop
* War on white spaces
Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>
(cherry picked from commit c3037c3563)
This commit is contained in:
@@ -51,7 +51,8 @@ enum BRSDataTypes
|
||||
DATA_HALL_RUNE_5 = 20,
|
||||
DATA_HALL_RUNE_6 = 21,
|
||||
DATA_HALL_RUNE_7 = 22,
|
||||
DATA_SCARSHIELD_INFILTRATOR = 23
|
||||
DATA_SCARSHIELD_INFILTRATOR = 23,
|
||||
DATA_BLACKHAND_INCARCERATOR = 24
|
||||
};
|
||||
|
||||
enum BRSCreaturesIds
|
||||
|
||||
@@ -93,10 +93,6 @@ public:
|
||||
events.ScheduleEvent(EVENT_RESPAWN, 5s);
|
||||
// Hack for missing trigger spell
|
||||
events.ScheduleEvent(EVENT_FIRE_SHIELD, 3s);
|
||||
|
||||
// Open doors on reset
|
||||
if (instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS)
|
||||
OpenDoors(false); // Opens 2 entrance doors
|
||||
}
|
||||
|
||||
void SetData(uint32 /*type*/, uint32 data) override
|
||||
@@ -106,18 +102,6 @@ public:
|
||||
case 1:
|
||||
events.ScheduleEvent(EVENT_PLAYER_CHECK, 5s);
|
||||
break;
|
||||
case 2:
|
||||
// Close these two doors on Blackhand Incarcerators aggro
|
||||
if (GameObject* door1 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_IN)))
|
||||
if (door1->GetGoState() == GO_STATE_ACTIVE)
|
||||
door1->SetGoState(GO_STATE_READY);
|
||||
if (GameObject* door2 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_DOORS)))
|
||||
if (door2->GetGoState() == GO_STATE_ACTIVE)
|
||||
door2->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
case 3:
|
||||
Reset();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -135,8 +119,6 @@ public:
|
||||
{
|
||||
// Activate all the runes
|
||||
UpdateRunes(GO_STATE_READY);
|
||||
// Opens all 3 doors
|
||||
OpenDoors(true);
|
||||
// Complete encounter
|
||||
instance->SetBossState(DATA_PYROGAURD_EMBERSEER, DONE);
|
||||
}
|
||||
@@ -146,7 +128,10 @@ public:
|
||||
if (spell->Id == SPELL_ENCAGE_EMBERSEER)
|
||||
{
|
||||
if (!me->GetAuraCount(SPELL_ENCAGED_EMBERSEER))
|
||||
{
|
||||
me->CastSpell(me, SPELL_ENCAGED_EMBERSEER);
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
if (spell->Id == SPELL_EMBERSEER_GROWING_TRIGGER)
|
||||
@@ -156,7 +141,6 @@ public:
|
||||
|
||||
if (me->GetAuraCount(SPELL_EMBERSEER_GROWING_TRIGGER) == 20)
|
||||
{
|
||||
me->RemoveAura(SPELL_ENCAGED_EMBERSEER);
|
||||
me->RemoveAura(SPELL_FREEZE_ANIM);
|
||||
me->CastSpell(me, SPELL_EMBERSEER_FULL_STRENGTH);
|
||||
Talk(EMOTE_FREE_OF_BONDS);
|
||||
@@ -168,20 +152,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void OpenDoors(bool Boss_Killed)
|
||||
{
|
||||
// These two doors reopen on reset or boss kill
|
||||
if (GameObject* door1 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_IN)))
|
||||
door1->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* door2 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_DOORS)))
|
||||
door2->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
// This door opens on boss kill
|
||||
if (Boss_Killed)
|
||||
if (GameObject* door3 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_OUT)))
|
||||
door3->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
|
||||
void UpdateRunes(GOState state)
|
||||
{
|
||||
// update all runes
|
||||
@@ -213,18 +183,7 @@ public:
|
||||
{
|
||||
case EVENT_RESPAWN:
|
||||
{
|
||||
// Respawn all Blackhand Incarcerators
|
||||
std::list<Creature*> creatureList;
|
||||
GetCreatureListWithEntryInGrid(creatureList, me, NPC_BLACKHAND_INCARCERATOR, 35.0f);
|
||||
for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
|
||||
if (Creature* creature = *itr)
|
||||
{
|
||||
if (!creature->IsAlive())
|
||||
creature->Respawn();
|
||||
|
||||
creature->AI()->SetData(1, 1);
|
||||
}
|
||||
me->AddAura(SPELL_ENCAGED_EMBERSEER, me);
|
||||
instance->SetData(DATA_BLACKHAND_INCARCERATOR, 1);
|
||||
instance->SetBossState(DATA_PYROGAURD_EMBERSEER, NOT_STARTED);
|
||||
break;
|
||||
}
|
||||
@@ -236,8 +195,13 @@ public:
|
||||
for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
|
||||
{
|
||||
if (Creature* creature = *itr)
|
||||
creature->AI()->SetData(1, 1);
|
||||
{
|
||||
creature->SetImmuneToAll(false);
|
||||
creature->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||
DoZoneInCombat(creature);
|
||||
}
|
||||
}
|
||||
me->RemoveAura(SPELL_ENCAGED_EMBERSEER);
|
||||
events.ScheduleEvent(EVENT_PRE_FIGHT_2, 32000);
|
||||
break;
|
||||
}
|
||||
@@ -253,13 +217,16 @@ public:
|
||||
break;
|
||||
case EVENT_PLAYER_CHECK:
|
||||
{
|
||||
// Check to see if all players in instance have aura SPELL_EMBERSEER_START before starting event
|
||||
bool _hasAura = true;
|
||||
// As of Patch 3.0.8 only one person needs to channel the altar
|
||||
bool _hasAura = false;
|
||||
Map::PlayerList const& players = me->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
if (Player* player = itr->GetSource()->ToPlayer())
|
||||
if (!player->HasAura(SPELL_EMBERSEER_OBJECT_VISUAL))
|
||||
_hasAura = false;
|
||||
if (player->HasAura(SPELL_EMBERSEER_OBJECT_VISUAL))
|
||||
{
|
||||
_hasAura = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (_hasAura)
|
||||
{
|
||||
@@ -289,20 +256,20 @@ public:
|
||||
{
|
||||
case EVENT_FIRE_SHIELD:
|
||||
DoCast(me, SPELL_FIRE_SHIELD);
|
||||
events.ScheduleEvent(EVENT_FIRE_SHIELD, 3s);
|
||||
events.Repeat(Seconds(3));
|
||||
break;
|
||||
case EVENT_FIRENOVA:
|
||||
DoCast(me, SPELL_FIRENOVA);
|
||||
events.ScheduleEvent(EVENT_FIRENOVA, 6s);
|
||||
events.Repeat(Seconds(6));
|
||||
break;
|
||||
case EVENT_FLAMEBUFFET:
|
||||
DoCast(me, SPELL_FLAMEBUFFET);
|
||||
events.ScheduleEvent(EVENT_FLAMEBUFFET, 14s);
|
||||
events.Repeat(Seconds(14));
|
||||
break;
|
||||
case EVENT_PYROBLAST:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
DoCast(target, SPELL_PYROBLAST);
|
||||
events.ScheduleEvent(EVENT_PYROBLAST, 15s);
|
||||
events.Repeat(Seconds(15));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -343,37 +310,13 @@ public:
|
||||
{
|
||||
npc_blackhand_incarceratorAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void Reset() override
|
||||
void JustAppeared() override
|
||||
{
|
||||
me->SetImmuneToAll(true);
|
||||
if (Creature* Emberseer = me->FindNearestCreature(NPC_PYROGAURD_EMBERSEER, 30.0f, true))
|
||||
Emberseer->AI()->SetData(1, 3);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
me->DespawnOrUnsummon(10000);
|
||||
}
|
||||
|
||||
void SetData(uint32 data, uint32 value) override
|
||||
{
|
||||
if (data == 1 && value == 1)
|
||||
{
|
||||
me->SetImmuneToAll(false);
|
||||
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||
_events.CancelEvent(EVENT_ENCAGED_EMBERSEER);
|
||||
}
|
||||
|
||||
if (data == 1 && value == 2)
|
||||
_events.ScheduleEvent(EVENT_ENCAGED_EMBERSEER, 1s);
|
||||
DoCast(SPELL_ENCAGE_EMBERSEER);
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* /*who*/) override
|
||||
{
|
||||
// Used to close doors
|
||||
if (Creature* Emberseer = me->FindNearestCreature(NPC_PYROGAURD_EMBERSEER, 30.0f, true))
|
||||
Emberseer->AI()->SetData(1, 2);
|
||||
|
||||
// Had to do this because CallForHelp will ignore any npcs without LOS
|
||||
std::list<Creature*> creatureList;
|
||||
GetCreatureListWithEntryInGrid(creatureList, me, NPC_BLACKHAND_INCARCERATOR, 60.0f);
|
||||
@@ -387,31 +330,17 @@ public:
|
||||
_events.ScheduleEvent(EVENT_ENCAGE, 10s, 20s);
|
||||
}
|
||||
|
||||
void JustReachedHome() override
|
||||
{
|
||||
DoCast(SPELL_ENCAGE_EMBERSEER);
|
||||
|
||||
me->SetImmuneToAll(true);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
|
||||
|
||||
if (!UpdateVictim())
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_ENCAGED_EMBERSEER:
|
||||
{
|
||||
if (me->GetPositionX() == me->GetHomePosition().GetPositionX())
|
||||
if (!me->HasAura(SPELL_ENCAGE_EMBERSEER))
|
||||
if (Creature* Emberseer = me->FindNearestCreature(NPC_PYROGAURD_EMBERSEER, 30.0f, true))
|
||||
DoCast(Emberseer, SPELL_ENCAGE_EMBERSEER);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
@@ -421,11 +350,11 @@ public:
|
||||
{
|
||||
case EVENT_STRIKE:
|
||||
DoCastVictim(SPELL_STRIKE, true);
|
||||
_events.ScheduleEvent(EVENT_STRIKE, 14s, 23s);
|
||||
_events.Repeat(Seconds(14), Seconds(23));
|
||||
break;
|
||||
case EVENT_ENCAGE:
|
||||
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), EVENT_ENCAGE, true);
|
||||
_events.ScheduleEvent(EVENT_ENCAGE, 6s, 12s);
|
||||
_events.Repeat(Seconds(6), Seconds(12));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -30,6 +30,8 @@ uint32 const DragonspireMobs[3] = { NPC_BLACKHAND_DREADWEAVER, NPC_BLACKHAND_SUM
|
||||
|
||||
DoorData const doorData[] =
|
||||
{
|
||||
{ GO_DOORS, DATA_PYROGAURD_EMBERSEER, DOOR_TYPE_ROOM },
|
||||
{ GO_EMBERSEER_OUT, DATA_PYROGAURD_EMBERSEER, DOOR_TYPE_PASSAGE },
|
||||
{ GO_DRAKKISATH_DOOR_1, DATA_GENERAL_DRAKKISATH, DOOR_TYPE_PASSAGE },
|
||||
{ GO_DRAKKISATH_DOOR_2, DATA_GENERAL_DRAKKISATH, DOOR_TYPE_PASSAGE },
|
||||
{ 0, 0, DOOR_TYPE_ROOM }
|
||||
@@ -119,6 +121,9 @@ public:
|
||||
case NPC_SCARSHIELD_INFILTRATOR:
|
||||
ScarshieldInfiltrator = creature->GetGUID();
|
||||
break;
|
||||
case NPC_BLACKHAND_INCARCERATOR:
|
||||
_incarceratorList.push_back(creature->GetGUID());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,6 +298,10 @@ public:
|
||||
if (GetBossState(DATA_DRAGONSPIRE_ROOM) != DONE)
|
||||
Events.ScheduleEvent(EVENT_DARGONSPIRE_ROOM_STORE, 1s);
|
||||
}
|
||||
case DATA_BLACKHAND_INCARCERATOR:
|
||||
for (GuidList::const_iterator itr = _incarceratorList.begin(); itr != _incarceratorList.end(); ++itr)
|
||||
if (Creature* creature = instance->GetCreature(*itr))
|
||||
creature->Respawn();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -520,6 +529,7 @@ public:
|
||||
ObjectGuid runecreaturelist[7][5];
|
||||
ObjectGuid go_portcullis_active;
|
||||
ObjectGuid go_portcullis_tobossrooms;
|
||||
GuidList _incarceratorList;
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const override
|
||||
|
||||
Reference in New Issue
Block a user