Core/Scripting: UBRS Boss Pyroguard Emberseer closer to being fully scripted.

This commit is contained in:
Malcrom
2013-06-23 16:16:42 -02:30
parent bb5ef1b462
commit 1a576fa7b2
4 changed files with 277 additions and 31 deletions

View File

@@ -0,0 +1,3 @@
-- Move Blackhand Incarcerator to core scripting
UPDATE `creature_template` SET `AIName`= '',`ScriptName`= 'npc_blackhand_incarcerator' WHERE `entry`=10316;
DELETE FROM `smart_scripts` WHERE `entryorguid`=10316;

View File

@@ -67,13 +67,13 @@ enum CreaturesIds
NPC_GENERAL_DRAKKISATH = 10363,
NPC_BLACKHAND_DREADWEAVER = 9817,
NPC_BLACKHAND_SUMMONER = 9818,
NPC_BLACKHAND_VETERAN = 9819
NPC_BLACKHAND_VETERAN = 9819,
NPC_BLACKHAND_INCARCERATOR = 10316
};
enum AdditionalData
{
SPELL_SUMMON_ROOKERY_WHELP = 15745,
MAX_DRAGONSPIRE_HALL_RUNES = 7,
EVENT_PYROGUARD_EMBERSEER = 4884,
AREATRIGGER_ENTER_UBRS = 2046,
AREATRIGGER_STADIUM = 2026
@@ -91,6 +91,7 @@ enum GameObjectsIds
GO_GYTH_EXIT_DOOR = 175186,
GO_DRAKKISATH_DOOR_1 = 175946,
GO_DRAKKISATH_DOOR_2 = 175947,
GO_BLACKROCK_ALTAR = 175706,
// Runes in dragonspire hall
GO_ROOM_1_RUNE = 175197,
GO_ROOM_2_RUNE = 175199,

View File

@@ -42,12 +42,14 @@ enum Spells
enum Events
{
EVENT_FIRENOVA = 1,
EVENT_FLAMEBUFFET = 2,
EVENT_PYROBLAST = 3
// OOC
EVENT_RESPAWN = 1,
// Combat
EVENT_FIRENOVA = 2,
EVENT_FLAMEBUFFET = 3,
EVENT_PYROBLAST = 4
};
class boss_pyroguard_emberseer : public CreatureScript
{
public:
@@ -64,17 +66,50 @@ public:
void Reset()
{
if (instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS)
OpenDoors(false);
// respawn any dead Blackhand Incarcerators
DoCast(me, SPELL_ENCAGED_EMBERSEER);
//DoCast(me, SPELL_FIRE_SHIELD_TRIGGER);
_Reset();
if (instance)
{
// Apply auras on spawn and reset
DoCast(me, SPELL_ENCAGED_EMBERSEER);
// DoCast(me, SPELL_FIRE_SHIELD_TRIGGER); // Need to find this in old DBC if possible
// Open doors on reset
if (instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS)
OpenDoors(false); // Opens 2 entrance doors
// ### TODO Reset Blackrock Altar ###
// respawn any dead Blackhand Incarcerators
events.ScheduleEvent(EVENT_RESPAWN, 1000);
instance->SetBossState(DATA_PYROGAURD_EMBERSEER, NOT_STARTED);
}
}
void SetData(uint32 type, uint32 data)
{
if (instance && type == 1 && data == 1)
{
instance->SetBossState(DATA_PYROGAURD_EMBERSEER, IN_PROGRESS);
// Close these two doors on encounter start
if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN)))
door1->SetGoState(GO_STATE_READY);
if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS)))
door2->SetGoState(GO_STATE_READY);
// ### TODO Script pre fight scripting of Emberseer ###
// ### TODO Set data on Blackhand Incarcerator ###
// ### TODO disable Blackrock Altar ###
}
}
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
// ### TODO Check combat timing ###
events.ScheduleEvent(EVENT_FIRENOVA, 6000);
events.ScheduleEvent(EVENT_FLAMEBUFFET, 3000);
events.ScheduleEvent(EVENT_PYROBLAST, 14000);
@@ -82,16 +117,41 @@ public:
void JustDied(Unit* /*killer*/)
{
OpenDoors(true);
_JustDied();
if (instance)
{
// Activate all the runes
if (GameObject* rune1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_1)))
rune1->SetGoState(GO_STATE_READY);
if (GameObject* rune2 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_2)))
rune2->SetGoState(GO_STATE_READY);
if (GameObject* rune3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_3)))
rune3->SetGoState(GO_STATE_READY);
if (GameObject* rune4 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_4)))
rune4->SetGoState(GO_STATE_READY);
if (GameObject* rune5 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_5)))
rune5->SetGoState(GO_STATE_READY);
if (GameObject* rune6 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_6)))
rune6->SetGoState(GO_STATE_READY);
if (GameObject* rune7 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_7)))
rune7->SetGoState(GO_STATE_READY);
// Opens all 3 doors
OpenDoors(true);
instance->SetBossState(DATA_PYROGAURD_EMBERSEER, DONE);
}
}
void OpenDoors(bool Boss_Killed)
{
// These two doors reopen on reset or boss kill
if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN)))
door1->SetGoState(GO_STATE_ACTIVE);
if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS)))
door2->SetGoState(GO_STATE_ACTIVE);
// This door opens on boss kill
if (Boss_Killed)
if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_OUT)))
door3->SetGoState(GO_STATE_ACTIVE);
@@ -99,11 +159,27 @@ public:
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (!UpdateVictim())
{
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_RESPAWN:
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* creatureList = *itr)
if (!creatureList->IsAlive())
creatureList->Respawn();
break;
}
}
return;
}
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
@@ -113,26 +189,133 @@ public:
{
case EVENT_FIRENOVA:
DoCastVictim(SPELL_FIRENOVA);
events.ScheduleEvent(EVENT_FIRENOVA, 6 * IN_MILLISECONDS);
events.ScheduleEvent(EVENT_FIRENOVA, 6000);
break;
case EVENT_FLAMEBUFFET:
DoCastVictim(SPELL_FLAMEBUFFET);
events.ScheduleEvent(EVENT_FLAMEBUFFET, 14 * IN_MILLISECONDS);
events.ScheduleEvent(EVENT_FLAMEBUFFET, 14000);
break;
case EVENT_PYROBLAST:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
DoCast(target, SPELL_PYROBLAST);
events.ScheduleEvent(EVENT_PYROBLAST, 15 * IN_MILLISECONDS);
events.ScheduleEvent(EVENT_PYROBLAST, 15000);
break;
}
}
DoMeleeAttackIfReady();
}
};
};
/*####
## npc_blackhand_incarcerator
####*/
enum IncarceratorSpells
{
SPELL_ENCAGE_EMBERSEER = 15281, // Emberseer on spawn
SPELL_STRIKE = 15580, // Combat
SPELL_ENCAGE = 16045 // Combat
};
enum IncarceratorEvents
{
// Out of combat
EVENT_ENCAGED_EMBERSEER = 1,
// Combat
EVENT_STRIKE = 2,
EVENT_ENCAGE = 3
};
class npc_blackhand_incarcerator : public CreatureScript
{
public:
npc_blackhand_incarcerator() : CreatureScript("npc_blackhand_incarcerator") { }
struct npc_blackhand_incarceratorAI : public ScriptedAI
{
npc_blackhand_incarceratorAI(Creature* creature) : ScriptedAI(creature) {}
void Reset()
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
_events.ScheduleEvent(EVENT_ENCAGED_EMBERSEER, 1000);
}
void JustDied(Unit* /*killer*/)
{
me->DespawnOrUnsummon(10000);
}
void SetData(uint32 data, uint32 value)
{
if (data == 1 && value == 1)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveAura(SPELL_ENCAGE_EMBERSEER);
// ### TODO attack nearest target ###
}
}
void EnterCombat(Unit* /*who*/)
{
_events.ScheduleEvent(EVENT_STRIKE, urand(8000, 16000));
_events.ScheduleEvent(EVENT_ENCAGE, urand(10000, 20000));
}
void UpdateAI(uint32 diff)
{
_events.Update(diff);
if (!UpdateVictim())
{
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_ENCAGED_EMBERSEER:
if(!me->HasAura(SPELL_ENCAGE_EMBERSEER))
if (Creature* Emberseer = me->FindNearestCreature(NPC_PYROGAURD_EMBERSEER, 30.0f, true))
DoCast(Emberseer, SPELL_ENCAGE_EMBERSEER);
_events.ScheduleEvent(EVENT_ENCAGED_EMBERSEER, 1000);
break;
}
}
return;
}
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_STRIKE:
DoCastVictim(SPELL_STRIKE, true);
_events.ScheduleEvent(EVENT_STRIKE, urand(14000, 23000));
break;
case EVENT_ENCAGE:
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), EVENT_ENCAGE, true);
_events.ScheduleEvent(EVENT_ENCAGE, urand(6000, 12000));
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
private:
EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_blackhand_incarceratorAI(creature);
}
};
void AddSC_boss_pyroguard_emberseer()
{
new boss_pyroguard_emberseer();
new npc_blackhand_incarcerator();
}

