TrinityCore
boss_xevozz.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 "Containers.h"
20#include "InstanceScript.h"
21#include "MotionMaster.h"
22#include "ScriptedCreature.h"
23#include "SpellInfo.h"
24#include "SpellScript.h"
25#include "violet_hold.h"
26
27/*
28 * TODO:
29 * - Implement Ethereal Summon Target
30 */
31
33{
37};
38
39static uint32 const EtherealSphereCount = 3;
40static uint32 const EtherealSphereSummonSpells[EtherealSphereCount] = { 54102, 54137, 54138 };
41static uint32 const EtherealSphereHeroicSummonSpells[EtherealSphereCount] = { 54102, 54137, 54138 };
42
43enum NPCs
44{
48};
49
51{
56};
57
58#define SPELL_ARCANE_POWER DUNGEON_MODE<uint32>(54160,H_SPELL_ARCANE_POWER)
59#define SPELL_POWER_BALL_DAMAGE_TRIGGER DUNGEON_MODE<uint32>(54207,59476)
60
62{
63 // Xevozz
71
72 // Ethereal Sphere
74};
75
77{
79};
80
81struct boss_xevozz : public BossAI
82{
83 boss_xevozz(Creature* creature) : BossAI(creature, DATA_XEVOZZ) { }
84
85 void Reset() override
86 {
88 }
89
90 void JustEngagedWith(Unit* who) override
91 {
94 }
95
96 void JustReachedHome() override
97 {
100 }
101
102 void JustSummoned(Creature* summon) override
103 {
104 BossAI::JustSummoned(summon);
105 summon->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f);
106 }
107
108 void KilledUnit(Unit* victim) override
109 {
110 if (victim->GetTypeId() == TYPEID_PLAYER)
111 Talk(SAY_SLAY);
112 }
113
114 void JustDied(Unit* /*killer*/) override
115 {
117 _JustDied();
118 }
119
120 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
121 {
122 if (spellInfo->Id == SPELL_ARCANE_POWER || spellInfo->Id == H_SPELL_ARCANE_POWER)
124 }
125
126 void UpdateAI(uint32 diff) override
127 {
128 if (!UpdateVictim())
129 return;
130
131 scheduler.Update(diff);
132 }
133
134 void ScheduleTasks() override
135 {
136 scheduler.Schedule(Seconds(8), Seconds(10), [this](TaskContext task)
137 {
139 task.Repeat(Seconds(8), Seconds(10));
140 });
141
142 scheduler.Schedule(Seconds(10), Seconds(11), [this](TaskContext task)
143 {
144 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true))
146 task.Repeat(Seconds(15), Seconds(20));
147 });
148
149 scheduler.Schedule(Seconds(5), [this](TaskContext task)
150 {
152
153 std::list<uint8> summonSpells = { 0, 1, 2 };
154
157 summonSpells.remove(spell);
158
159 if (IsHeroic())
160 {
162 task.Schedule(Milliseconds(2500), [this, spell](TaskContext /*task*/)
163 {
165 });
166 }
167
168 task.Schedule(Seconds(33), Seconds(35), [this](TaskContext /*task*/)
169 {
172 });
173
174 task.Repeat(Seconds(45), Seconds(47));
175 });
176 }
177};
178
180{
182 {
183 instance = creature->GetInstanceScript();
184 }
185
186 void Reset() override
187 {
190
193
194 me->DespawnOrUnsummon(40s);
195 }
196
197 void DoAction(int32 action) override
198 {
199 if (action == ACTION_SUMMON)
200 {
203 }
204 }
205
206 void UpdateAI(uint32 diff) override
207 {
208 scheduler.Update(diff);
209 }
210
212 {
213 scheduler.Schedule(Seconds(1), [this](TaskContext task)
214 {
216 {
217 if (me->IsWithinDist(xevozz, 3.0f))
218 {
219 DoCastAOE(SPELL_ARCANE_POWER);
220 me->DespawnOrUnsummon(8s);
221 return;
222 }
223 }
224 task.Repeat();
225 });
226 }
227
228private:
231};
232
233// 54164 - Summon Players
235{
236 bool Validate(SpellInfo const* /*spellInfo*/) override
237 {
239 }
240
241 void HandleScript(SpellEffIndex /*effIndex*/)
242 {
244 }
245
246 void Register() override
247 {
249 }
250};
251
253{
257}
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_DUMMY
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
Yells
void AddSC_boss_xevozz()
@ SAY_DEATH
Definition: boss_xevozz.cpp:66
@ SAY_REPEAT_SUMMON
Definition: boss_xevozz.cpp:69
@ SAY_ETHEREAL_SPHERE_SUMMON
Definition: boss_xevozz.cpp:73
@ SAY_AGGRO
Definition: boss_xevozz.cpp:64
@ SAY_SUMMON_ENERGY
Definition: boss_xevozz.cpp:70
@ SAY_SLAY
Definition: boss_xevozz.cpp:65
@ SAY_SPAWN
Definition: boss_xevozz.cpp:67
@ SAY_CHARGED
Definition: boss_xevozz.cpp:68
#define SPELL_ARCANE_POWER
Definition: boss_xevozz.cpp:58
SphereActions
Definition: boss_xevozz.cpp:77
@ ACTION_SUMMON
Definition: boss_xevozz.cpp:78
CreatureSpells
Definition: boss_xevozz.cpp:51
@ SPELL_POWER_BALL_VISUAL
Definition: boss_xevozz.cpp:55
@ H_SPELL_ARCANE_POWER
Definition: boss_xevozz.cpp:52
@ SPELL_SUMMON_PLAYERS
Definition: boss_xevozz.cpp:54
@ SPELL_MAGIC_PULL
Definition: boss_xevozz.cpp:53
@ SPELL_ARCANE_BARRAGE_VOLLEY
Definition: boss_xevozz.cpp:34
@ SPELL_ARCANE_BUFFET
Definition: boss_xevozz.cpp:35
@ SPELL_SUMMON_TARGET_VISUAL
Definition: boss_xevozz.cpp:36
@ NPC_ETHEREAL_SPHERE
Definition: boss_xevozz.cpp:45
@ NPC_ETHEREAL_SPHERE2
Definition: boss_xevozz.cpp:46
@ NPC_ETHEREAL_SUMMON_TARGET
Definition: boss_xevozz.cpp:47
static uint32 const EtherealSphereCount
Definition: boss_xevozz.cpp:39
#define SPELL_POWER_BALL_DAMAGE_TRIGGER
Definition: boss_xevozz.cpp:59
static uint32 const EtherealSphereSummonSpells[EtherealSphereCount]
Definition: boss_xevozz.cpp:40
static uint32 const EtherealSphereHeroicSummonSpells[EtherealSphereCount]
Definition: boss_xevozz.cpp:41
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *summon) override
TaskScheduler scheduler
void JustReachedHome() override
SummonList summons
void Reset() override
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
Creature * GetCreature(uint32 type)
void MoveFollow(Unit *target, float dist, ChaseAngle angle, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_ACTIVE)
TypeID GetTypeId() const
Definition: Object.h:173
uint32 const Id
Definition: SpellInfo.h:325
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
void DoAction(int32 info, Predicate &&predicate, uint16 max=0)
TaskContext & Schedule(std::chrono::duration< Rep, Period > time, TaskScheduler::task_handler_t task)
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
void HandleScript(SpellEffIndex)
bool Validate(SpellInfo const *) override
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
bool IsHeroic() const
void JustSummoned(Creature *summon) override
void JustReachedHome() override
Definition: boss_xevozz.cpp:96
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
boss_xevozz(Creature *creature)
Definition: boss_xevozz.cpp:83
void KilledUnit(Unit *victim) override
void Reset() override
Definition: boss_xevozz.cpp:85
void JustEngagedWith(Unit *who) override
Definition: boss_xevozz.cpp:90
void ScheduleTasks() override
void UpdateAI(uint32 diff) override
npc_ethereal_sphere(Creature *creature)
TaskScheduler scheduler
InstanceScript * instance
void Reset() override
void DoAction(int32 action) override
@ DATA_HANDLE_CELLS
Definition: violet_hold.h:87
@ DATA_XEVOZZ
Definition: violet_hold.h:58
#define RegisterVioletHoldCreatureAI(ai_name)
Definition: violet_hold.h:164