diff options
author | Gustavo <sirikfoll@hotmail.com> | 2017-02-05 18:52:14 -0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-06-15 18:41:09 +0200 |
commit | 384f2d636cfd57c43ed88d5826f6c41a75391920 (patch) | |
tree | bdbdca8bb2cc2bfce562efefa76a957bc5fd3af1 /src | |
parent | 8d6d00dc15d85700c0cb8872303811a5fa6c5c85 (diff) |
Core/Scripts: boss The Curator (Karazhan) rework (#19040)
Closes #16099
(cherrypicked from 169e150628913a84d44cac2cc4a70976de0a025a)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp | 251 |
1 files changed, 117 insertions, 134 deletions
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 83f0997689d..7b50281aaa3 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -16,34 +16,39 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Curator -SD%Complete: 100 -SDComment: -SDCategory: Karazhan -EndScriptData */ - #include "ScriptMgr.h" #include "karazhan.h" #include "ScriptedCreature.h" +#include "karazhan.h" + +enum CuratorSays +{ + SAY_AGGRO = 0, + SAY_SUMMON = 1, + SAY_EVOCATE = 2, + SAY_ENRAGE = 3, + SAY_KILL = 4, + SAY_DEATH = 5 +}; -enum Curator +enum CuratorSpells { - SAY_AGGRO = 0, - SAY_SUMMON = 1, - SAY_EVOCATE = 2, - SAY_ENRAGE = 3, - SAY_KILL = 4, - SAY_DEATH = 5, - - //Flare spell info - SPELL_ASTRAL_FLARE_PASSIVE = 30234, //Visual effect + Flare damage - - //Curator spell info - SPELL_HATEFUL_BOLT = 30383, - SPELL_EVOCATION = 30254, - SPELL_ENRAGE = 30403, //Arcane Infusion: Transforms Curator and adds damage. - SPELL_BERSERK = 26662, + SPELL_HATEFUL_BOLT = 30383, + SPELL_EVOCATION = 30254, + SPELL_ARCANE_INFUSION = 30403, + SPELL_BERSERK = 26662, + SPELL_SUMMON_ASTRAL_FLARE_NE = 30236, + SPELL_SUMMON_ASTRAL_FLARE_NW = 30239, + SPELL_SUMMON_ASTRAL_FLARE_SE = 30240, + SPELL_SUMMON_ASTRAL_FLARE_SW = 30241 +}; + +enum CuratorEvents +{ + EVENT_HATEFUL_BOLT = 1, + EVENT_SUMMON_ASTRAL_FLARE, + EVENT_ARCANE_INFUSION, + EVENT_BERSERK }; class boss_curator : public CreatureScript @@ -51,160 +56,138 @@ class boss_curator : public CreatureScript public: boss_curator() : CreatureScript("boss_curator") { } - CreatureAI* GetAI(Creature* creature) const override + struct boss_curatorAI : public BossAI { - return GetKarazhanAI<boss_curatorAI>(creature); - } - - struct boss_curatorAI : public ScriptedAI - { - boss_curatorAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - } - - void Initialize() - { - AddTimer = 10000; - HatefulBoltTimer = 15000; //This time may be wrong - BerserkTimer = 720000; //12 minutes - Enraged = false; - Evocating = false; - } - - uint32 AddTimer; - uint32 HatefulBoltTimer; - uint32 BerserkTimer; - - bool Enraged; - bool Evocating; + boss_curatorAI(Creature* creature) : BossAI(creature, DATA_CURATOR), _infused(false) { } void Reset() override { - Initialize(); - + _Reset(); + _infused = false; me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true); } - void KilledUnit(Unit* /*victim*/) override + void KilledUnit(Unit* victim) override { - Talk(SAY_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) override { + _JustDied(); Talk(SAY_DEATH); } void EnterCombat(Unit* /*who*/) override { + _EnterCombat(); Talk(SAY_AGGRO); + + events.ScheduleEvent(EVENT_HATEFUL_BOLT, Seconds(12)); + events.ScheduleEvent(EVENT_SUMMON_ASTRAL_FLARE, Seconds(10)); + events.ScheduleEvent(EVENT_BERSERK, Minutes(12)); } - void UpdateAI(uint32 diff) override + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) override { - if (!UpdateVictim()) - return; - - //always decrease BerserkTimer - if (BerserkTimer <= diff) - { - //if evocate, then break evocate - if (Evocating) - { - if (me->HasAura(SPELL_EVOCATION)) - me->RemoveAurasDueToSpell(SPELL_EVOCATION); - - Evocating = false; - } - - //may not be correct SAY (generic hard enrage) - Talk(SAY_ENRAGE); - - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_BERSERK); - - //don't know if he's supposed to do summon/evocate after hard enrage (probably not) - Enraged = true; - } else BerserkTimer -= diff; - - if (Evocating) + if (!HealthAbovePct(15) && !_infused) { - //not supposed to do anything while evocate - if (me->HasAura(SPELL_EVOCATION)) - return; - else - Evocating = false; + _infused = true; + events.ScheduleEvent(EVENT_ARCANE_INFUSION, Milliseconds(1)); + events.CancelEvent(EVENT_SUMMON_ASTRAL_FLARE); } + } - if (!Enraged) + void ExecuteEvent(uint32 eventId) override + { + switch (eventId) { - if (AddTimer <= diff) - { - //Summon Astral Flare - Creature* AstralFlare = DoSpawnCreature(17096, float(rand32() % 37), float(rand32() % 37), 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - - if (AstralFlare && target) - { - AstralFlare->CastSpell(AstralFlare, SPELL_ASTRAL_FLARE_PASSIVE, false); - AstralFlare->AI()->AttackStart(target); - } - - //Reduce Mana by 10% of max health - if (int32 mana = me->GetMaxPower(POWER_MANA)) + case EVENT_HATEFUL_BOLT: + if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1)) + DoCast(target, SPELL_HATEFUL_BOLT); + events.Repeat(Seconds(7), Seconds(15)); + break; + case EVENT_ARCANE_INFUSION: + DoCastSelf(SPELL_ARCANE_INFUSION, true); + break; + case EVENT_SUMMON_ASTRAL_FLARE: + if (roll_chance_i(50)) + Talk(SAY_SUMMON); + + DoCastSelf(RAND(SPELL_SUMMON_ASTRAL_FLARE_NE, SPELL_SUMMON_ASTRAL_FLARE_NW, SPELL_SUMMON_ASTRAL_FLARE_SE, SPELL_SUMMON_ASTRAL_FLARE_SW), true); + + if (int32 mana = int32(me->GetMaxPower(POWER_MANA) / 10)) { - mana /= 10; me->ModifyPower(POWER_MANA, -mana); - //if this get's us below 10%, then we evocate (the 10th should be summoned now) - if (me->GetPowerPct(POWER_MANA) < 10.f) + if (me->GetPower(POWER_MANA) * 100 / me->GetMaxPower(POWER_MANA) < 10) { Talk(SAY_EVOCATE); me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_EVOCATION); - Evocating = true; - //no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected - return; - } - else - { - if (urand(0, 1) == 0) - { - Talk(SAY_SUMMON); - } + DoCastSelf(SPELL_EVOCATION); } } - - AddTimer = 10000; - } else AddTimer -= diff; - - if (!HealthAbovePct(15)) - { - Enraged = true; - DoCast(me, SPELL_ENRAGE); + events.Repeat(Seconds(10)); + break; + case EVENT_BERSERK: Talk(SAY_ENRAGE); - } + DoCastSelf(SPELL_BERSERK, true); + break; + default: + break; } + } - if (HatefulBoltTimer <= diff) - { - if (Enraged) - HatefulBoltTimer = 7000; - else - HatefulBoltTimer = 15000; + private: + bool _infused; + }; - if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1)) - DoCast(target, SPELL_HATEFUL_BOLT); - } else HatefulBoltTimer -= diff; + CreatureAI* GetAI(Creature* creature) const override + { + return GetKarazhanAI<boss_curatorAI>(creature); + } +}; + +class npc_curator_astral_flare : public CreatureScript +{ +public: + npc_curator_astral_flare() : CreatureScript("npc_curator_astral_flare") { } - DoMeleeAttackIfReady(); + struct npc_curator_astral_flareAI : public ScriptedAI + { + npc_curator_astral_flareAI(Creature* creature) : ScriptedAI(creature) + { + me->SetReactState(REACT_PASSIVE); + } + + void Reset() override + { + _scheduler.Schedule(Seconds(2), [this](TaskContext /*context*/) + { + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + DoZoneInCombat(); + }); + } + + void UpdateAI(uint32 diff) override + { + _scheduler.Update(diff); } + + private: + TaskScheduler _scheduler; }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetKarazhanAI<npc_curator_astral_flareAI>(creature); + } }; void AddSC_boss_curator() { new boss_curator(); + new npc_curator_astral_flare(); } |