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
39struct boss_moragg : public BossAI
40{
41 boss_moragg(Creature* creature) : BossAI(creature, DATA_MORAGG) { }
42
43 void Reset() override
44 {
46 }
47
48 void JustEngagedWith(Unit* who) override
49 {
51 }
52
58
59 void UpdateAI(uint32 diff) override
60 {
61 if (!UpdateVictim())
62 return;
63
64 scheduler.Update(diff);
65 }
66
67 void ScheduleTasks() override
68 {
69 scheduler.Async([this]
70 {
73 });
74
75 scheduler.Schedule(Seconds(15), [this](TaskContext& task)
76 {
77 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
78 DoCast(target, SPELL_OPTIC_LINK);
79 task.Repeat(Seconds(25));
80 });
81
82 scheduler.Schedule(Seconds(5), [this](TaskContext& task)
83 {
85 task.Repeat(Seconds(10));
86 });
87 }
88};
89
90// 54438, 59523 - Ray of Pain
91// 54442, 59524 - Ray of Suffering
93{
94 void OnPeriodic(AuraEffect const* aurEff)
95 {
97
98 if (UnitAI* AI = GetTarget()->GetAI())
99 if (Unit* target = AI->SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true))
100 {
101 uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell;
102 GetTarget()->CastSpell(target, triggerSpell, aurEff);
103 }
104 }
105
110};
111
112// 54396 - Optic Link
114{
115 bool Validate(SpellInfo const* /*spellInfo*/) override
116 {
117 return ValidateSpellInfo(
118 {
122 });
123 }
124
125 void OnPeriodic(AuraEffect const* aurEff)
126 {
127 if (Unit* caster = GetCaster())
128 {
129 if (aurEff->GetTickNumber() >= 8)
130 caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_3, aurEff);
131
132 if (aurEff->GetTickNumber() >= 4)
133 caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_2, aurEff);
134
135 caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_1, aurEff);
136 }
137 }
138
139 void OnUpdate(AuraEffect* aurEff)
140 {
141 switch (aurEff->GetTickNumber())
142 {
143 case 1:
144 aurEff->SetAmount(aurEff->GetAmount() + 250); // base amount is 500
145 break;
146 case 4:
147 aurEff->SetAmount(aurEff->GetAmount() * 2); // goes to 1500
148 break;
149 case 8:
150 aurEff->SetAmount(aurEff->GetAmount() * 2); // goes to 3000
151 break;
152 default:
153 break;
154 }
155 }
156
162};
163
uint32_t uint32
Definition Define.h:154
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
Spells
Definition PlayerAI.cpp:32
#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)
@ 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)
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:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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)