TrinityCore
Loading...
Searching...
No Matches
boss_moragg.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "InstanceScript.h"
20#include "ScriptedCreature.h"
21#include "SpellAuraEffects.h"
22#include "SpellScript.h"
23#include "violet_hold.h"
24
37
38// 29316 - Moragg
39// 32235 - Chaos Watcher
40struct boss_moragg : public BossAI
41{
42 boss_moragg(Creature* creature) : BossAI(creature, DATA_MORAGG) { }
43
44 void Reset() override
45 {
47 }
48
49 void JustEngagedWith(Unit* who) override
50 {
52 }
53
59
60 void UpdateAI(uint32 diff) override
61 {
62 if (!UpdateVictim())
63 return;
64
65 scheduler.Update(diff,
66 std::bind(&BossAI::DoMeleeAttackIfReady, this));
67 }
68
69 void ScheduleTasks() override
70 {
71 scheduler.Async([this]
72 {
75 });
76
77 scheduler.Schedule(15s, [this](TaskContext task)
78 {
79 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
80 DoCast(target, SPELL_OPTIC_LINK);
81 task.Repeat(25s);
82 });
83
84 scheduler.Schedule(5s, [this](TaskContext task)
85 {
87 task.Repeat(10s);
88 });
89 }
90};
91
92// 54438, 59523 - Ray of Pain
93// 54442, 59524 - Ray of Suffering
95{
97
98 void OnPeriodic(AuraEffect const* aurEff)
99 {
101
102 if (UnitAI* AI = GetTarget()->GetAI())
103 if (Unit* target = AI->SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true))
104 {
105 uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell;
106 GetTarget()->CastSpell(target, triggerSpell, aurEff);
107 }
108 }
109
114};
115
116// 54396 - Optic Link
118{
120
121 void OnPeriodic(AuraEffect const* aurEff)
122 {
123 if (Unit* caster = GetCaster())
124 {
125 if (aurEff->GetTickNumber() >= 8)
126 caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_3, aurEff);
127
128 if (aurEff->GetTickNumber() >= 4)
129 caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_2, aurEff);
130
131 caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_1, aurEff);
132 }
133 }
134
135 void OnUpdate(AuraEffect* aurEff)
136 {
137 switch (aurEff->GetTickNumber())
138 {
139 case 1:
140 aurEff->SetAmount(aurEff->GetAmount() + 250); // base amount is 500
141 break;
142 case 4:
143 aurEff->SetAmount(aurEff->GetAmount() * 2); // goes to 1500
144 break;
145 case 8:
146 aurEff->SetAmount(aurEff->GetAmount() * 2); // goes to 3000
147 break;
148 default:
149 break;
150 }
151 }
152
158};
159
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectUpdatePeriodicFn(F, I, N)
MoraggSpells
@ SPELL_RAY_OF_SUFFERING
@ SPELL_OPTIC_LINK
@ SPELL_RAY_OF_PAIN
@ SPELL_OPTIC_LINK_LEVEL_3
@ SPELL_CORROSIVE_SALIVA
@ SPELL_OPTIC_LINK_LEVEL_1
@ SPELL_OPTIC_LINK_LEVEL_2
void AddSC_boss_moragg()
uint32 GetTickNumber() const
SpellEffectInfo const & GetSpellEffectInfo() const
void SetAmount(int32 amount)
int32 GetAmount() const
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
Unit * GetTarget() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
TaskScheduler scheduler
void JustReachedHome() override
void Reset() override
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
uint32 TriggerSpell
Definition SpellInfo.h:228
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Async(std::function< void()> const &callable)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
PrepareAuraScript(spell_moragg_ray)
void OnPeriodic(AuraEffect const *aurEff)
void Register() override
void JustEngagedWith(Unit *who) override
boss_moragg(Creature *creature)
void JustReachedHome() override
void UpdateAI(uint32 diff) override
void Reset() override
void ScheduleTasks() override
@ DATA_HANDLE_CELLS
Definition violet_hold.h:86
@ DATA_MORAGG
Definition violet_hold.h:53
#define RegisterVioletHoldCreatureAI(ai_name)