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
35
36#define SPELL_RAY_OF_PAIN DUNGEON_MODE(54438,59523)
37#define SPELL_RAY_OF_SUFFERING DUNGEON_MODE(54442,59524)
38
39// 29316 - Moragg
40// 32235 - Chaos Watcher
41struct boss_moragg : public BossAI
42{
43 boss_moragg(Creature* creature) : BossAI(creature, DATA_MORAGG) { }
44
45 void Reset() override
46 {
48 }
49
50 void JustEngagedWith(Unit* who) override
51 {
53 }
54
60
61 void UpdateAI(uint32 diff) override
62 {
63 if (!UpdateVictim())
64 return;
65
66 scheduler.Update(diff);
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{
96 void OnPeriodic(AuraEffect const* aurEff)
97 {
99
100 if (UnitAI* AI = GetTarget()->GetAI())
101 if (Unit* target = AI->SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true))
102 {
103 uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell;
104 GetTarget()->CastSpell(target, triggerSpell, aurEff);
105 }
106 }
107
112};
113
114// 54396 - Optic Link
116{
117 bool Validate(SpellInfo const* /*spellInfo*/) override
118 {
119 return ValidateSpellInfo(
120 {
124 });
125 }
126
127 void OnPeriodic(AuraEffect const* aurEff)
128 {
129 if (Unit* caster = GetCaster())
130 {
131 if (aurEff->GetTickNumber() >= 8)
132 caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_3, aurEff);
133
134 if (aurEff->GetTickNumber() >= 4)
135 caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_2, aurEff);
136
137 caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_1, aurEff);
138 }
139 }
140
141 void OnUpdate(AuraEffect* aurEff)
142 {
143 switch (aurEff->GetTickNumber())
144 {
145 case 1:
146 aurEff->SetAmount(aurEff->GetAmount() + 250); // base amount is 500
147 break;
148 case 4:
149 aurEff->SetAmount(aurEff->GetAmount() * 2); // goes to 1500
150 break;
151 case 8:
152 aurEff->SetAmount(aurEff->GetAmount() * 2); // goes to 3000
153 break;
154 default:
155 break;
156 }
157 }
158
164};
165
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectUpdatePeriodicFn(F, I, N)
MoraggSpells
@ SPELL_OPTIC_LINK
@ SPELL_OPTIC_LINK_LEVEL_3
@ SPELL_CORROSIVE_SALIVA
@ SPELL_OPTIC_LINK_LEVEL_1
@ SPELL_OPTIC_LINK_LEVEL_2
#define SPELL_RAY_OF_SUFFERING
void AddSC_boss_moragg()
#define SPELL_RAY_OF_PAIN
uint32 GetTickNumber() const
SpellEffectInfo const & GetSpellEffectInfo() const
void SetAmount(SpellEffectValue amount)
SpellEffectValue 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:63
uint32 TriggerSpell
Definition SpellInfo.h:234
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Async(std::function< void()> callable)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:100
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:87
@ DATA_MORAGG
Definition violet_hold.h:54
#define RegisterVioletHoldCreatureAI(ai_name)