View File

@@ -112,6 +112,8 @@ public:
break;
case NPC_PYROGAURD_EMBERSEER:
PyroguardEmberseer = creature->GetGUID();
if ((GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE))
creature->DespawnOrUnsummon();
break;
case NPC_WARCHIEF_REND_BLACKHAND:
WarchiefRendBlackhand = creature->GetGUID();
@@ -141,19 +143,16 @@ public:
break;
case GO_EMBERSEER_IN:
go_emberseerin = go->GetGUID();
if ((GetBossState(DATA_DRAGONSPIRE_ROOM) == DONE))
go->SetGoState(GO_STATE_ACTIVE);
break;
case GO_DOORS:
go_doors = go->GetGUID();
if ((GetBossState(DATA_DRAGONSPIRE_ROOM) == DONE))
go->SetGoState(GO_STATE_ACTIVE);
break;
case GO_EMBERSEER_OUT:
go_emberseerout = go->GetGUID();
if ((GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE))
go->SetGoState(GO_STATE_ACTIVE);
break;
@@ -192,6 +191,41 @@ public:
if ((GetBossState(DATA_ROOM_7_RUNE) == DONE))
go->SetGoState(GO_STATE_READY);
break;
case GO_EMBERSEER_RUNE_1:
go_emberseerrunes[0] = go->GetGUID();
if ((GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE))
go->SetGoState(GO_STATE_READY);
break;
case GO_EMBERSEER_RUNE_2:
go_emberseerrunes[1] = go->GetGUID();
if ((GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE))
go->SetGoState(GO_STATE_READY);
break;
case GO_EMBERSEER_RUNE_3:
go_emberseerrunes[2] = go->GetGUID();
if ((GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE))
go->SetGoState(GO_STATE_READY);
break;
case GO_EMBERSEER_RUNE_4:
go_emberseerrunes[3] = go->GetGUID();
if ((GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE))
go->SetGoState(GO_STATE_READY);
break;
case GO_EMBERSEER_RUNE_5:
go_emberseerrunes[4] = go->GetGUID();
if ((GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE))
go->SetGoState(GO_STATE_READY);
break;
case GO_EMBERSEER_RUNE_6:
go_emberseerrunes[5] = go->GetGUID();
if ((GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE))
go->SetGoState(GO_STATE_READY);
break;
case GO_EMBERSEER_RUNE_7:
go_emberseerrunes[6] = go->GetGUID();
if ((GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE))
go->SetGoState(GO_STATE_READY);
break;
}
}
@@ -230,7 +264,8 @@ public:
{
case EVENT_PYROGUARD_EMBERSEER:
if (GetBossState(DATA_PYROGAURD_EMBERSEER) == NOT_STARTED)
SetBossState(DATA_PYROGAURD_EMBERSEER, IN_PROGRESS);
if (Creature* Emberseer = instance->GetCreature(PyroguardEmberseer))
Emberseer->AI()->SetData(1, 1);
break;
default:
break;
@@ -297,6 +332,7 @@ public:
break;
case GO_ROOM_2_RUNE:
return go_roomrunes[1];
break;
case GO_ROOM_3_RUNE:
return go_roomrunes[2];
break;
@@ -312,6 +348,27 @@ public:
case GO_ROOM_7_RUNE:
return go_roomrunes[6];
break;
case GO_EMBERSEER_RUNE_1:
return go_emberseerrunes[0];
break;
case GO_EMBERSEER_RUNE_2:
return go_emberseerrunes[1];
break;
case GO_EMBERSEER_RUNE_3:
return go_emberseerrunes[2];
break;
case GO_EMBERSEER_RUNE_4:
return go_emberseerrunes[3];
break;
case GO_EMBERSEER_RUNE_5:
return go_emberseerrunes[4];
break;
case GO_EMBERSEER_RUNE_6:
return go_emberseerrunes[5];
break;
case GO_EMBERSEER_RUNE_7:
return go_emberseerrunes[6];
break;
}
return 0;
}
@@ -341,10 +398,12 @@ public:
void Dragonspireroomstore()
{
uint8 creaturecount = 0;
uint8 creaturecount;
for (uint8 i = 0; i < 7; ++i)
{
creaturecount = 0;
if (GameObject* rune = instance->GetGameObject(go_roomrunes[i]))
{
for (uint8 ii = 0; ii < 3; ++ii)
@@ -360,7 +419,6 @@ public:
}
}
}
creaturecount = 0;
}
}
}
@@ -416,8 +474,8 @@ public:
}
if (GetBossState(DATA_ROOM_1_RUNE) == DONE && GetBossState(DATA_ROOM_2_RUNE) == DONE && GetBossState(DATA_ROOM_3_RUNE) == DONE &&
GetBossState(DATA_ROOM_4_RUNE) == DONE &&GetBossState(DATA_ROOM_5_RUNE) == DONE && GetBossState(DATA_ROOM_6_RUNE) == DONE &&
GetBossState(DATA_ROOM_7_RUNE) == DONE)
GetBossState(DATA_ROOM_4_RUNE) == DONE &&GetBossState(DATA_ROOM_5_RUNE) == DONE && GetBossState(DATA_ROOM_6_RUNE) == DONE &&
GetBossState(DATA_ROOM_7_RUNE) == DONE)
{
SetBossState(DATA_DRAGONSPIRE_ROOM, DONE);
if (GameObject* door1 = instance->GetGameObject(go_emberseerin))
@@ -490,7 +548,8 @@ public:
uint64 go_emberseerin;
uint64 go_doors;
uint64 go_emberseerout;
uint64 go_roomrunes[MAX_DRAGONSPIRE_HALL_RUNES];
uint64 go_roomrunes[7];
uint64 go_emberseerrunes[7];
uint64 runecreaturelist[7] [5];
};