TrinityCore
boss_grandmaster_vorpil.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 "ObjectAccessor.h"
23#include "ScriptedCreature.h"
24#include "shadow_labyrinth.h"
25
27{
33 SAY_WIPE = 5
34};
35
37{
39 SPELL_BANISH = 38791,
42
49
52
53 // Voidwalker Summoner
59
60 // Void Traveler
65};
66
68{
74};
75
76std::array<uint32, 5> const VoidwalkerSummonSpells =
77{
79};
80
82{
84
85 void JustEngagedWith(Unit* who) override
86 {
90 if (IsHeroic())
93
101 }
102
103 void KilledUnit(Unit* who) override
104 {
105 if (who->GetTypeId() == TYPEID_PLAYER)
106 Talk(SAY_SLAY);
107 }
108
109 // Despawn is handled by spells, don't store anything
110 void JustSummoned(Creature* /*summon*/) override { }
111
112 void EnterEvadeMode(EvadeReason why) override
113 {
114 Talk(SAY_WIPE);
118 }
119
120 void JustDied(Unit* /*killer*/) override
121 {
122 _JustDied();
126 }
127
128 void UpdateAI(uint32 diff) override
129 {
130 if (!UpdateVictim())
131 return;
132
133 events.Update(diff);
134
136 return;
137
138 while (uint32 eventId = events.ExecuteEvent())
139 {
140 switch (eventId)
141 {
142 case EVENT_HELP:
143 Talk(SAY_HELP);
144 break;
147 events.Repeat(10s, 25s);
148 break;
149 case EVENT_BANISH:
150 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, false))
151 DoCast(target, SPELL_BANISH);
152 events.Repeat(20s, 30s);
153 break;
155 if (roll_chance_i(50))
156 Talk(SAY_DRAW);
158 events.Repeat(35s, 45s);
160 break;
163 break;
164 }
165
167 return;
168 }
169 }
170};
171
173{
174 npc_voidwalker_summoner(Creature* creature) : ScriptedAI(creature) { }
175
176 void JustAppeared() override
177 {
178 _scheduler.Schedule(10s, [this](TaskContext task)
179 {
181 task.Repeat(10s, 15s);
182 });
183 }
184
185 void UpdateAI(uint32 diff) override
186 {
187 _scheduler.Update(diff);
188 }
189
190private:
192};
193
195{
196 npc_void_traveler(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
197
198 void InitializeAI() override
199 {
201 }
202
203 // This part needs more work
204 void JustAppeared() override
205 {
207 me->GetMotionMaster()->MoveFollow(vorpil, 0, 0);
208
209 _scheduler.Schedule(500ms, [this](TaskContext task)
210 {
212 {
213 if (me->IsWithinDist(vorpil, 3))
214 {
215 DoCastSelf(SPELL_SACRIFICE);
216
217 task.Schedule(1s, [this](TaskContext /*task*/)
218 {
219 DoCastSelf(SPELL_EMPOWERING_SHADOWS);
220 DoCastSelf(SPELL_SHADOW_NOVA);
221 DoCastSelf(SPELL_INSTAKILL_SELF);
222 });
223 }
224 else
225 task.Repeat();
226 }
227 });
228 }
229
230 void UpdateAI(uint32 diff) override
231 {
232 _scheduler.Update(diff);
233 }
234
235private:
238};
239
241{
245}
Texts
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
bool roll_chance_i(int chance)
Definition: Random.h:59
EvadeReason
Definition: UnitAICommon.h:30
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ UNIT_STATE_CASTING
Definition: Unit.h:270
std::array< uint32, 5 > const VoidwalkerSummonSpells
@ SPELL_SUMMON_VOID_PORTAL_D
@ SPELL_DESPAWN_VOID_PORTALS
@ SPELL_SUMMON_VOID_PORTAL_B
@ SPELL_SUMMON_VOIDWALKER_C
@ SPELL_DRAW_SHADOWS
@ SPELL_EMPOWERING_SHADOWS
@ SPELL_SUMMON_VOIDWALKER_A
@ SPELL_SUMMON_VOIDWALKER_D
@ SPELL_INSTAKILL_SELF
@ SPELL_GREAT_SACRIFICE
@ SPELL_RAIN_OF_FIRE
@ SPELL_SUMMON_VOID_SUMMONER
@ SPELL_SUMMON_VOID_PORTAL_C
@ SPELL_SHADOWBOLT_VOLLEY
@ SPELL_SUMMON_VOIDWALKER_B
@ SPELL_SUMMON_VOIDWALKER_E
@ SPELL_SUMMON_VOID_PORTAL_E
@ SPELL_SUMMON_VOID_PORTAL_A
@ EVENT_DRAW_SHADOWS
@ EVENT_SHADOWBOLT_VOLLEY
@ EVENT_RAIN_OF_FIRE
void AddSC_boss_grandmaster_vorpil()
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
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 SetReactState(ReactStates st)
Definition: Creature.h:160
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveFollow(Unit *target, float dist, ChaseAngle angle, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_ACTIVE)
TypeID GetTypeId() const
Definition: Object.h:173
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
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:627
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
#define RegisterShadowLabyrinthCreatureAI(ai_name)
@ DATA_GRANDMASTER_VORPIL
bool IsHeroic() const
boss_grandmaster_vorpil(Creature *creature)
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void EnterEvadeMode(EvadeReason why) override
void JustSummoned(Creature *) override
void KilledUnit(Unit *who) override
void UpdateAI(uint32 diff) override
npc_void_traveler(Creature *creature)
npc_voidwalker_summoner(Creature *creature)
void UpdateAI(uint32 diff) override