diff options
Diffstat (limited to 'src')
3 files changed, 216 insertions, 265 deletions
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index 971df3b696e..5134ae0bab9 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -15,325 +15,286 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: boss_kri, boss_yauj, boss_vem : The Bug Trio -SD%Complete: 100 -SDComment: -SDCategory: Temple of Ahn'Qiraj -EndScriptData */ +/* + * Timers requires to be revisited + * Devour is NYI + */ #include "ScriptMgr.h" #include "InstanceScript.h" -#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "temple_of_ahnqiraj.h" -#include "TemporarySummon.h" -enum Spells +enum BugTrioSpells { - SPELL_CLEAVE = 26350, - SPELL_TOXIC_VOLLEY = 25812, - SPELL_POISON_CLOUD = 38718, //Only Spell with right dmg. - SPELL_ENRAGE = 34624, //Changed cause 25790 is cast on gamers too. Same prob with old explosion of twin emperors. - - SPELL_CHARGE = 26561, - SPELL_KNOCKBACK = 26027, + // Kri + SPELL_THRASH = 3391, + SPELL_CLEAVE = 40504, + SPELL_TOXIC_VOLLEY = 25812, + SPELL_SUMMON_POISON_CLOUD = 26590, + + // Vem + SPELL_CHARGE = 26561, + SPELL_KNOCK_AWAY = 18670, + SPELL_KNOCKDOWN = 19128, + SPELL_VENGEANCE = 25790, + + // Yauj + SPELL_GREAT_HEAL = 25807, + SPELL_FEAR = 26580, + SPELL_RAVAGE = 3242, + SPELL_DISPEL = 25808, + SPELL_SUMMON_YAUJ_BROOD = 25789, + + // Shared + SPELL_DESPAWN_BROOD = 25792, + SPELL_BLOODY_DEATH = 25770 // NYI +}; - SPELL_HEAL = 25807, - SPELL_FEAR = 19408 +enum BugTrioEvents +{ + // Kri + EVENT_THRASH = 1, + EVENT_CLEAVE, + EVENT_TOXIC_VOLLEY, + + // Vem + EVENT_VEM_CHARGE, + EVENT_KNOCK_AWAY, + EVENT_KNOCKDOWN, + + // Yauj + EVENT_GREAT_HEAL, + EVENT_FEAR, + EVENT_RAVAGE, + EVENT_DISPEL }; -class boss_kri : public CreatureScript +static void RespawnDeadBugs(InstanceScript* instance) { -public: - boss_kri() : CreatureScript("boss_kri") { } + for (uint32 type : { DATA_KRI, DATA_VEM, DATA_YAUJ }) + if (Creature* bug = instance->GetCreature(type)) + if (bug->isDead()) + bug->DespawnOrUnsummon(1ms, 1s); +} + +// 15511 - Lord Kri +struct boss_kri : public BossAI +{ + boss_kri(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) { } - CreatureAI* GetAI(Creature* creature) const override + void JustEngagedWith(Unit* who) override { - return GetAQ40AI<boss_kriAI>(creature); + BossAI::JustEngagedWith(who); + + events.ScheduleEvent(EVENT_THRASH, 5s, 10s); + events.ScheduleEvent(EVENT_CLEAVE, 5s, 15s); + events.ScheduleEvent(EVENT_TOXIC_VOLLEY, 15s, 25s); } - struct boss_kriAI : public BossAI + /// @todo: This should be in BaseAI (needs to be created to implement Devour) + void JustReachedHome() override { - boss_kriAI(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) - { - Initialize(); - } + _JustReachedHome(); + DoCastSelf(SPELL_DESPAWN_BROOD, true); + RespawnDeadBugs(instance); + } - void Initialize() - { - Cleave_Timer = urand(4000, 8000); - ToxicVolley_Timer = urand(6000, 12000); - Check_Timer = 2000; + void JustDied(Unit* /*killer*/) override + { + if (instance->GetData(DATA_BUG_TRIO_DEATH) < 2) + me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE); - VemDead = false; - Death = false; - } + instance->SetData(DATA_BUG_TRIO_DEATH, 1); - uint32 Cleave_Timer; - uint32 ToxicVolley_Timer; - uint32 Check_Timer; + DoCastSelf(SPELL_SUMMON_POISON_CLOUD, true); + } - bool VemDead; - bool Death; + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; - void Reset() override - { - Initialize(); - _Reset(); - } + events.Update(diff); - void JustDied(Unit* /*killer*/) override - { - if (instance->GetData(DATA_BUG_TRIO_DEATH) < 2)// Unlootable if death - me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - instance->SetData(DATA_BUG_TRIO_DEATH, 1); - } - void UpdateAI(uint32 diff) override + while (uint32 eventId = events.ExecuteEvent()) { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCastVictim(SPELL_CLEAVE); - Cleave_Timer = urand(5000, 12000); - } else Cleave_Timer -= diff; - - //ToxicVolley_Timer - if (ToxicVolley_Timer <= diff) - { - DoCastVictim(SPELL_TOXIC_VOLLEY); - ToxicVolley_Timer = urand(10000, 15000); - } else ToxicVolley_Timer -= diff; - - if (!HealthAbovePct(5) && !Death) + switch (eventId) { - DoCastVictim(SPELL_POISON_CLOUD); - Death = true; + case EVENT_THRASH: + DoCastSelf(SPELL_THRASH); + events.Repeat(5s, 15s); + break; + case EVENT_CLEAVE: + DoCastVictim(SPELL_CLEAVE); + events.Repeat(5s, 15s); + break; + case EVENT_TOXIC_VOLLEY: + DoCastSelf(SPELL_TOXIC_VOLLEY); + events.Repeat(5s, 20s); + break; + default: + break; } - if (!VemDead) - { - //Checking if Vem is dead. If yes we will enrage. - if (Check_Timer <= diff) - { - if (instance->GetData(DATA_VEMISDEAD)) - { - DoCast(me, SPELL_ENRAGE); - VemDead = true; - } - Check_Timer = 2000; - } else Check_Timer -=diff; - } - - DoMeleeAttackIfReady(); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; } - }; + DoMeleeAttackIfReady(); + } }; -class boss_vem : public CreatureScript +// 15544 - Vem +struct boss_vem : public BossAI { -public: - boss_vem() : CreatureScript("boss_vem") { } + boss_vem(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) { } - CreatureAI* GetAI(Creature* creature) const override + void JustEngagedWith(Unit* who) override { - return GetAQ40AI<boss_vemAI>(creature); + BossAI::JustEngagedWith(who); + + events.ScheduleEvent(EVENT_VEM_CHARGE, 15s, 25s); + events.ScheduleEvent(EVENT_KNOCK_AWAY, 20s, 30s); + events.ScheduleEvent(EVENT_KNOCKDOWN, 20s, 30s); } - struct boss_vemAI : public BossAI + /// @todo: This should be in BaseAI (needs to be created to implement Devour) + void JustReachedHome() override { - boss_vemAI(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) - { - Initialize(); - } + _JustReachedHome(); + DoCastSelf(SPELL_DESPAWN_BROOD, true); + RespawnDeadBugs(instance); + } - void Initialize() - { - Charge_Timer = urand(15000, 27000); - KnockBack_Timer = urand(8000, 20000); - Enrage_Timer = 120000; + void JustDied(Unit* /*killer*/) override + { + if (instance->GetData(DATA_BUG_TRIO_DEATH) < 2) + me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE); - Enraged = false; - } + instance->SetData(DATA_BUG_TRIO_DEATH, 1); - uint32 Charge_Timer; - uint32 KnockBack_Timer; - uint32 Enrage_Timer; + DoCastSelf(SPELL_VENGEANCE, true); + } - bool Enraged; + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; - void Reset() override - { - Initialize(); - _Reset(); - } + events.Update(diff); - void JustDied(Unit* /*killer*/) override - { - instance->SetData(DATA_VEM_DEATH, 0); - if (instance->GetData(DATA_BUG_TRIO_DEATH) < 2)// Unlootable if death - me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE); - instance->SetData(DATA_BUG_TRIO_DEATH, 1); - } + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - void UpdateAI(uint32 diff) override + while (uint32 eventId = events.ExecuteEvent()) { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Charge_Timer - if (Charge_Timer <= diff) - { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - { - DoCast(target, SPELL_CHARGE); - //me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1); - AttackStart(target); - } - - Charge_Timer = urand(8000, 16000); - } else Charge_Timer -= diff; - - //KnockBack_Timer - if (KnockBack_Timer <= diff) + switch (eventId) { - DoCastVictim(SPELL_KNOCKBACK); - if (GetThreat(me->GetVictim())) - ModifyThreatByPercent(me->GetVictim(), -80); - KnockBack_Timer = urand(15000, 25000); - } else KnockBack_Timer -= diff; - - //Enrage_Timer - if (!Enraged && Enrage_Timer <= diff) - { - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } else Charge_Timer -= diff; + case EVENT_VEM_CHARGE: + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) + DoCast(target, SPELL_CHARGE); + events.Repeat(15s, 25s); + break; + case EVENT_KNOCK_AWAY: + DoCastVictim(SPELL_KNOCK_AWAY); + events.Repeat(15s, 20s); + break; + case EVENT_KNOCKDOWN: + DoCastVictim(SPELL_KNOCKDOWN); + events.Repeat(10s, 20s); + break; + default: + break; + } - DoMeleeAttackIfReady(); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; } - }; + DoMeleeAttackIfReady(); + } }; -class boss_yauj : public CreatureScript +// 15543 - Princess Yauj +struct boss_yauj : public BossAI { -public: - boss_yauj() : CreatureScript("boss_yauj") { } + boss_yauj(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) { } - CreatureAI* GetAI(Creature* creature) const override + void JustEngagedWith(Unit* who) override { - return GetAQ40AI<boss_yaujAI>(creature); + BossAI::JustEngagedWith(who); + + events.ScheduleEvent(EVENT_GREAT_HEAL, 5s, 10s); + events.ScheduleEvent(EVENT_FEAR, 10s, 15s); + events.ScheduleEvent(EVENT_RAVAGE, 10s, 20s); + events.ScheduleEvent(EVENT_DISPEL, 10s, 30s); } - struct boss_yaujAI : public BossAI + void JustReachedHome() override { - boss_yaujAI(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) - { - Initialize(); - } + _JustReachedHome(); + RespawnDeadBugs(instance); + } - void Initialize() - { - Heal_Timer = urand(25000, 40000); - Fear_Timer = urand(12000, 24000); - Check_Timer = 2000; + void JustDied(Unit* /*killer*/) override + { + if (instance->GetData(DATA_BUG_TRIO_DEATH) < 2) + me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE); + instance->SetData(DATA_BUG_TRIO_DEATH, 1); - VemDead = false; - } + DoCastSelf(SPELL_SUMMON_YAUJ_BROOD, true); + } - uint32 Heal_Timer; - uint32 Fear_Timer; - uint32 Check_Timer; + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; - bool VemDead; + events.Update(diff); - void Reset() override - { - Initialize(); - } + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - void JustDied(Unit* /*killer*/) override + while (uint32 eventId = events.ExecuteEvent()) { - if (instance->GetData(DATA_BUG_TRIO_DEATH) < 2)// Unlootable if death - me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE); - instance->SetData(DATA_BUG_TRIO_DEATH, 1); - - for (uint8 i = 0; i < 10; ++i) + switch (eventId) { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - { - if (Creature* Summoned = me->SummonCreature(15621, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90s)) - Summoned->AI()->AttackStart(target); - } + case EVENT_GREAT_HEAL: + if (Unit* target = DoSelectLowestHpFriendly(250.0f)) + DoCast(target, SPELL_GREAT_HEAL); + events.Repeat(10s, 15s); + break; + case EVENT_FEAR: + DoCastSelf(SPELL_FEAR); + events.Repeat(20s, 30s); + break; + case EVENT_RAVAGE: + DoCastVictim(SPELL_RAVAGE); + events.Repeat(10s, 15s); + break; + case EVENT_DISPEL: + DoCastSelf(SPELL_DISPEL); + events.Repeat(10s, 15s); + break; + default: + break; } - } - void UpdateAI(uint32 diff) override - { - //Return since we have no target - if (!UpdateVictim()) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; - - //Fear_Timer - if (Fear_Timer <= diff) - { - DoCastVictim(SPELL_FEAR); - ResetThreatList(); - Fear_Timer = 20000; - } else Fear_Timer -= diff; - - //Casting Heal to other twins or herself. - if (Heal_Timer <= diff) - { - switch (urand(0, 2)) - { - case 0: - if (Creature* kri = instance->GetCreature(DATA_KRI)) - DoCast(kri, SPELL_HEAL); - break; - case 1: - if (Creature* vem = instance->GetCreature(DATA_VEM)) - DoCast(vem, SPELL_HEAL); - break; - case 2: - DoCast(me, SPELL_HEAL); - break; - } - - Heal_Timer = 15000 + rand32() % 15000; - } else Heal_Timer -= diff; - - //Checking if Vem is dead. If yes we will enrage. - if (Check_Timer <= diff) - { - if (!VemDead) - { - if (instance->GetData(DATA_VEMISDEAD)) - { - DoCast(me, SPELL_ENRAGE); - VemDead = true; - } - } - Check_Timer = 2000; - } else Check_Timer -= diff; - - DoMeleeAttackIfReady(); } - }; + DoMeleeAttackIfReady(); + } }; void AddSC_bug_trio() { - new boss_kri(); - new boss_vem(); - new boss_yauj(); + RegisterAQ40CreatureAI(boss_kri); + RegisterAQ40CreatureAI(boss_vem); + RegisterAQ40CreatureAI(boss_yauj); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp index a6dcf783daa..499db7eed23 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp @@ -31,6 +31,7 @@ ObjectData const creatureData[] = { { NPC_VEM, DATA_VEM }, { NPC_KRI, DATA_KRI }, + { NPC_YAUJ, DATA_YAUJ }, { NPC_VEKLOR, DATA_VEKLOR }, { NPC_VEKNILASH, DATA_VEKNILASH }, { NPC_VISCIDUS, DATA_VISCIDUS }, @@ -67,15 +68,13 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript LoadDoorData(doorData); IsBossDied[0] = false; IsBossDied[1] = false; - IsBossDied[2] = false; BugTrioDeathCount = 0; CthunPhase = 0; } - //If Vem is dead... - bool IsBossDied[3]; + bool IsBossDied[2]; uint32 BugTrioDeathCount; @@ -91,18 +90,13 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript { switch (type) { - case DATA_VEMISDEAD: - if (IsBossDied[0]) - return 1; - break; - case DATA_VEKLORISDEAD: - if (IsBossDied[1]) + if (IsBossDied[0]) return 1; break; case DATA_VEKNILASHISDEAD: - if (IsBossDied[2]) + if (IsBossDied[1]) return 1; break; @@ -119,21 +113,17 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript { switch (type) { - case DATA_VEM_DEATH: - IsBossDied[0] = true; - break; - case DATA_BUG_TRIO_DEATH: if (++BugTrioDeathCount >= 3) SetBossState(DATA_BUG_TRIO, DONE); break; case DATA_VEKLOR_DEATH: - IsBossDied[1] = true; + IsBossDied[0] = true; break; case DATA_VEKNILASH_DEATH: - IsBossDied[2] = true; + IsBossDied[1] = true; break; case DATA_CTHUN_PHASE: diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h index cc8dd0c9431..f0ce8d05ae0 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h @@ -40,8 +40,7 @@ enum AQTDataTypes // Others DATA_KRI = 9, DATA_VEM = 10, - DATA_VEMISDEAD = 11, - DATA_VEM_DEATH = 12, + DATA_YAUJ = 11, DATA_VEKLOR = 13, DATA_VEKLORISDEAD = 14, DATA_VEKLOR_DEATH = 15, @@ -71,6 +70,7 @@ enum AQTCreatures NPC_SKERAM = 15263, NPC_VEM = 15544, NPC_KRI = 15511, + NPC_YAUJ = 15543, NPC_VEKLOR = 15276, NPC_VEKNILASH = 15275, NPC_SARTURA = 15516 |