diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp | 247 | ||||
-rw-r--r-- | src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h | 1 |
2 files changed, 237 insertions, 11 deletions
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp index bf23ee421c4..e26cba9cb6e 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp @@ -16,20 +16,48 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Buru -SD%Complete: 0 -SDComment: Place Holder -SDCategory: Ruins of Ahn'Qiraj -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "SpellScript.h" #include "ruins_of_ahnqiraj.h" -enum Yells +enum Emotes +{ + EMOTE_TARGET = 0 +}; + +enum Spells +{ + SPELL_CREEPING_PLAGUE = 20512, + SPELL_DISMEMBER = 96, + SPELL_GATHERING_SPEED = 1834, + SPELL_FULL_SPEED = 1557, + SPELL_THORNS = 25640, + SPELL_BURU_TRANSFORM = 24721, + SPELL_SUMMON_HATCHLING = 1881, + SPELL_EXPLODE = 19593, + SPELL_EXPLODE_2 = 5255, + SPELL_BURU_EGG_TRIGGER = 26646 +}; + +enum Events +{ + EVENT_DISMEMBER = 0, + EVENT_GATHERING_SPEED = 1, + EVENT_FULL_SPEED = 2, + EVENT_CREEPING_PLAGUE = 3, + EVENT_RESPAWN_EGG = 4 +}; + +enum Phases { - EMOTE_TARGET = 0 + PHASE_EGG = 0, + PHASE_TRANSFORM = 1 +}; + +enum Actions +{ + ACTION_EXPLODE = 0 }; class boss_buru : public CreatureScript @@ -37,11 +65,125 @@ class boss_buru : public CreatureScript public: boss_buru() : CreatureScript("boss_buru") { } - struct boss_buruAI : public ScriptedAI + struct boss_buruAI : public BossAI { - boss_buruAI(Creature* creature) : ScriptedAI(creature) + boss_buruAI(Creature* creature) : BossAI(creature, DATA_BURU) + { + } + + void EnterEvadeMode() + { + BossAI::EnterEvadeMode(); + + for (std::list<uint64>::iterator i = Eggs.begin(); i != Eggs.end(); ++i) + if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin())) + egg->Respawn(); + + Eggs.clear(); + } + + void EnterCombat(Unit* who) + { + _EnterCombat(); + Talk(EMOTE_TARGET, who->GetGUID()); + DoCast(me, SPELL_THORNS); + + events.ScheduleEvent(EVENT_DISMEMBER, 5000); + events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000); + events.ScheduleEvent(EVENT_FULL_SPEED, 60000); + + _phase = PHASE_EGG; + } + + void DoAction(int32 const action) + { + if (action == ACTION_EXPLODE) + if (_phase == PHASE_EGG) + me->DealDamage(me, 45000); + } + + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + ChaseNewVictim(); + } + + void ChaseNewVictim() { + if (_phase != PHASE_EGG) + return; + + me->RemoveAurasDueToSpell(SPELL_FULL_SPEED); + me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); + events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000); + events.ScheduleEvent(EVENT_FULL_SPEED, 60000); + + if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + { + DoResetThreat(); + AttackStart(victim); + Talk(EMOTE_TARGET, victim->GetGUID()); + } } + + void ManageRespawn(uint64 EggGUID) + { + ChaseNewVictim(); + Eggs.push_back(EggGUID); + events.ScheduleEvent(EVENT_RESPAWN_EGG, 100000); + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DISMEMBER: + DoCastVictim(SPELL_DISMEMBER); + events.ScheduleEvent(EVENT_DISMEMBER, 5000); + break; + case EVENT_GATHERING_SPEED: + DoCast(me, SPELL_GATHERING_SPEED); + events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000); + break; + case EVENT_FULL_SPEED: + DoCast(me, SPELL_FULL_SPEED); + break; + case EVENT_CREEPING_PLAGUE: + DoCast(me, SPELL_CREEPING_PLAGUE); + events.ScheduleEvent(EVENT_CREEPING_PLAGUE, 6000); + break; + case EVENT_RESPAWN_EGG: + if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin())) + { + egg->Respawn(); + Eggs.pop_front(); + } + break; + default: + break; + } + } + + if (me->GetHealthPct() < 20.0f && _phase == PHASE_EGG) + { + DoCast(me, SPELL_BURU_TRANSFORM); // Enrage + DoCast(me, SPELL_FULL_SPEED, true); + me->RemoveAurasDueToSpell(SPELL_THORNS); + _phase = PHASE_TRANSFORM; + } + + DoMeleeAttackIfReady(); + } + private: + uint8 _phase; + std::list<uint64> Eggs; }; CreatureAI* GetAI(Creature* creature) const @@ -50,7 +192,90 @@ class boss_buru : public CreatureScript } }; +class npc_buru_egg : public CreatureScript +{ + public: + npc_buru_egg() : CreatureScript("npc_buru_egg") { } + + struct npc_buru_eggAI : public Scripted_NoMovementAI + { + npc_buru_eggAI(Creature* creature) : Scripted_NoMovementAI(creature) + { + _instance = me->GetInstanceScript(); + } + + void EnterCombat(Unit* attacker) + { + if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU))) + if (!buru->isInCombat()) + buru->AI()->AttackStart(attacker); + } + + void JustSummoned(Creature* who) + { + if (who->GetEntry() == NPC_HATCHLING) + if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU))) + if (Unit* target = buru->AI()->SelectTarget(SELECT_TARGET_RANDOM)) + who->AI()->AttackStart(target); + } + + void JustDied(Unit* /*killer*/) + { + DoCastAOE(SPELL_EXPLODE, true); + DoCastAOE(SPELL_EXPLODE_2, true); // Unknown purpose + DoCast(me, SPELL_SUMMON_HATCHLING, true); + + if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU))) + if (boss_buru::boss_buruAI* buruAI = dynamic_cast<boss_buru::boss_buruAI*>(buru->AI())) + buruAI->ManageRespawn(me->GetGUID()); + } + private: + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_buru_eggAI(creature); + } +}; + +class spell_egg_explosion : public SpellScriptLoader +{ + public: + spell_egg_explosion() : SpellScriptLoader("spell_egg_explosion") { } + + class spell_egg_explosion_SpellScript : public SpellScript + { + PrepareSpellScript(spell_egg_explosion_SpellScript); + + void HandleAfterCast() + { + if (Creature* buru = GetCaster()->FindNearestCreature(NPC_BURU, 5.f)) + buru->AI()->DoAction(ACTION_EXPLODE); + } + + void HandleDummyHitTarget(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + GetCaster()->DealDamage(target, -16 * GetCaster()->GetDistance(target) + 500); + } + + void Register() + { + AfterCast += SpellCastFn(spell_egg_explosion_SpellScript::HandleAfterCast); + OnEffectHitTarget += SpellEffectFn(spell_egg_explosion_SpellScript::HandleDummyHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_egg_explosion_SpellScript(); + } +}; + void AddSC_boss_buru() { new boss_buru(); + new npc_buru_egg(); + new spell_egg_explosion(); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h index 7581470dce6..6ece21f627b 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h @@ -42,6 +42,7 @@ enum Creatures NPC_HIVEZARA_LARVA = 15555, NPC_SAND_VORTEX = 15428, NPC_OSSIRIAN_TRIGGER = 15590, + NPC_HATCHLING = 15521 }; enum GameObjects |