diff options
author | Gustavo <sirikfoll@hotmail.com> | 2017-02-10 00:01:39 -0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-06-15 18:41:09 +0200 |
commit | 7fbae7530dd97294821fb2ac58589b49b0040db4 (patch) | |
tree | 904894920545b8e0f7b2d194646cea694a05f30e | |
parent | 77a73a737c8aefb6f48bbcc47f26b1f9967fc1be (diff) |
Core/Scripts Rework boss Terestian Illhoof (Karazhan) (#19057)
(cherrypicked from 87f2cb04cada92590e163d60c729c9e6c1c270f5)
-rw-r--r-- | sql/updates/world/master/2019_06_15_11_world_2017_02_09_01_world.sql | 7 | ||||
-rw-r--r-- | src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp | 498 |
2 files changed, 200 insertions, 305 deletions
diff --git a/sql/updates/world/master/2019_06_15_11_world_2017_02_09_01_world.sql b/sql/updates/world/master/2019_06_15_11_world_2017_02_09_01_world.sql new file mode 100644 index 00000000000..5be733fb530 --- /dev/null +++ b/sql/updates/world/master/2019_06_15_11_world_2017_02_09_01_world.sql @@ -0,0 +1,7 @@ +UPDATE `creature_template` SET `unit_flags`=33555200 WHERe `entry`=17265; +UPDATE `spell_target_position` SET `PositionX`=-11240.5, `PositionY`=-1717.25, `PositionZ`=179.238 WHERE `ID`=30171 AND `EffectIndex`=0; -- `Orientation`=1.32986 +UPDATE `spell_target_position` SET `PositionX`=-11251.6, `PositionY`=-1703.42, `PositionZ`=179.238 WHERE `ID`=30179 and`EffectIndex`=0; -- `Orientation`=6.1522 + +DELETE FROM `spell_target_position` WHERE `ID`=30120; +INSERT INTO `spell_target_position` (`ID`,`EffectIndex`,`MapID`,`PositionX`,`PositionY`,`PositionZ`,`VerifiedBuild`)VALUES +(30120, 0, 532, -11234.2, -1698.46, 179.24, 0); -- `Orientation`=0.67621 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index c469d8130da..b1f960d7de2 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -16,13 +16,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Terestian_Illhoof -SD%Complete: 95 -SDComment: Complete! Needs adjustments to use spell though. -SDCategory: Karazhan -EndScriptData */ - #include "ScriptMgr.h" #include "InstanceScript.h" #include "karazhan.h" @@ -30,349 +23,282 @@ EndScriptData */ #include "PassiveAI.h" #include "ScriptedCreature.h" #include "TemporarySummon.h" +#include "SpellInfo.h" -enum TerestianIllhoof +enum TerestianSays { - SAY_SLAY = 1, - SAY_DEATH = 2, - SAY_AGGRO = 3, - SAY_SACRIFICE = 4, - SAY_SUMMON = 5 + SAY_SLAY = 0, + SAY_DEATH = 1, + SAY_AGGRO = 2, + SAY_SACRIFICE = 3, + SAY_SUMMON_PORTAL = 4 }; -enum Spells +enum TerestianSpells { - SPELL_SUMMON_DEMONCHAINS = 30120, // Summons demonic chains that maintain the ritual of sacrifice. - SPELL_DEMON_CHAINS = 30206, // Instant - Visual Effect - SPELL_ENRAGE = 23537, // Increases the caster's attack speed by 50% and the Physical damage it deals by 219 to 281 for 10 min. - SPELL_SHADOW_BOLT = 30055, // Hurls a bolt of dark magic at an enemy, inflicting Shadow damage. - SPELL_SACRIFICE = 30115, // Teleports and adds the debuff - SPELL_BERSERK = 32965, // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley. - SPELL_SUMMON_FIENDISIMP = 30184, // Summons a Fiendish Imp. - SPELL_SUMMON_IMP = 30066, // Summons Kil'rek - - SPELL_FIENDISH_PORTAL = 30171, // Opens portal and summons Fiendish Portal, 2 sec cast - SPELL_FIENDISH_PORTAL_1 = 30179, // Opens portal and summons Fiendish Portal, instant cast - - SPELL_FIREBOLT = 30050, // Blasts a target for 150 Fire damage. - SPELL_BROKEN_PACT = 30065, // All damage taken increased by 25%. - SPELL_AMPLIFY_FLAMES = 30053, // Increases the Fire damage taken by an enemy by 500 for 25 sec. + SPELL_SHADOW_BOLT = 30055, + SPELL_SUMMON_IMP = 30066, + SPELL_FIENDISH_PORTAL_1 = 30171, + SPELL_FIENDISH_PORTAL_2 = 30179, + SPELL_BERSERK = 32965, + SPELL_SUMMON_FIENDISH_IMP = 30184, + SPELL_BROKEN_PACT = 30065, + SPELL_AMPLIFY_FLAMES = 30053, + SPELL_FIREBOLT = 30050, + SPELL_SUMMON_DEMONCHAINS = 30120, + SPELL_DEMON_CHAINS = 30206, + SPELL_SACRIFICE = 30115 }; -enum Creatures +enum TerestianMisc { - NPC_DEMONCHAINS = 17248, - NPC_FIENDISHIMP = 17267, - NPC_PORTAL = 17265, + NPC_FIENDISH_PORTAL = 17265, + ACTION_DESPAWN_IMPS = 1 }; -class npc_kilrek : public CreatureScript +enum TerestianEvents +{ + EVENT_SACRIFICE = 1, + EVENT_SHADOWBOLT, + EVENT_SUMMON_PORTAL_1, + EVENT_SUMMON_PORTAL_2, + EVENT_SUMMON_KILREK, + EVENT_ENRAGE +}; + +class boss_terestian_illhoof : public CreatureScript { public: - npc_kilrek() : CreatureScript("npc_kilrek") { } + boss_terestian_illhoof() : CreatureScript("boss_terestian_illhoof") { } - CreatureAI* GetAI(Creature* creature) const override + struct boss_terestianAI : public BossAI { - return GetKarazhanAI<npc_kilrekAI>(creature); - } + boss_terestianAI(Creature* creature) : BossAI(creature, DATA_TERESTIAN) { } - struct npc_kilrekAI : public ScriptedAI - { - npc_kilrekAI(Creature* creature) : ScriptedAI(creature) + void Reset() override { - Initialize(); - instance = creature->GetInstanceScript(); + EntryCheckPredicate pred(NPC_FIENDISH_PORTAL); + summons.DoAction(ACTION_DESPAWN_IMPS, pred); + _Reset(); + + events.ScheduleEvent(EVENT_SHADOWBOLT, Seconds(1)); + events.ScheduleEvent(EVENT_SUMMON_KILREK, Seconds(3)); + events.ScheduleEvent(EVENT_SACRIFICE, Seconds(30)); + events.ScheduleEvent(EVENT_SUMMON_PORTAL_1, Seconds(10)); + events.ScheduleEvent(EVENT_SUMMON_PORTAL_2, Seconds(11)); + events.ScheduleEvent(EVENT_ENRAGE, Minutes(10)); } - void Initialize() + void EnterCombat(Unit* /*who*/) override { - AmplifyTimer = 2000; + _EnterCombat(); + Talk(SAY_AGGRO); } - InstanceScript* instance; - - uint32 AmplifyTimer; - - void Reset() override + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override { - Initialize(); + if (spell->Id == SPELL_BROKEN_PACT) + events.ScheduleEvent(EVENT_SUMMON_KILREK, Seconds(32)); } - void EnterCombat(Unit* /*who*/) override { } + void KilledUnit(Unit* victim) override + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } void JustDied(Unit* /*killer*/) override { - Creature* Terestian = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TERESTIAN)); - if (Terestian && Terestian->IsAlive()) - DoCast(Terestian, SPELL_BROKEN_PACT, true); + Talk(SAY_DEATH); + EntryCheckPredicate pred(NPC_FIENDISH_PORTAL); + summons.DoAction(ACTION_DESPAWN_IMPS, pred); + _JustDied(); } - void UpdateAI(uint32 diff) override + void ExecuteEvent(uint32 eventId) override { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (AmplifyTimer <= diff) + switch (eventId) { - me->InterruptNonMeleeSpells(false); - DoCastVictim(SPELL_AMPLIFY_FLAMES); - - AmplifyTimer = urand(10000, 20000); - } else AmplifyTimer -= diff; - - DoMeleeAttackIfReady(); + case EVENT_SACRIFICE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + { + DoCast(target, SPELL_SACRIFICE, true); + target->CastSpell(target, SPELL_SUMMON_DEMONCHAINS, true); + Talk(SAY_SACRIFICE); + } + events.Repeat(Seconds(42)); + break; + case EVENT_SHADOWBOLT: + if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0)) + DoCast(target, SPELL_SHADOW_BOLT); + events.Repeat(Seconds(4), Seconds(10)); + break; + case EVENT_SUMMON_KILREK: + me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT); + DoCastAOE(SPELL_SUMMON_IMP, true); + break; + case EVENT_SUMMON_PORTAL_1: + Talk(SAY_SUMMON_PORTAL); + DoCastAOE(SPELL_FIENDISH_PORTAL_1); + break; + case EVENT_SUMMON_PORTAL_2: + DoCastAOE(SPELL_FIENDISH_PORTAL_2, true); + break; + case EVENT_ENRAGE: + DoCastSelf(SPELL_BERSERK, true); + break; + default: + break; + } } }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetKarazhanAI<boss_terestianAI>(creature); + } }; -class npc_demon_chain : public CreatureScript +class npc_kilrek : public CreatureScript { public: - npc_demon_chain() : CreatureScript("npc_demon_chain") { } + npc_kilrek() : CreatureScript("npc_kilrek") { } - CreatureAI* GetAI(Creature* creature) const override + struct npc_kilrekAI : public ScriptedAI { - return GetKarazhanAI<npc_demon_chainAI>(creature); - } + npc_kilrekAI(Creature* creature) : ScriptedAI(creature) { } - struct npc_demon_chainAI : public ScriptedAI - { - npc_demon_chainAI(Creature* creature) : ScriptedAI(creature) + void Reset() override { - Initialize(); + _scheduler.Schedule(Seconds(8), [this](TaskContext amplify) + { + DoCastVictim(SPELL_AMPLIFY_FLAMES); + amplify.Repeat(Seconds(9)); + }); } - void Initialize() + void JustDied(Unit* /*killer*/) override { - SacrificeGUID.Clear(); + DoCastAOE(SPELL_BROKEN_PACT, true); + me->DespawnOrUnsummon(Seconds(15)); } - ObjectGuid SacrificeGUID; - - void Reset() override + void UpdateAI(uint32 diff) override { - Initialize(); - } - - void EnterCombat(Unit* /*who*/) override { } - void AttackStart(Unit* /*who*/) override { } - void MoveInLineOfSight(Unit* /*who*/) override { } - + if (!UpdateVictim()) + return; - void JustDied(Unit* /*killer*/) override - { - if (!SacrificeGUID.IsEmpty()) + _scheduler.Update(diff, [this] { - Unit* Sacrifice = ObjectAccessor::GetUnit(*me, SacrificeGUID); - if (Sacrifice) - Sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE); - } + DoMeleeAttackIfReady(); + }); } - }; -}; -class npc_fiendish_portal : public CreatureScript -{ -public: - npc_fiendish_portal() : CreatureScript("npc_fiendish_portal") { } + private: + TaskScheduler _scheduler; + }; CreatureAI* GetAI(Creature* creature) const override { - return GetKarazhanAI<npc_fiendish_portalAI>(creature); + return GetKarazhanAI<npc_kilrekAI>(creature); } +}; - struct npc_fiendish_portalAI : public PassiveAI - { - npc_fiendish_portalAI(Creature* creature) : PassiveAI(creature), summons(me){ } +class npc_demon_chain : public CreatureScript +{ +public: + npc_demon_chain() : CreatureScript("npc_demon_chain") { } - SummonList summons; + struct npc_demon_chainAI : public PassiveAI + { + npc_demon_chainAI(Creature* creature) : PassiveAI(creature) { } - void Reset() override + void IsSummonedBy(Unit* summoner) override { - DespawnAllImp(); + _sacrificeGUID = summoner->GetGUID(); + DoCastSelf(SPELL_DEMON_CHAINS, true); } - void JustSummoned(Creature* summon) override + void JustDied(Unit* /*killer*/) override { - summons.Summon(summon); - DoZoneInCombat(summon); + if (Unit* sacrifice = ObjectAccessor::GetUnit(*me, _sacrificeGUID)) + sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE); } - void DespawnAllImp() - { - summons.DespawnAll(); - } + private: + ObjectGuid _sacrificeGUID; }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetKarazhanAI<npc_demon_chainAI>(creature); + } }; -class npc_fiendish_imp : public CreatureScript +class npc_fiendish_portal : public CreatureScript { public: - npc_fiendish_imp() : CreatureScript("npc_fiendish_imp") { } + npc_fiendish_portal() : CreatureScript("npc_fiendish_portal") { } - CreatureAI* GetAI(Creature* creature) const override + struct npc_fiendish_portalAI : public PassiveAI { - return GetKarazhanAI<npc_fiendish_impAI>(creature); - } + npc_fiendish_portalAI(Creature* creature) : PassiveAI(creature), _summons(me) { } - struct npc_fiendish_impAI : public ScriptedAI - { - npc_fiendish_impAI(Creature* creature) : ScriptedAI(creature) + void Reset() override { - Initialize(); + _scheduler.Schedule(Milliseconds(2400), Seconds(8), [this](TaskContext summonImp) + { + DoCastAOE(SPELL_SUMMON_FIENDISH_IMP, true); + summonImp.Repeat(); + }); } - void Initialize() + void DoAction(int32 action) override { - FireboltTimer = 2000; + if (action == ACTION_DESPAWN_IMPS) + _summons.DespawnAll(); } - uint32 FireboltTimer; - - void Reset() override + void JustSummoned(Creature* summon) override { - Initialize(); - - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); + _summons.Summon(summon); + DoZoneInCombat(summon); } - void EnterCombat(Unit* /*who*/) override { } - void UpdateAI(uint32 diff) override { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (FireboltTimer <= diff) - { - DoCastVictim(SPELL_FIREBOLT); - FireboltTimer = 2200; - } else FireboltTimer -= diff; - - DoMeleeAttackIfReady(); + _scheduler.Update(diff); } - }; -}; -class boss_terestian_illhoof : public CreatureScript -{ -public: - boss_terestian_illhoof() : CreatureScript("boss_terestian_illhoof") { } + private: + SummonList _summons; + TaskScheduler _scheduler; + }; CreatureAI* GetAI(Creature* creature) const override { - return GetKarazhanAI<boss_terestianAI>(creature); + return GetKarazhanAI<npc_fiendish_portalAI>(creature); } +}; - struct boss_terestianAI : public ScriptedAI - { - boss_terestianAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - Initialize(); - } - - void Initialize() - { - PortalsCount = 0; - SacrificeTimer = 30000; - ShadowboltTimer = 5000; - SummonTimer = 10000; - BerserkTimer = 600000; - - SummonedPortals = false; - Berserk = false; - } - - InstanceScript* instance; - - ObjectGuid PortalGUID[2]; - uint8 PortalsCount; - - uint32 SacrificeTimer; - uint32 ShadowboltTimer; - uint32 SummonTimer; - uint32 BerserkTimer; +class npc_fiendish_imp : public CreatureScript +{ +public: + npc_fiendish_imp() : CreatureScript("npc_fiendish_imp") { } - bool SummonedPortals; - bool Berserk; + struct npc_fiendish_impAI : public ScriptedAI + { + npc_fiendish_impAI(Creature* creature) : ScriptedAI(creature) { } void Reset() override { - for (uint8 i = 0; i < 2; ++i) - { - if (!PortalGUID[i].IsEmpty()) - { - if (Creature* pPortal = ObjectAccessor::GetCreature(*me, PortalGUID[i])) - { - ENSURE_AI(npc_fiendish_portal::npc_fiendish_portalAI, pPortal->AI())->DespawnAllImp(); - pPortal->DespawnOrUnsummon(); - } - - PortalGUID[i].Clear(); - } - } - - Initialize(); - - instance->SetBossState(DATA_TERESTIAN, NOT_STARTED); - - me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT); - - if (Minion* Kilrek = me->GetFirstMinion()) + _scheduler.Schedule(Seconds(2), [this](TaskContext firebolt) { - if (!Kilrek->IsAlive()) - { - Kilrek->UnSummon(); - DoCast(me, SPELL_SUMMON_IMP, true); - } - } - else DoCast(me, SPELL_SUMMON_IMP, true); - } - - void EnterCombat(Unit* /*who*/) override - { - Talk(SAY_AGGRO); - } - - void JustSummoned(Creature* summoned) override - { - if (summoned->GetEntry() == NPC_PORTAL) - { - PortalGUID[PortalsCount] = summoned->GetGUID(); - ++PortalsCount; - - if (summoned->m_unitData->CreatedBySpell == SPELL_FIENDISH_PORTAL_1) - { - Talk(SAY_SUMMON); - SummonedPortals = true; - } - } - } - - void KilledUnit(Unit* /*victim*/) override - { - Talk(SAY_SLAY); - } - - void JustDied(Unit* /*killer*/) override - { - for (uint8 i = 0; i < 2; ++i) - { - if (!PortalGUID[i].IsEmpty()) - { - if (Creature* pPortal = ObjectAccessor::GetCreature((*me), PortalGUID[i])) - pPortal->DespawnOrUnsummon(); - - PortalGUID[i].Clear(); - } - } - - Talk(SAY_DEATH); + DoCastVictim(SPELL_FIREBOLT); + firebolt.Repeat(Milliseconds(2400)); + }); - instance->SetBossState(DATA_TERESTIAN, DONE); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); } void UpdateAI(uint32 diff) override @@ -380,65 +306,27 @@ public: if (!UpdateVictim()) return; - if (SacrificeTimer <= diff) + _scheduler.Update(diff, [this] { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); - if (target && target->IsAlive()) - { - DoCast(target, SPELL_SACRIFICE, true); - DoCast(target, SPELL_SUMMON_DEMONCHAINS, true); - - if (Creature* Chains = me->FindNearestCreature(NPC_DEMONCHAINS, 5000)) - { - ENSURE_AI(npc_demon_chain::npc_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID(); - Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); - Talk(SAY_SACRIFICE); - SacrificeTimer = 30000; - } - } - } else SacrificeTimer -= diff; - - if (ShadowboltTimer <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT); - ShadowboltTimer = 10000; - } else ShadowboltTimer -= diff; - - if (SummonTimer <= diff) - { - if (!PortalGUID[0]) - DoCastVictim(SPELL_FIENDISH_PORTAL, false); - - if (!PortalGUID[1]) - DoCastVictim(SPELL_FIENDISH_PORTAL_1, false); - - if (!PortalGUID[0].IsEmpty() && !PortalGUID[1].IsEmpty()) - { - if (Creature* pPortal = ObjectAccessor::GetCreature(*me, PortalGUID[urand(0, 1)])) - pPortal->CastSpell(me->GetVictim(), SPELL_SUMMON_FIENDISIMP, false); - SummonTimer = 5000; - } - } else SummonTimer -= diff; - - if (!Berserk) - { - if (BerserkTimer <= diff) - { - DoCast(me, SPELL_BERSERK); - Berserk = true; - } else BerserkTimer -= diff; - } - - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); + }); } + + private: + TaskScheduler _scheduler; }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetKarazhanAI<npc_fiendish_impAI>(creature); + } }; void AddSC_boss_terestian_illhoof() { new boss_terestian_illhoof(); - new npc_fiendish_imp(); - new npc_fiendish_portal(); new npc_kilrek(); new npc_demon_chain(); + new npc_fiendish_portal(); + new npc_fiendish_imp(); } |