mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/BWL: Update scripts to new register model (1/3) (#26686)
This commit is contained in:
@@ -95,4 +95,7 @@ inline AI* GetBlackwingLairAI(T* obj)
|
||||
return GetInstanceAI<AI>(obj, BWLScriptName);
|
||||
}
|
||||
|
||||
#define RegisterBlackwingLairCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetBlackwingLairAI)
|
||||
#define RegisterBlackwingLairGameObjectAI(ai_name) RegisterGameObjectAIWithFactory(ai_name, GetBlackwingLairAI)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -54,190 +54,168 @@ enum Actions
|
||||
ACTION_DEACTIVATE = 0
|
||||
};
|
||||
|
||||
class boss_broodlord : public CreatureScript
|
||||
struct boss_broodlord : public BossAI
|
||||
{
|
||||
public:
|
||||
boss_broodlord() : CreatureScript("boss_broodlord") { }
|
||||
boss_broodlord(Creature* creature) : BossAI(creature, DATA_BROODLORD_LASHLAYER) { }
|
||||
|
||||
struct boss_broodlordAI : public BossAI
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
boss_broodlordAI(Creature* creature) : BossAI(creature, DATA_BROODLORD_LASHLAYER) { }
|
||||
BossAI::JustEngagedWith(who);
|
||||
Talk(SAY_AGGRO);
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
events.ScheduleEvent(EVENT_CLEAVE, 8s);
|
||||
events.ScheduleEvent(EVENT_BLASTWAVE, 12s);
|
||||
events.ScheduleEvent(EVENT_MORTALSTRIKE, 20s);
|
||||
events.ScheduleEvent(EVENT_KNOCKBACK, 30s);
|
||||
events.ScheduleEvent(EVENT_CHECK, 1s);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
_JustDied();
|
||||
|
||||
std::list<GameObject*> _goList;
|
||||
GetGameObjectListWithEntryInGrid(_goList, me, GO_SUPPRESSION_DEVICE, 200.0f);
|
||||
for (std::list<GameObject*>::const_iterator itr = _goList.begin(); itr != _goList.end(); itr++)
|
||||
((*itr)->AI()->DoAction(ACTION_DEACTIVATE));
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
Talk(SAY_AGGRO);
|
||||
|
||||
events.ScheduleEvent(EVENT_CLEAVE, 8s);
|
||||
events.ScheduleEvent(EVENT_BLASTWAVE, 12s);
|
||||
events.ScheduleEvent(EVENT_MORTALSTRIKE, 20s);
|
||||
events.ScheduleEvent(EVENT_KNOCKBACK, 30s);
|
||||
events.ScheduleEvent(EVENT_CHECK, 1s);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
_JustDied();
|
||||
|
||||
std::list<GameObject*> _goList;
|
||||
GetGameObjectListWithEntryInGrid(_goList, me, GO_SUPPRESSION_DEVICE, 200.0f);
|
||||
for (std::list<GameObject*>::const_iterator itr = _goList.begin(); itr != _goList.end(); itr++)
|
||||
((*itr)->AI()->DoAction(ACTION_DEACTIVATE));
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
switch (eventId)
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_CLEAVE:
|
||||
DoCastVictim(SPELL_CLEAVE);
|
||||
events.ScheduleEvent(EVENT_CLEAVE, 7s);
|
||||
break;
|
||||
case EVENT_BLASTWAVE:
|
||||
DoCastVictim(SPELL_BLASTWAVE);
|
||||
events.ScheduleEvent(EVENT_BLASTWAVE, 8s, 16s);
|
||||
break;
|
||||
case EVENT_MORTALSTRIKE:
|
||||
DoCastVictim(SPELL_MORTALSTRIKE);
|
||||
events.ScheduleEvent(EVENT_MORTALSTRIKE, 25s, 35s);
|
||||
break;
|
||||
case EVENT_KNOCKBACK:
|
||||
DoCastVictim(SPELL_KNOCKBACK);
|
||||
if (GetThreat(me->GetVictim()))
|
||||
ModifyThreatByPercent(me->GetVictim(), -50);
|
||||
events.ScheduleEvent(EVENT_KNOCKBACK, 15s, 30s);
|
||||
break;
|
||||
case EVENT_CHECK:
|
||||
if (me->GetDistance(me->GetHomePosition()) > 150.0f)
|
||||
{
|
||||
Talk(SAY_LEASH);
|
||||
EnterEvadeMode(EVADE_REASON_BOUNDARY);
|
||||
}
|
||||
events.ScheduleEvent(EVENT_CHECK, 1s);
|
||||
break;
|
||||
}
|
||||
case EVENT_CLEAVE:
|
||||
DoCastVictim(SPELL_CLEAVE);
|
||||
events.ScheduleEvent(EVENT_CLEAVE, 7s);
|
||||
break;
|
||||
case EVENT_BLASTWAVE:
|
||||
DoCastVictim(SPELL_BLASTWAVE);
|
||||
events.ScheduleEvent(EVENT_BLASTWAVE, 8s, 16s);
|
||||
break;
|
||||
case EVENT_MORTALSTRIKE:
|
||||
DoCastVictim(SPELL_MORTALSTRIKE);
|
||||
events.ScheduleEvent(EVENT_MORTALSTRIKE, 25s, 35s);
|
||||
break;
|
||||
case EVENT_KNOCKBACK:
|
||||
DoCastVictim(SPELL_KNOCKBACK);
|
||||
if (GetThreat(me->GetVictim()))
|
||||
ModifyThreatByPercent(me->GetVictim(), -50);
|
||||
events.ScheduleEvent(EVENT_KNOCKBACK, 15s, 30s);
|
||||
break;
|
||||
case EVENT_CHECK:
|
||||
if (me->GetDistance(me->GetHomePosition()) > 150.0f)
|
||||
{
|
||||
Talk(SAY_LEASH);
|
||||
EnterEvadeMode(EVADE_REASON_BOUNDARY);
|
||||
}
|
||||
events.ScheduleEvent(EVENT_CHECK, 1s);
|
||||
break;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetBlackwingLairAI<boss_broodlordAI>(creature);
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
class go_suppression_device : public GameObjectScript
|
||||
struct go_suppression_device : public GameObjectAI
|
||||
{
|
||||
public:
|
||||
go_suppression_device() : GameObjectScript("go_suppression_device") { }
|
||||
go_suppression_device(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()), _active(true) { }
|
||||
|
||||
struct go_suppression_deviceAI : public GameObjectAI
|
||||
void InitializeAI() override
|
||||
{
|
||||
if (_instance->GetBossState(DATA_BROODLORD_LASHLAYER) == DONE)
|
||||
{
|
||||
go_suppression_deviceAI(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()), _active(true) { }
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
if (_instance->GetBossState(DATA_BROODLORD_LASHLAYER) == DONE)
|
||||
{
|
||||
Deactivate();
|
||||
return;
|
||||
}
|
||||
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 0s, 5s);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_SUPPRESSION_CAST:
|
||||
if (me->GetGoState() == GO_STATE_READY)
|
||||
{
|
||||
me->CastSpell(nullptr, SPELL_SUPPRESSION_AURA, true);
|
||||
me->SendCustomAnim(0);
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 5s);
|
||||
break;
|
||||
case EVENT_SUPPRESSION_RESET:
|
||||
Activate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnLootStateChanged(uint32 state, Unit* /*unit*/) override
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case GO_ACTIVATED:
|
||||
Deactivate();
|
||||
_events.CancelEvent(EVENT_SUPPRESSION_CAST);
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_RESET, 30s, 120s);
|
||||
break;
|
||||
case GO_JUST_DEACTIVATED: // This case prevents the Gameobject despawn by Disarm Trap
|
||||
me->SetLootState(GO_READY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DoAction(int32 action) override
|
||||
{
|
||||
if (action == ACTION_DEACTIVATE)
|
||||
{
|
||||
Deactivate();
|
||||
_events.CancelEvent(EVENT_SUPPRESSION_RESET);
|
||||
}
|
||||
}
|
||||
|
||||
void Activate()
|
||||
{
|
||||
if (_active)
|
||||
return;
|
||||
_active = true;
|
||||
if (me->GetGoState() == GO_STATE_ACTIVE)
|
||||
me->SetGoState(GO_STATE_READY);
|
||||
me->SetLootState(GO_READY);
|
||||
me->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 0s);
|
||||
}
|
||||
|
||||
void Deactivate()
|
||||
{
|
||||
if (!_active)
|
||||
return;
|
||||
_active = false;
|
||||
me->SetGoState(GO_STATE_ACTIVE);
|
||||
me->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
_events.CancelEvent(EVENT_SUPPRESSION_CAST);
|
||||
}
|
||||
|
||||
private:
|
||||
InstanceScript* _instance;
|
||||
EventMap _events;
|
||||
bool _active;
|
||||
};
|
||||
|
||||
GameObjectAI* GetAI(GameObject* go) const override
|
||||
{
|
||||
return GetBlackwingLairAI<go_suppression_deviceAI>(go);
|
||||
Deactivate();
|
||||
return;
|
||||
}
|
||||
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 0s, 5s);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_SUPPRESSION_CAST:
|
||||
if (me->GetGoState() == GO_STATE_READY)
|
||||
{
|
||||
me->CastSpell(nullptr, SPELL_SUPPRESSION_AURA, true);
|
||||
me->SendCustomAnim(0);
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 5s);
|
||||
break;
|
||||
case EVENT_SUPPRESSION_RESET:
|
||||
Activate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnLootStateChanged(uint32 state, Unit* /*unit*/) override
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case GO_ACTIVATED:
|
||||
Deactivate();
|
||||
_events.CancelEvent(EVENT_SUPPRESSION_CAST);
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_RESET, 30s, 120s);
|
||||
break;
|
||||
case GO_JUST_DEACTIVATED: // This case prevents the Gameobject despawn by Disarm Trap
|
||||
me->SetLootState(GO_READY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DoAction(int32 action) override
|
||||
{
|
||||
if (action == ACTION_DEACTIVATE)
|
||||
{
|
||||
Deactivate();
|
||||
_events.CancelEvent(EVENT_SUPPRESSION_RESET);
|
||||
}
|
||||
}
|
||||
|
||||
void Activate()
|
||||
{
|
||||
if (_active)
|
||||
return;
|
||||
_active = true;
|
||||
if (me->GetGoState() == GO_STATE_ACTIVE)
|
||||
me->SetGoState(GO_STATE_READY);
|
||||
me->SetLootState(GO_READY);
|
||||
me->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 0s);
|
||||
}
|
||||
|
||||
void Deactivate()
|
||||
{
|
||||
if (!_active)
|
||||
return;
|
||||
_active = false;
|
||||
me->SetGoState(GO_STATE_ACTIVE);
|
||||
me->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
_events.CancelEvent(EVENT_SUPPRESSION_CAST);
|
||||
}
|
||||
|
||||
private:
|
||||
InstanceScript* _instance;
|
||||
EventMap _events;
|
||||
bool _active;
|
||||
};
|
||||
|
||||
void AddSC_boss_broodlord()
|
||||
{
|
||||
new boss_broodlord();
|
||||
new go_suppression_device();
|
||||
RegisterBlackwingLairCreatureAI(boss_broodlord);
|
||||
RegisterBlackwingLairGameObjectAI(go_suppression_device);
|
||||
}
|
||||
|
||||
@@ -67,276 +67,254 @@ enum Events
|
||||
EVENT_FRENZY = 5
|
||||
};
|
||||
|
||||
class boss_chromaggus : public CreatureScript
|
||||
struct boss_chromaggus : public BossAI
|
||||
{
|
||||
public:
|
||||
boss_chromaggus() : CreatureScript("boss_chromaggus") { }
|
||||
|
||||
struct boss_chromaggusAI : public BossAI
|
||||
boss_chromaggus(Creature* creature) : BossAI(creature, DATA_CHROMAGGUS)
|
||||
{
|
||||
boss_chromaggusAI(Creature* creature) : BossAI(creature, DATA_CHROMAGGUS)
|
||||
Initialize();
|
||||
|
||||
Breath1_Spell = 0;
|
||||
Breath2_Spell = 0;
|
||||
|
||||
// Select the 2 breaths that we are going to use until despawned
|
||||
// 5 possiblities for the first breath, 4 for the second, 20 total possiblites
|
||||
// This way we don't end up casting 2 of the same breath
|
||||
// TL TL would be stupid
|
||||
switch (urand(0, 19))
|
||||
{
|
||||
Initialize();
|
||||
// B1 - Incin
|
||||
case 0:
|
||||
Breath1_Spell = SPELL_INCINERATE;
|
||||
Breath2_Spell = SPELL_TIMELAPSE;
|
||||
break;
|
||||
case 1:
|
||||
Breath1_Spell = SPELL_INCINERATE;
|
||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
||||
break;
|
||||
case 2:
|
||||
Breath1_Spell = SPELL_INCINERATE;
|
||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
||||
break;
|
||||
case 3:
|
||||
Breath1_Spell = SPELL_INCINERATE;
|
||||
Breath2_Spell = SPELL_FROSTBURN;
|
||||
break;
|
||||
|
||||
Breath1_Spell = 0;
|
||||
Breath2_Spell = 0;
|
||||
// B1 - TL
|
||||
case 4:
|
||||
Breath1_Spell = SPELL_TIMELAPSE;
|
||||
Breath2_Spell = SPELL_INCINERATE;
|
||||
break;
|
||||
case 5:
|
||||
Breath1_Spell = SPELL_TIMELAPSE;
|
||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
||||
break;
|
||||
case 6:
|
||||
Breath1_Spell = SPELL_TIMELAPSE;
|
||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
||||
break;
|
||||
case 7:
|
||||
Breath1_Spell = SPELL_TIMELAPSE;
|
||||
Breath2_Spell = SPELL_FROSTBURN;
|
||||
break;
|
||||
|
||||
// Select the 2 breaths that we are going to use until despawned
|
||||
// 5 possiblities for the first breath, 4 for the second, 20 total possiblites
|
||||
// This way we don't end up casting 2 of the same breath
|
||||
// TL TL would be stupid
|
||||
switch (urand(0, 19))
|
||||
//B1 - Acid
|
||||
case 8:
|
||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
||||
Breath2_Spell = SPELL_INCINERATE;
|
||||
break;
|
||||
case 9:
|
||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
||||
Breath2_Spell = SPELL_TIMELAPSE;
|
||||
break;
|
||||
case 10:
|
||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
||||
break;
|
||||
case 11:
|
||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
||||
Breath2_Spell = SPELL_FROSTBURN;
|
||||
break;
|
||||
|
||||
//B1 - Ignite
|
||||
case 12:
|
||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
||||
Breath2_Spell = SPELL_INCINERATE;
|
||||
break;
|
||||
case 13:
|
||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
||||
break;
|
||||
case 14:
|
||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
||||
Breath2_Spell = SPELL_TIMELAPSE;
|
||||
break;
|
||||
case 15:
|
||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
||||
Breath2_Spell = SPELL_FROSTBURN;
|
||||
break;
|
||||
|
||||
//B1 - Frost
|
||||
case 16:
|
||||
Breath1_Spell = SPELL_FROSTBURN;
|
||||
Breath2_Spell = SPELL_INCINERATE;
|
||||
break;
|
||||
case 17:
|
||||
Breath1_Spell = SPELL_FROSTBURN;
|
||||
Breath2_Spell = SPELL_TIMELAPSE;
|
||||
break;
|
||||
case 18:
|
||||
Breath1_Spell = SPELL_FROSTBURN;
|
||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
||||
break;
|
||||
case 19:
|
||||
Breath1_Spell = SPELL_FROSTBURN;
|
||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
||||
break;
|
||||
};
|
||||
|
||||
EnterEvadeMode();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
CurrentVurln_Spell = 0; // We use this to store our last vulnerabilty spell so we can remove it later
|
||||
Enraged = false;
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
|
||||
events.ScheduleEvent(EVENT_SHIMMER, 0s);
|
||||
events.ScheduleEvent(EVENT_BREATH_1, 30s);
|
||||
events.ScheduleEvent(EVENT_BREATH_2, 60s);
|
||||
events.ScheduleEvent(EVENT_AFFLICTION, 10s);
|
||||
events.ScheduleEvent(EVENT_FRENZY, 15s);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
// B1 - Incin
|
||||
case 0:
|
||||
Breath1_Spell = SPELL_INCINERATE;
|
||||
Breath2_Spell = SPELL_TIMELAPSE;
|
||||
break;
|
||||
case 1:
|
||||
Breath1_Spell = SPELL_INCINERATE;
|
||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
||||
break;
|
||||
case 2:
|
||||
Breath1_Spell = SPELL_INCINERATE;
|
||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
||||
break;
|
||||
case 3:
|
||||
Breath1_Spell = SPELL_INCINERATE;
|
||||
Breath2_Spell = SPELL_FROSTBURN;
|
||||
break;
|
||||
case EVENT_SHIMMER:
|
||||
{
|
||||
// Remove old vulnerabilty spell
|
||||
if (CurrentVurln_Spell)
|
||||
me->RemoveAurasDueToSpell(CurrentVurln_Spell);
|
||||
|
||||
// B1 - TL
|
||||
case 4:
|
||||
Breath1_Spell = SPELL_TIMELAPSE;
|
||||
Breath2_Spell = SPELL_INCINERATE;
|
||||
break;
|
||||
case 5:
|
||||
Breath1_Spell = SPELL_TIMELAPSE;
|
||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
||||
break;
|
||||
case 6:
|
||||
Breath1_Spell = SPELL_TIMELAPSE;
|
||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
||||
break;
|
||||
case 7:
|
||||
Breath1_Spell = SPELL_TIMELAPSE;
|
||||
Breath2_Spell = SPELL_FROSTBURN;
|
||||
break;
|
||||
// Cast new random vulnerabilty on self
|
||||
uint32 spell = RAND(SPELL_FIRE_VULNERABILITY, SPELL_FROST_VULNERABILITY, SPELL_SHADOW_VULNERABILITY, SPELL_NATURE_VULNERABILITY, SPELL_ARCANE_VULNERABILITY);
|
||||
DoCast(me, spell);
|
||||
CurrentVurln_Spell = spell;
|
||||
Talk(EMOTE_SHIMMER);
|
||||
events.ScheduleEvent(EVENT_SHIMMER, 45s);
|
||||
break;
|
||||
}
|
||||
case EVENT_BREATH_1:
|
||||
DoCastVictim(Breath1_Spell);
|
||||
events.ScheduleEvent(EVENT_BREATH_1, 60s);
|
||||
break;
|
||||
case EVENT_BREATH_2:
|
||||
DoCastVictim(Breath2_Spell);
|
||||
events.ScheduleEvent(EVENT_BREATH_2, 60s);
|
||||
break;
|
||||
case EVENT_AFFLICTION:
|
||||
{
|
||||
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())
|
||||
{
|
||||
DoCast(player, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true);
|
||||
|
||||
//B1 - Acid
|
||||
case 8:
|
||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
||||
Breath2_Spell = SPELL_INCINERATE;
|
||||
break;
|
||||
case 9:
|
||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
||||
Breath2_Spell = SPELL_TIMELAPSE;
|
||||
break;
|
||||
case 10:
|
||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
||||
break;
|
||||
case 11:
|
||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
||||
Breath2_Spell = SPELL_FROSTBURN;
|
||||
break;
|
||||
if (player->HasAura(SPELL_BROODAF_BLUE) &&
|
||||
player->HasAura(SPELL_BROODAF_BLACK) &&
|
||||
player->HasAura(SPELL_BROODAF_RED) &&
|
||||
player->HasAura(SPELL_BROODAF_BRONZE) &&
|
||||
player->HasAura(SPELL_BROODAF_GREEN))
|
||||
{
|
||||
DoCast(player, SPELL_CHROMATIC_MUT_1);
|
||||
}
|
||||
|
||||
//B1 - Ignite
|
||||
case 12:
|
||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
||||
Breath2_Spell = SPELL_INCINERATE;
|
||||
}
|
||||
}
|
||||
}
|
||||
events.ScheduleEvent(EVENT_AFFLICTION, 10s);
|
||||
break;
|
||||
case 13:
|
||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
||||
case EVENT_FRENZY:
|
||||
DoCast(me, SPELL_FRENZY);
|
||||
events.ScheduleEvent(EVENT_FRENZY, 10s, 15s);
|
||||
break;
|
||||
case 14:
|
||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
||||
Breath2_Spell = SPELL_TIMELAPSE;
|
||||
break;
|
||||
case 15:
|
||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
||||
Breath2_Spell = SPELL_FROSTBURN;
|
||||
break;
|
||||
|
||||
//B1 - Frost
|
||||
case 16:
|
||||
Breath1_Spell = SPELL_FROSTBURN;
|
||||
Breath2_Spell = SPELL_INCINERATE;
|
||||
break;
|
||||
case 17:
|
||||
Breath1_Spell = SPELL_FROSTBURN;
|
||||
Breath2_Spell = SPELL_TIMELAPSE;
|
||||
break;
|
||||
case 18:
|
||||
Breath1_Spell = SPELL_FROSTBURN;
|
||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
||||
break;
|
||||
case 19:
|
||||
Breath1_Spell = SPELL_FROSTBURN;
|
||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
||||
break;
|
||||
};
|
||||
|
||||
EnterEvadeMode();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
CurrentVurln_Spell = 0; // We use this to store our last vulnerabilty spell so we can remove it later
|
||||
Enraged = false;
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
|
||||
events.ScheduleEvent(EVENT_SHIMMER, 0s);
|
||||
events.ScheduleEvent(EVENT_BREATH_1, 30s);
|
||||
events.ScheduleEvent(EVENT_BREATH_2, 60s);
|
||||
events.ScheduleEvent(EVENT_AFFLICTION, 10s);
|
||||
events.ScheduleEvent(EVENT_FRENZY, 15s);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
}
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_SHIMMER:
|
||||
{
|
||||
// Remove old vulnerabilty spell
|
||||
if (CurrentVurln_Spell)
|
||||
me->RemoveAurasDueToSpell(CurrentVurln_Spell);
|
||||
|
||||
// Cast new random vulnerabilty on self
|
||||
uint32 spell = RAND(SPELL_FIRE_VULNERABILITY, SPELL_FROST_VULNERABILITY, SPELL_SHADOW_VULNERABILITY, SPELL_NATURE_VULNERABILITY, SPELL_ARCANE_VULNERABILITY);
|
||||
DoCast(me, spell);
|
||||
CurrentVurln_Spell = spell;
|
||||
Talk(EMOTE_SHIMMER);
|
||||
events.ScheduleEvent(EVENT_SHIMMER, 45s);
|
||||
break;
|
||||
}
|
||||
case EVENT_BREATH_1:
|
||||
DoCastVictim(Breath1_Spell);
|
||||
events.ScheduleEvent(EVENT_BREATH_1, 60s);
|
||||
break;
|
||||
case EVENT_BREATH_2:
|
||||
DoCastVictim(Breath2_Spell);
|
||||
events.ScheduleEvent(EVENT_BREATH_2, 60s);
|
||||
break;
|
||||
case EVENT_AFFLICTION:
|
||||
{
|
||||
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())
|
||||
{
|
||||
DoCast(player, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true);
|
||||
|
||||
if (player->HasAura(SPELL_BROODAF_BLUE) &&
|
||||
player->HasAura(SPELL_BROODAF_BLACK) &&
|
||||
player->HasAura(SPELL_BROODAF_RED) &&
|
||||
player->HasAura(SPELL_BROODAF_BRONZE) &&
|
||||
player->HasAura(SPELL_BROODAF_GREEN))
|
||||
{
|
||||
DoCast(player, SPELL_CHROMATIC_MUT_1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
events.ScheduleEvent(EVENT_AFFLICTION, 10s);
|
||||
break;
|
||||
case EVENT_FRENZY:
|
||||
DoCast(me, SPELL_FRENZY);
|
||||
events.ScheduleEvent(EVENT_FRENZY, 10s, 15s);
|
||||
break;
|
||||
}
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
}
|
||||
|
||||
// Enrage if not already enraged and below 20%
|
||||
if (!Enraged && HealthBelowPct(20))
|
||||
{
|
||||
DoCast(me, SPELL_ENRAGE);
|
||||
Enraged = true;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 Breath1_Spell;
|
||||
uint32 Breath2_Spell;
|
||||
uint32 CurrentVurln_Spell;
|
||||
bool Enraged;
|
||||
};
|
||||
// Enrage if not already enraged and below 20%
|
||||
if (!Enraged && HealthBelowPct(20))
|
||||
{
|
||||
DoCast(me, SPELL_ENRAGE);
|
||||
Enraged = true;
|
||||
}
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetBlackwingLairAI<boss_chromaggusAI>(creature);
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 Breath1_Spell;
|
||||
uint32 Breath2_Spell;
|
||||
uint32 CurrentVurln_Spell;
|
||||
bool Enraged;
|
||||
};
|
||||
|
||||
class go_chromaggus_lever : public GameObjectScript
|
||||
struct go_chromaggus_lever : public GameObjectAI
|
||||
{
|
||||
public:
|
||||
go_chromaggus_lever() : GameObjectScript("go_chromaggus_lever") { }
|
||||
go_chromaggus_lever(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()) { }
|
||||
|
||||
struct go_chromaggus_leverAI : public GameObjectAI
|
||||
bool OnGossipHello(Player* player) override
|
||||
{
|
||||
if (_instance->GetBossState(DATA_CHROMAGGUS) != DONE && _instance->GetBossState(DATA_CHROMAGGUS) != IN_PROGRESS)
|
||||
{
|
||||
go_chromaggus_leverAI(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()) { }
|
||||
_instance->SetBossState(DATA_CHROMAGGUS, IN_PROGRESS);
|
||||
|
||||
bool OnGossipHello(Player* player) override
|
||||
{
|
||||
if (_instance->GetBossState(DATA_CHROMAGGUS) != DONE && _instance->GetBossState(DATA_CHROMAGGUS) != IN_PROGRESS)
|
||||
{
|
||||
_instance->SetBossState(DATA_CHROMAGGUS, IN_PROGRESS);
|
||||
if (Creature* creature = _instance->GetCreature(DATA_CHROMAGGUS))
|
||||
creature->AI()->JustEngagedWith(player);
|
||||
|
||||
if (Creature* creature = _instance->GetCreature(DATA_CHROMAGGUS))
|
||||
creature->AI()->JustEngagedWith(player);
|
||||
|
||||
if (GameObject* go = _instance->GetGameObject(DATA_GO_CHROMAGGUS_DOOR))
|
||||
_instance->HandleGameObject(ObjectGuid::Empty, true, go);
|
||||
}
|
||||
|
||||
me->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE | GO_FLAG_IN_USE);
|
||||
me->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
InstanceScript* _instance;
|
||||
};
|
||||
|
||||
GameObjectAI* GetAI(GameObject* go) const override
|
||||
{
|
||||
return GetBlackwingLairAI<go_chromaggus_leverAI>(go);
|
||||
if (GameObject* go = _instance->GetGameObject(DATA_GO_CHROMAGGUS_DOOR))
|
||||
_instance->HandleGameObject(ObjectGuid::Empty, true, go);
|
||||
}
|
||||
|
||||
me->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE | GO_FLAG_IN_USE);
|
||||
me->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
InstanceScript* _instance;
|
||||
};
|
||||
|
||||
void AddSC_boss_chromaggus()
|
||||
{
|
||||
new boss_chromaggus();
|
||||
new go_chromaggus_lever();
|
||||
RegisterBlackwingLairCreatureAI(boss_chromaggus);
|
||||
RegisterBlackwingLairGameObjectAI(go_chromaggus_lever);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user